// File: /workspace/github_cpp_makefile_star2_O2/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 0x3c71
andq $0x0, 0x1b224(%rip)     # 0x32ba8
andq $0x0, 0x1b224(%rip)     # 0x32bb0
andq $0x0, 0x1b204(%rip)     # 0x32b98
movq %rax, 0x1b205(%rip)     # 0x32ba0
andq $0x0, 0x1b1ed(%rip)     # 0x32b90
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
callq 0x15752
movb %bpl, 0x48(%rbx)
testl %ebp, %ebp
jne 0x179dc
movq 0x18610(%rip), %rdi     # 0x2ffd0
callq 0x3120
leaq 0xe0b6(%rip), %rsi      # 0x25a82
movq %rax, %rdi
callq 0x32c0
movq %rax, %rdi
callq 0x3120
movslq 0x30(%rbx), %rax
movslq 0x34(%rbx), %rdx
imulq %rax, %rdx
movq 0x1b0e1(%rip), %rdi     # 0x32ad0
shlq $0x3, %rdx
movq %r14, %rsi
callq 0x3240
xorl %ebp, %ebp
cmpl 0x38(%rbx), %ebp
jge 0x17a29
movq 0x1b0c7(%rip), %rsi     # 0x32ad0
cmpb $0x0, 0x48(%rbx)
je 0x17a1b
movq %rbx, %rdi
movl %ebp, %edx
callq 0x1753e
jmp 0x17a25
movq %rbx, %rdi
movl %ebp, %edx
callq 0x17294
incl %ebp
jmp 0x179fd
callq 0x3c71
subq 0x1b16b(%rip), %rax     # 0x32ba0
movq %rax, 0x1b164(%rip)     # 0x32ba0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop