// File: kebwi[P]Trifid/src/SteerablePyramid.cpp
// Function: SteerablePyramid::Init(int, int)
void SteerablePyramid::Init(int width, int height)
{
	if (width_ == width && height_ == height)
		return;
	width_ = width;
	height_ = height;
	
	CreateScratch();
	
	Destroy();
	
	DetermineNumLevels();
	
	yLookup_ = new int[height_];
	
	int totalPixels = width_ * height_;
	h0Coeffs_ = new Float_t[totalPixels];
	
	b1Coeffs_ = new Float_t*[numLevels_];
	for (int i = 0; i < numLevels_; i++)
		b1Coeffs_[i] = new Float_t[totalPixels / (int)(pow(4, i))];
	
	b2Coeffs_ = new Float_t*[numLevels_];
	for (int i = 0; i < numLevels_; i++)
		b2Coeffs_[i] = new Float_t[totalPixels / (int)(pow(4, i))];
	
	b3Coeffs_ = new Float_t*[numLevels_];
	for (int i = 0; i < numLevels_; i++)
		b3Coeffs_[i] = new Float_t[totalPixels / (int)(pow(4, i))];
	
	b4Coeffs_ = new Float_t*[numLevels_];
	for (int i = 0; i < numLevels_; i++)
		b4Coeffs_[i] = new Float_t[totalPixels / (int)(pow(4, i))];
	
	l1Coeffs_ = new Float_t*[numLevels_];
	for (int i = 0; i < numLevels_; i++)
		l1Coeffs_[i] = new Float_t[totalPixels / (int)(pow(4, i + 1))];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl 0x30(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x29d13
movq -0x30(%rbp), %rax
movl 0x34(%rax), %eax
cmpl -0x10(%rbp), %eax
jne 0x29d13
jmp 0x2a0dc
movq -0x30(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, 0x30(%rdi)
movl -0x10(%rbp), %eax
movl %eax, 0x34(%rdi)
callq 0x29640
movq -0x30(%rbp), %rdi
callq 0x29a10
movq -0x30(%rbp), %rdi
callq 0x2ba60
movq -0x30(%rbp), %rax
movslq 0x34(%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq -0x30(%rbp), %rcx
movq %rax, 0x40(%rcx)
movl 0x30(%rcx), %eax
imull 0x34(%rcx), %eax
movl %eax, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movslq 0x38(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x18(%rbp)
movq -0x30(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x29e45
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x18(%rbp), %esi
movl $0x4, %edi
callq 0x1d7f0
movl -0x34(%rbp), %eax
cvttsd2si %xmm0, %ecx
cltd
idivl %ecx
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x18(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x29ddb
movq -0x30(%rbp), %rax
movslq 0x38(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x1c(%rbp)
movq -0x30(%rbp), %rcx
movl -0x1c(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x29eea
movl -0x14(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x1c(%rbp), %esi
movl $0x4, %edi
callq 0x1d7f0
movl -0x38(%rbp), %eax
cvttsd2si %xmm0, %ecx
cltd
idivl %ecx
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x29e80
movq -0x30(%rbp), %rax
movslq 0x38(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0x20(%rbp)
movq -0x30(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x29f8f
movl -0x14(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x20(%rbp), %esi
movl $0x4, %edi
callq 0x1d7f0
movl -0x3c(%rbp), %eax
cvttsd2si %xmm0, %ecx
cltd
idivl %ecx
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x29f25
movq -0x30(%rbp), %rax
movslq 0x38(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movl $0x0, -0x24(%rbp)
movq -0x30(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x2a034
movl -0x14(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x24(%rbp), %esi
movl $0x4, %edi
callq 0x1d7f0
movl -0x40(%rbp), %eax
cvttsd2si %xmm0, %ecx
cltd
idivl %ecx
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x29fca
movq -0x30(%rbp), %rax
movslq 0x38(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rcx
movl -0x28(%rbp), %eax
cmpl 0x38(%rcx), %eax
jge 0x2a0dc
movl -0x14(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x28(%rbp), %esi
addl $0x1, %esi
movl $0x4, %edi
callq 0x1d7f0
movl -0x44(%rbp), %eax
cvttsd2si %xmm0, %ecx
cltd
idivl %ecx
cltq
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x4030
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2a06f
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)