// File: kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::DoOneStepWaveletAnalysis(double*, int)
void SteerablePyramid::DoOneStepWaveletAnalysis(Float_t* pixelValues, int level)
{
	int horDim = width_ / pow(2, level);
	int verDim = height_ / pow(2, level);
	
	for (int i = 0; i < verDim; i++)
		yLookup_[i] = i * horDim;
	
	Float_t *l0OriginalCoeffs = NULL;
	
	const Float_t *pixelPtr;
	Float_t *coeffPtr;
	
	if (level == 0)
	{
		ConvolveImage(pixelValues, horDim, verDim, skFilters[0], skFilterDims[0], h0Coeffs_, true);
		
		l0OriginalCoeffs = new Float_t[horDim * verDim];
		assert(l0OriginalCoeffs);
		ConvolveImage(pixelValues, horDim, verDim, skFilters[1], skFilterDims[1], l0OriginalCoeffs, true);
	}
	else l0OriginalCoeffs = l1Coeffs_[level - 1];
	
	ConvolveImage((const Float_t*)l0OriginalCoeffs, horDim, verDim, skFilters[3], skFilterDims[3], b1Coeffs_[level], true);
	ConvolveImage((const Float_t*)l0OriginalCoeffs, horDim, verDim, skFilters[4], skFilterDims[4], b2Coeffs_[level], true);
	ConvolveImage((const Float_t*)l0OriginalCoeffs, horDim, verDim, skFilters[5], skFilterDims[5], b3Coeffs_[level], true);
	ConvolveImage((const Float_t*)l0OriginalCoeffs, horDim, verDim, skFilters[6], skFilterDims[6], b4Coeffs_[level], true);
	ConvolveImage((const Float_t*)l0OriginalCoeffs, horDim, verDim, skFilters[2], skFilterDims[2], pixelValues, true);
	
	coeffPtr = l1Coeffs_[level];
	for (int y = 0; y < verDim / 2; y++)
	{
		pixelPtr = &pixelValues[(y * 2) * horDim];
		for (int x = 0; x < horDim / 2; x++)
		{
			*coeffPtr++ = *pixelPtr;
			pixelPtr += 2;
		}
	}
	
	if (level == 0)
		delete [] l0OriginalCoeffs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
cvtsi2sdl 0x30(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x14(%rbp), %esi
movl $0x2, %edi
callq 0x1d7f0
movq -0x58(%rbp), %rax
movaps %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, -0x18(%rbp)
cvtsi2sdl 0x34(%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x14(%rbp), %esi
movl $0x2, %edi
callq 0x1d7f0
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2c9f6
movq -0x58(%rbp), %rax
movl -0x20(%rbp), %edx
imull -0x18(%rbp), %edx
movq 0x40(%rax), %rax
movslq -0x20(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2c9cd
movq $0x0, -0x28(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x2cac1
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x301d3(%rip), %r8      # 0x5cbf0
movl 0x301ac(%rip), %r9d     # 0x5cbd0
movq (%rdi), %rax
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x2bc90
movl -0x18(%rbp), %eax
imull -0x1c(%rbp), %eax
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x2ca6f
jmp 0x2ca8e
leaq 0x1fc85(%rip), %rdi     # 0x4c6fb
leaq 0x1f8d9(%rip), %rsi     # 0x4c356
movl $0x49b, %edx            # imm = 0x49B
leaq 0x1fc83(%rip), %rcx     # 0x4c70c
callq 0x4240
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x30155(%rip), %r8      # 0x5cbf8
movl 0x3012a(%rip), %r9d     # 0x5cbd4
movq -0x28(%rbp), %rax
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x2bc90
jmp 0x2cada
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x30119(%rip), %r8      # 0x5cc08
movl 0x300e6(%rip), %r9d     # 0x5cbdc
movq 0x8(%rdi), %rax
movslq -0x14(%rbp), %r10
movq (%rax,%r10,8), %rax
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x2bc90
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x300e8(%rip), %r8      # 0x5cc10
movl 0x300b1(%rip), %r9d     # 0x5cbe0
movq 0x10(%rdi), %rax
movslq -0x14(%rbp), %r10
movq (%rax,%r10,8), %rax
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x2bc90
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x300b7(%rip), %r8      # 0x5cc18
movl 0x3007c(%rip), %r9d     # 0x5cbe4
movq 0x18(%rdi), %rax
movslq -0x14(%rbp), %r10
movq (%rax,%r10,8), %rax
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x2bc90
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x30086(%rip), %r8      # 0x5cc20
movl 0x30047(%rip), %r9d     # 0x5cbe8
movq 0x20(%rdi), %rax
movslq -0x14(%rbp), %r10
movq (%rax,%r10,8), %rax
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x2bc90
movq -0x58(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x3002d(%rip), %r8      # 0x5cc00
movl 0x2fffe(%rip), %r9d     # 0x5cbd8
movq -0x10(%rbp), %rax
movq %rax, (%rsp)
movl $0x1, 0x8(%rsp)
callq 0x2bc90
movq -0x58(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x1c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x5c(%rbp), %eax
cmpl %ecx, %eax
jge 0x2cca2
movq -0x10(%rbp), %rax
movl -0x3c(%rbp), %ecx
shll %ecx
imull -0x18(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x18(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x60(%rbp), %eax
cmpl %ecx, %eax
jge 0x2cc92
movq -0x30(%rbp), %rax
movsd (%rax), %xmm0
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x38(%rbp)
movsd %xmm0, (%rax)
movq -0x30(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x2cc46
jmp 0x2cc94
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2cc0a
cmpl $0x0, -0x14(%rbp)
jne 0x2ccc1
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x2ccbf
movq -0x68(%rbp), %rdi
callq 0x44d0
jmp 0x2ccc1
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)