// File: /workspace/github_cpp_makefile_star2_O1/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, 0x1c029(%rip)     # 0x39bb0
xorl %eax, %eax
movq %rax, 0x1c028(%rip)     # 0x39bb8
movq %rax, 0x1c029(%rip)     # 0x39bc0
movq %rax, 0x1c00a(%rip)     # 0x39ba8
movq %rax, 0x1bffb(%rip)     # 0x39ba0
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x1b4ce
movb %bpl, 0x48(%rbx)
testl %ebp, %ebp
jne 0x1dc27
movq 0x1940e(%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 0x10e87(%rip), %rsi     # 0x2ea7a
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 0x1bea6(%rip), %rdi     # 0x39ae0
shlq $0x3, %rdx
movq %r14, %rsi
callq 0x3260
cmpl $0x0, 0x38(%rbx)
jle 0x1dc78
xorl %ebp, %ebp
movq 0x1be8b(%rip), %rsi     # 0x39ae0
cmpb $0x0, 0x48(%rbx)
je 0x1dc67
movq %rbx, %rdi
movl %ebp, %edx
callq 0x1d73e
jmp 0x1dc71
movq %rbx, %rdi
movl %ebp, %edx
callq 0x1d4b2
incl %ebp
cmpl 0x38(%rbx), %ebp
jl 0x1dc4e
callq 0x4288
subq 0x1bf2c(%rip), %rax     # 0x39bb0
movq %rax, 0x1bf25(%rip)     # 0x39bb0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq