// File: kebwi[P]Trifid/src/DebayerProcs.cpp
// Function: deBayer(ImageReal&, Image3ChnlReal&)
void deBayer(ImageReal &grayImage, Image3ChnlReal &rgbImage)
{
	cout << endl << "DeBayerizing..." << endl;
	
	if (rgbImage.width() != grayImage.width() || rgbImage.height() != grayImage.height())
		die("DeBayer output isn't same size as deBayer input");
	
	string suffix;
	switch (gDeBayerMethod)
	{
		case DB_NEAREST_NEIGHBOR:
			nn_deBayer(grayImage, rgbImage);
			suffix = "-nn";
			break;
		case DB_BILINEAR:
			bilinear_deBayer(grayImage, rgbImage);
			suffix = "-bl";
			break;
		case DB_SMOOTH_HUE:
			hue_deBayer(grayImage, rgbImage);
			suffix = "-hue";
			break;
		case DB_ALTERNATING_PROJECTIONS:
			altProj_deBayer(grayImage, rgbImage);
			suffix = "-ap";
			break;
	}
	
	rgbImage.setFilename(grayImage.filename());
	rgbImage.appendFilename("_db");
	rgbImage.appendFilename(suffix);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x3ca06(%rip), %rdi     # 0x59fd0
movq 0x3c9e7(%rip), %rsi     # 0x59fb8
callq 0x43d0
movq %rax, %rdi
leaq 0x2d561(%rip), %rsi     # 0x4ab41
callq 0x4390
movq %rax, %rdi
movq 0x3c9c9(%rip), %rsi     # 0x59fb8
callq 0x43d0
movq -0x10(%rbp), %rdi
callq 0xedd0
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedd0
movl %eax, %ecx
movl -0x84(%rbp), %eax
cmpl %ecx, %eax
jne 0x1d63c
movq -0x10(%rbp), %rdi
callq 0xedf0
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0xedf0
movl %eax, %ecx
movl -0x88(%rbp), %eax
cmpl %ecx, %eax
je 0x1d648
leaq 0x2d50e(%rip), %rdi     # 0x4ab51
callq 0x5360
leaq -0x30(%rbp), %rdi
callq 0x4500
leaq 0x3cd38(%rip), %rax     # 0x5a390
movl (%rax), %eax
movq %rax, -0x90(%rbp)
subq $0x3, %rax
ja 0x1d71f
movq -0x90(%rbp), %rax
leaq 0x2ced7(%rip), %rcx     # 0x4a550
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x19b60
jmp 0x1d691
leaq 0x2d4e9(%rip), %rsi     # 0x4ab81
leaq -0x30(%rbp), %rdi
callq 0x44f0
jmp 0x1d6a3
jmp 0x1d71f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1d7d9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1a630
jmp 0x1d6c5
leaq 0x2d4b9(%rip), %rsi     # 0x4ab85
leaq -0x30(%rbp), %rdi
callq 0x44f0
jmp 0x1d6d7
jmp 0x1d71f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1b3e0
jmp 0x1d6e8
leaq 0x2d49a(%rip), %rsi     # 0x4ab89
leaq -0x30(%rbp), %rdi
callq 0x44f0
jmp 0x1d6fa
jmp 0x1d71f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1cd70
jmp 0x1d70b
leaq 0x2d47c(%rip), %rsi     # 0x4ab8e
leaq -0x30(%rbp), %rdi
callq 0x44f0
jmp 0x1d71d
jmp 0x1d71f
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xf090
jmp 0x1d739
movq -0x98(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x154b0
jmp 0x1d74b
leaq -0x60(%rbp), %rdi
callq 0x46c8
movq -0x10(%rbp), %rdi
leaq 0x2d433(%rip), %rsi     # 0x4ab92
callq 0xf220
jmp 0x1d766
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4180
jmp 0x1d780
movq -0xa0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x154f0
jmp 0x1d792
leaq -0x80(%rbp), %rdi
callq 0x46c8
leaq -0x30(%rbp), %rdi
callq 0x46c8
addq $0xa0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x46c8
jmp 0x1d7d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x46c8
leaq -0x30(%rbp), %rdi
callq 0x46c8
movq -0x38(%rbp), %rdi
callq 0x4620
nopl (%rax,%rax)