// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r13
cvtsi2sdl 0x30(%rdi), %xmm0
movsd %xmm0, (%rsp)
movsd 0xdb81(%rip), %xmm0     # 0x2b058
movl %edx, %edi
callq 0x3410
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r15d
xorps %xmm0, %xmm0
cvtsi2sdl 0x34(%r13), %xmm0
movsd %xmm0, (%rsp)
movsd 0xdb56(%rip), %xmm0     # 0x2b058
movl %ebp, %edi
callq 0x3410
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %r12d
testl %r12d, %r12d
jle 0x1d535
movq 0x40(%r13), %rax
movl %r12d, %ecx
xorl %edx, %edx
xorl %esi, %esi
movl %edx, (%rax,%rsi,4)
incq %rsi
addl %r15d, %edx
cmpq %rsi, %rcx
jne 0x1d527
movslq %ebp, %rbx
movl %ebp, (%rsp)
testl %ebp, %ebp
je 0x1d54a
movq 0x28(%r13), %rax
movq -0x8(%rax,%rbx,8), %rbp
jmp 0x1d5c7
movq 0x1c5cf(%rip), %r8      # 0x39b20
movl 0x1c5a8(%rip), %r9d     # 0x39b00
movl $0x1, %eax
movq %r13, %rdi
movq %r14, %rsi
movl %r15d, %edx
movl %r12d, %ecx
pushq %rax
pushq (%r13)
callq 0x1c96c
addq $0x10, %rsp
movl %r12d, %eax
imull %r15d, %eax
cltq
leaq (,%rax,8), %rcx
testl %eax, %eax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0x3030
movq %rax, %rbp
movq 0x1c584(%rip), %r8      # 0x39b28
movl 0x1c559(%rip), %r9d     # 0x39b04
movq %r13, %rdi
movq %r14, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl $0x1, %eax
pushq %rax
pushq %rbp
callq 0x1c96c
addq $0x10, %rsp
movq 0x1c56a(%rip), %r8      # 0x39b38
movl 0x1c537(%rip), %r9d     # 0x39b0c
movq 0x8(%r13), %rax
movl $0x1, %r10d
movq %r13, %rdi
movq %rbp, %rsi
movl %r15d, %edx
movl %r12d, %ecx
pushq %r10
pushq (%rax,%rbx,8)
callq 0x1c96c
addq $0x10, %rsp
movq 0x1c540(%rip), %r8      # 0x39b40
movl 0x1c509(%rip), %r9d     # 0x39b10
movq 0x10(%r13), %rax
movq %r13, %rdi
movq %rbp, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl $0x1, %r10d
pushq %r10
pushq (%rax,%rbx,8)
callq 0x1c96c
addq $0x10, %rsp
movq 0x1c516(%rip), %r8      # 0x39b48
movl 0x1c4db(%rip), %r9d     # 0x39b14
movq 0x18(%r13), %rax
movq %r13, %rdi
movq %rbp, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl $0x1, %r10d
pushq %r10
pushq (%rax,%rbx,8)
callq 0x1c96c
addq $0x10, %rsp
movq 0x1c4ec(%rip), %r8      # 0x39b50
movl 0x1c4ad(%rip), %r9d     # 0x39b18
movq 0x20(%r13), %rax
movq %r13, %rdi
movq %rbp, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl $0x1, %r10d
pushq %r10
pushq (%rax,%rbx,8)
callq 0x1c96c
addq $0x10, %rsp
movq 0x1c49a(%rip), %r8      # 0x39b30
movl 0x1c46b(%rip), %r9d     # 0x39b08
movq %r13, %rdi
movq %rbp, %rsi
movl %r15d, %edx
movl %r12d, %ecx
movl $0x1, %eax
pushq %rax
pushq %r14
callq 0x1c96c
addq $0x10, %rsp
cmpl $0x2, %r12d
jl 0x1d70e
shrl %r12d
movq 0x28(%r13), %rax
movq (%rax,%rbx,8), %rax
leal (%r15,%r15), %ecx
movl %r15d, %edx
shrl $0x1f, %edx
addl %r15d, %edx
sarl %edx
xorl %esi, %esi
cmpl $0x2, %r15d
jl 0x1d706
movl %ecx, %edi
imull %esi, %edi
movslq %edi, %rdi
leaq (%r14,%rdi,8), %rdi
movl %edx, %r8d
movsd (%rdi), %xmm0
movsd %xmm0, (%rax)
addq $0x8, %rax
addq $0x10, %rdi
decl %r8d
jne 0x1d6f1
incq %rsi
cmpq %r12, %rsi
jne 0x1d6dc
cmpl $0x0, (%rsp)
jne 0x1d72f
testq %rbp, %rbp
je 0x1d72f
movq %rbp, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x33c0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq