// File: /workspace/github_cpp_makefile_star2_O3/kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::DoFullWaveletAnalysis(double const*, int, int, bool)
void SteerablePyramid::DoFullWaveletAnalysis(const Float_t* pixelValues, int width, int height, bool useFTconvolution)
{
	gT1 = getCurrentTime_ms();
	gT2 = gT3 = gT4 = gT5 = 0;
	
	Init(width, height);
	
	useFTconvolution_ = useFTconvolution;
	
	if (!useFTconvolution_)
		cout << endl << "SteerablePyramid Fourier Transform convolution disabled" << endl;
	
	int totalPixels = width_ * height_;
	/*
	Float_t minPixel = 999999, maxPixel = -999999;
	for (int i = 0; i < totalPixels; i++)
	{
		if (pixelValues[i] < minPixel)
			minPixel = pixelValues[i];
		if (pixelValues[i] > maxPixel)
			maxPixel = pixelValues[i];
	}
	cout << "Analysis Min/Max Pixels: " << minPixel << "    " << maxPixel << endl;
	*/
	memcpy(scratch_2D_A_, pixelValues, width_ * height_ * sizeof(Float_t));
	
	//cout << "  Performing analysis with " << numLevels_ << " levels" <<  endl;
	for (int i = 0; i < numLevels_; i++)
	{
		//cout << "    Analyzing level " << i << "..." << endl;
		if (!useFTconvolution_)
			DoOneStepWaveletAnalysis(scratch_2D_A_, i);
		else DoOneStepWaveletAnalysisUsingFT(scratch_2D_A_, i);
	}
	
	//cout << "  Done" << endl;
	
	gT1 = getCurrentTime_ms() - gT1;
	Float_t t1Secs = (Float_t)gT1 / CURRENT_TIME_PER_SEC_F;
	Float_t t2Secs = (Float_t)gT2 / CURRENT_TIME_PER_SEC_F;
	Float_t t3Secs = (Float_t)gT3 / CURRENT_TIME_PER_SEC_F;
	Float_t t4Secs = (Float_t)gT4 / CURRENT_TIME_PER_SEC_F;
	Float_t t5Secs = (Float_t)gT5 / CURRENT_TIME_PER_SEC_F;
	Float_t t2Fraction = (Float_t)gT2 / (Float_t)gT1;
	Float_t t3Fraction = (Float_t)gT3 / (Float_t)gT1;
	Float_t t4Fraction = (Float_t)gT4 / (Float_t)gT1;
	Float_t t5Fraction = (Float_t)gT5 / (Float_t)gT1;
	/*
	cout << "  Times:" << endl;
	cout << "    Total: " << t1Secs << endl;
	cout << "    T2: ";
	cout << setw(10) << t2Secs << "   Ratio: ";
	cout << setw(10) << t2Fraction << endl;
	cout << "    T3: ";
	cout << setw(10) << t3Secs << "   Ratio: ";
	cout << setw(10) << t3Fraction << endl;
	*/
	//cout << "  At2 " << t2Fraction << "  At3 " << t3Fraction << "  ";
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r8d, %ebp
movl %ecx, %r15d
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %rbx
callq 0x4288
movq %rax, 0x1c405(%rip)     # 0x39bb0
xorl %eax, %eax
movq %rax, 0x1c404(%rip)     # 0x39bb8
movq %rax, 0x1c405(%rip)     # 0x39bc0
movq %rax, 0x1c3e6(%rip)     # 0x39ba8
movq %rax, 0x1c3d7(%rip)     # 0x39ba0
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x1b05a
movb %bpl, 0x48(%rbx)
testl %ebp, %ebp
jne 0x1d84b
movq 0x197ea(%rip), %r15     # 0x36fd0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32e0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31f0
movq %rax, %r15
leaq 0x102cb(%rip), %rsi     # 0x2dae2
movl $0x37, %edx
movq %rax, %rdi
callq 0x3360
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32e0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31f0
movslq 0x30(%rbx), %rax
movslq 0x34(%rbx), %rdx
imulq %rax, %rdx
movq 0x1c282(%rip), %rdi     # 0x39ae0
shlq $0x3, %rdx
movq %r14, %rsi
callq 0x3260
cmpl $0x0, 0x38(%rbx)
jle 0x1d89c
xorl %ebp, %ebp
movq 0x1c267(%rip), %rsi     # 0x39ae0
cmpb $0x0, 0x48(%rbx)
je 0x1d88b
movq %rbx, %rdi
movl %ebp, %edx
callq 0x1d2d0
jmp 0x1d895
movq %rbx, %rdi
movl %ebp, %edx
callq 0x1cfac
incl %ebp
cmpl 0x38(%rbx), %ebp
jl 0x1d872
callq 0x4288
subq 0x1c308(%rip), %rax     # 0x39bb0
movq %rax, 0x1c301(%rip)     # 0x39bb0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq