// File: kebwi[P]Trifid/src/main.cpp
// Function: testFourierConvolution(int)
void testFourierConvolution(int method)
{
	if (method == 0)
	{
		if (sInputFilenames.size() < 2)
			die("Please enter two PGM files to convolve");
		
		ImageReal img1, img2;
		img1.readFile(sInputFilenames[0]);
		img2.readFile(sInputFilenames[1]);
		
		ImageReal convolvedImgReal;
		convolveImages(img1, img2, convolvedImgReal);
		
		convolvedImgReal.normalize(1, false);
		
		convolvedImgReal.setFilename(img1.filename());
		convolvedImgReal.appendFilename("_conv");
		convolvedImgReal.writeFile(1);
	}
	else if (method == 1)
	{
		if (sInputFilenames.size() < 1)
			die("Please enter one PGM file to convolve with the steerable pyramid filters");
		
		ImageReal img1;
		img1.readFile(sInputFilenames[0]);
		
		SteerablePyramid steerPyr;
		steerPyr.DoFullWaveletAnalysis(img1.img(), img1.width(), img1.height(), false);
		
		ImageReal img1SynthReal(img1.width(), img1.height());
		steerPyr.DoFullWaveletSynthesis(img1SynthReal.img());
		
		Float_t mse, psnr;
		calc1ChnlMSE_PSNR(img1, img1SynthReal, mse, psnr);
		cout << "MSE/PSNR: " << mse << setw(14) << psnr << endl;
		
		//---------------------
		
		steerPyr.DoFullWaveletAnalysis(img1.img(), img1.width(), img1.height(), true);
		
		steerPyr.DoFullWaveletSynthesis(img1SynthReal.img());
		
		calc1ChnlMSE_PSNR(img1, img1SynthReal, mse, psnr);
		cout << "MSE/PSNR: " << mse << setw(14) << psnr << endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movl %edi, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0xdb25
leaq 0x4cd19(%rip), %rdi     # 0x5a5f8
callq 0xe730
cmpq $0x2, %rax
jae 0xd8f6
leaq 0x3c293(%rip), %rdi     # 0x49b84
callq 0x5360
leaq -0x48(%rbp), %rdi
callq 0x155e0
leaq -0x88(%rbp), %rdi
callq 0x155e0
jmp 0xd90d
leaq 0x4cce4(%rip), %rdi     # 0x5a5f8
xorl %eax, %eax
movl %eax, %esi
callq 0xe750
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x4180
jmp 0xd92e
leaq -0x48(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x16200
jmp 0xd940
leaq -0xb8(%rbp), %rdi
callq 0x46c8
leaq 0x4cca5(%rip), %rdi     # 0x5a5f8
movl $0x1, %esi
callq 0xe750
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
callq 0x4180
jmp 0xd96e
leaq -0x88(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x16200
jmp 0xd983
leaq -0xd8(%rbp), %rdi
callq 0x46c8
leaq -0x118(%rbp), %rdi
callq 0x155e0
jmp 0xd99d
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rsi
leaq -0x118(%rbp), %rdx
callq 0x28370
jmp 0xd9b6
leaq -0x118(%rbp), %rdi
movsd 0x3b65b(%rip), %xmm0    # 0x49020
xorl %esi, %esi
callq 0x15a10
jmp 0xd9ce
leaq -0x138(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xf090
jmp 0xd9e0
leaq -0x118(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x154b0
jmp 0xd9f5
leaq -0x138(%rbp), %rdi
callq 0x46c8
leaq 0x3c1a3(%rip), %rsi     # 0x49bab
leaq -0x118(%rbp), %rdi
callq 0xf220
jmp 0xda16
leaq -0x158(%rbp), %rdi
leaq -0x118(%rbp), %rsi
movl $0x1, %edx
callq 0x168c0
jmp 0xda30
leaq -0x158(%rbp), %rdi
callq 0x46c8
leaq -0x118(%rbp), %rdi
callq 0x157e0
leaq -0x88(%rbp), %rdi
callq 0x157e0
leaq -0x48(%rbp), %rdi
callq 0x157e0
jmp 0xdf3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xdb17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xdb0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x46c8
jmp 0xdb0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x46c8
jmp 0xdb0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xdaff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x46c8
leaq -0x118(%rbp), %rdi
callq 0x157e0
leaq -0x88(%rbp), %rdi
callq 0x157e0
leaq -0x48(%rbp), %rdi
callq 0x157e0
jmp 0xdf46
cmpl $0x1, -0x4(%rbp)
jne 0xdf3b
leaq 0x4cac2(%rip), %rdi     # 0x5a5f8
callq 0xe730
cmpq $0x1, %rax
jae 0xdb4d
leaq 0x3c069(%rip), %rdi     # 0x49bb1
callq 0x5360
leaq -0x198(%rbp), %rdi
callq 0x155e0
leaq 0x4ca98(%rip), %rdi     # 0x5a5f8
xorl %eax, %eax
movl %eax, %esi
callq 0xe750
movq %rax, %rsi
leaq -0x1b8(%rbp), %rdi
callq 0x4180
jmp 0xdb7a
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x16200
jmp 0xdb8f
leaq -0x1b8(%rbp), %rdi
callq 0x46c8
leaq -0x208(%rbp), %rdi
callq 0x293b0
jmp 0xdba9
leaq -0x198(%rbp), %rdi
callq 0xf2c0
movq %rax, -0x268(%rbp)
jmp 0xdbbe
leaq -0x198(%rbp), %rdi
callq 0xedd0
movl %eax, -0x26c(%rbp)
jmp 0xdbd2
leaq -0x198(%rbp), %rdi
callq 0xedf0
movl %eax, -0x270(%rbp)
jmp 0xdbe6
movl -0x270(%rbp), %ecx
movl -0x26c(%rbp), %edx
movq -0x268(%rbp), %rsi
leaq -0x208(%rbp), %rdi
xorl %r8d, %r8d
callq 0x2d2c0
jmp 0xdc0a
leaq -0x198(%rbp), %rdi
callq 0xedd0
movl %eax, -0x274(%rbp)
jmp 0xdc1e
leaq -0x198(%rbp), %rdi
callq 0xedf0
movl %eax, -0x278(%rbp)
jmp 0xdc32
movl -0x278(%rbp), %edx
movl -0x274(%rbp), %esi
leaq -0x248(%rbp), %rdi
callq 0x15710
jmp 0xdc4c
leaq -0x248(%rbp), %rdi
callq 0xf2c0
movq %rax, -0x280(%rbp)
jmp 0xdc61
movq -0x280(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x2e250
jmp 0xdc76
leaq -0x198(%rbp), %rdi
leaq -0x248(%rbp), %rsi
leaq -0x250(%rbp), %rdx
leaq -0x258(%rbp), %rcx
callq 0x37940
jmp 0xdc99
movq 0x4c330(%rip), %rdi     # 0x59fd0
leaq 0x3bece(%rip), %rsi     # 0x49b75
callq 0x4390
movq %rax, -0x288(%rbp)
jmp 0xdcb5
movq -0x288(%rbp), %rdi
movsd -0x250(%rbp), %xmm0
callq 0x4670
movq %rax, -0x290(%rbp)
jmp 0xdcd2
movl $0xe, %edi
callq 0xe410
movl %eax, -0x294(%rbp)
jmp 0xdce4
movq -0x290(%rbp), %rdi
movl -0x294(%rbp), %eax
movl %eax, -0x25c(%rbp)
movl -0x25c(%rbp), %esi
callq 0x4430
movq %rax, -0x2a0(%rbp)
jmp 0xdd0b
movq -0x2a0(%rbp), %rdi
movsd -0x258(%rbp), %xmm0
callq 0x4670
movq %rax, -0x2a8(%rbp)
jmp 0xdd28
movq -0x2a8(%rbp), %rdi
movq 0x4c282(%rip), %rsi     # 0x59fb8
callq 0x43d0
jmp 0xdd3d
leaq -0x198(%rbp), %rdi
callq 0xf2c0
movq %rax, -0x2b0(%rbp)
jmp 0xdd52
leaq -0x198(%rbp), %rdi
callq 0xedd0
movl %eax, -0x2b4(%rbp)
jmp 0xdd66
leaq -0x198(%rbp), %rdi
callq 0xedf0
movl %eax, -0x2b8(%rbp)
jmp 0xdd7a
movl -0x2b8(%rbp), %ecx
movl -0x2b4(%rbp), %edx
movq -0x2b0(%rbp), %rsi
leaq -0x208(%rbp), %rdi
movl $0x1, %r8d
callq 0x2d2c0
jmp 0xdda1
leaq -0x248(%rbp), %rdi
callq 0xf2c0
movq %rax, -0x2c0(%rbp)
jmp 0xddb6
movq -0x2c0(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x2e250
jmp 0xddcb
leaq -0x198(%rbp), %rdi
leaq -0x248(%rbp), %rsi
leaq -0x250(%rbp), %rdx
leaq -0x258(%rbp), %rcx
callq 0x37940
jmp 0xddee
movq 0x4c1db(%rip), %rdi     # 0x59fd0
leaq 0x3bd79(%rip), %rsi     # 0x49b75
callq 0x4390
movq %rax, -0x2c8(%rbp)
jmp 0xde0a
movq -0x2c8(%rbp), %rdi
movsd -0x250(%rbp), %xmm0
callq 0x4670
movq %rax, -0x2d0(%rbp)
jmp 0xde27
movl $0xe, %edi
callq 0xe410
movl %eax, -0x2d4(%rbp)
jmp 0xde39
movq -0x2d0(%rbp), %rdi
movl -0x2d4(%rbp), %eax
movl %eax, -0x260(%rbp)
movl -0x260(%rbp), %esi
callq 0x4430
movq %rax, -0x2e0(%rbp)
jmp 0xde60
movq -0x2e0(%rbp), %rdi
movsd -0x258(%rbp), %xmm0
callq 0x4670
movq %rax, -0x2e8(%rbp)
jmp 0xde7d
movq -0x2e8(%rbp), %rdi
movq 0x4c12d(%rip), %rsi     # 0x59fb8
callq 0x43d0
jmp 0xde92
leaq -0x248(%rbp), %rdi
callq 0x157e0
leaq -0x208(%rbp), %rdi
callq 0x299e0
leaq -0x198(%rbp), %rdi
callq 0x157e0
jmp 0xdf3b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xdf2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x46c8
jmp 0xdf2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xdf21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x157e0
leaq -0x208(%rbp), %rdi
callq 0x299e0
leaq -0x198(%rbp), %rdi
callq 0x157e0
jmp 0xdf46
jmp 0xdf3d
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x4620
nopw %cs:(%rax,%rax)