| ; Function compile flags: /Ogtpy
; File C:\Users\azlygostev.SWSOFT\Source\Repos\FilterTests\SauvolaBinarizeCPP\SauvolaBinarizeCPP.cpp
; COMDAT c4filter
_TEXT SEGMENT
tv3282 = 0
tv3291 = 8
tv3295 = 16
tv3296 = 24
tv3294 = 32
tv3292 = 40
tv3290 = 48
h$ = 128
w$ = 136
i$1$ = 144
input$ = 144
output$ = 152
c4filter PROC ; COMDAT
; 82 : {
$LN34:
mov QWORD PTR [rsp+32], r9
mov DWORD PTR [rsp+8], ecx
push rbx
push rsi
push r14
sub rsp, 96 ; 00000060H
movsxd r14, edx
mov rsi, r9
mov r10, r8
mov ebx, ecx
; 83 : if (input == NULL)
test r8, r8
jne SHORT $LN14@c4filter
; 84 : return -1; // error: no input
lea eax, QWORD PTR [r8-1]
; 104 : }
add rsp, 96 ; 00000060H
pop r14
pop rsi
pop rbx
ret 0
$LN14@c4filter:
; 85 : if (output == NULL)
test rsi, rsi
jne SHORT $LN15@c4filter
; 86 : return -2; // error: no output
lea eax, QWORD PTR [rsi-2]
; 104 : }
add rsp, 96 ; 00000060H
pop r14
pop rsi
pop rbx
ret 0
$LN15@c4filter:
; 87 : output[0] = (2 * (int)input[0] + (int)input[1] + (int)input[w]) / 4;
movsx ecx, BYTE PTR [r8]
movsx eax, BYTE PTR [r8+1]
mov QWORD PTR [rsp+136], rbp
; 88 : for (int j = 1; j < w - 1;j++)
lea rbp, QWORD PTR [r14-1]
mov QWORD PTR [rsp+88], rdi
mov QWORD PTR [rsp+80], r12
lea eax, DWORD PTR [rax+rcx*2]
mov QWORD PTR [rsp+72], r13
movsx ecx, BYTE PTR [r14+r8]
add eax, ecx
mov QWORD PTR [rsp+64], r15
cdq
and edx, 3
add eax, edx
sar eax, 2
mov DWORD PTR [r9], eax
cmp rbp, 1
jle SHORT $LN3@c4filter
add r9, 4
mov r11, r10
add r8, 2
not r11
npad 14
$LL4@c4filter:
; 89 : output[j] = ((int)input[j - 1] + (int)input[j] + (int)input[j + 1] + (int)input[j + w]) / 4;
movsx ecx, BYTE PTR [r8-2]
lea rax, QWORD PTR [r14+r8]
add rax, r11
lea r8, QWORD PTR [r8+1]
lea r9, QWORD PTR [r9+4]
movsx eax, BYTE PTR [rax+r10]
add eax, ecx
movsx ecx, BYTE PTR [r8-2]
add eax, ecx
movsx ecx, BYTE PTR [r8-1]
add eax, ecx
cdq
and edx, 3
add eax, edx
sar eax, 2
mov DWORD PTR [r9-4], eax
lea rax, QWORD PTR [r8+r11]
cmp rax, rbp
jl SHORT $LL4@c4filter
$LN3@c4filter:
; 90 : output[w - 1] = (2 * (int)input[w - 1] + (int)input[w - 2] + (int)input[w + w - 1]) / 4;
movsx ecx, BYTE PTR [r10+rbp]
lea r13d, DWORD PTR [r14+r14]
mov r11d, 1
movsxd r9, r13d
mov DWORD PTR i$1$[rsp], r11d
movsx eax, BYTE PTR [r9+r10-1]
lea eax, DWORD PTR [rax+rcx*2]
movsx ecx, BYTE PTR [r14+r10-2]
add eax, ecx
cdq
and edx, 3
add eax, edx
sar eax, 2
; 91 : for (int i = 1; i < h - 1; i++)
dec ebx
mov DWORD PTR [rsi+rbp*4], eax
mov DWORD PTR tv3282[rsp], ebx
cmp ebx, r11d
jle $LN6@c4filter
; 90 : output[w - 1] = (2 * (int)input[w - 1] + (int)input[w - 2] + (int)input[w + w - 1]) / 4;
lea rax, QWORD PTR [r14*4]
mov edx, 2
lea rdi, QWORD PTR [rsi+4]
sub rdx, r9
add rdi, rax
mov QWORD PTR tv3294[rsp], rdx
mov rax, r9
lea r8, QWORD PTR [r10-2]
sub rax, r14
inc r13d
add r8, r9
lea rax, QWORD PTR [rax*4-8]
mov QWORD PTR tv3296[rsp], rax
lea eax, DWORD PTR [r14+r14*2]
cdqe
sub rax, r9
inc rax
mov QWORD PTR tv3295[rsp], rax
mov rax, r14
sub rax, r9
lea rcx, QWORD PTR [rax+3]
lea rsi, QWORD PTR [rax+4]
mov QWORD PTR tv3292[rsp], rcx
add rax, 2
mov QWORD PTR tv3291[rsp], rsi
mov QWORD PTR tv3290[rsp], rax
npad 1
$LL7@c4filter:
; 92 : {
; 93 : output[i * w] = ((int)input[i * w] + (int)input[(i - 1) * w] + (int)input[i * w + 1] + (int)input[(i + 1) * w]) / 4;
movsx eax, BYTE PTR [rax+r8]
movsx ecx, BYTE PTR [rcx+r8]
add eax, ecx
movsx ecx, BYTE PTR [rdx+r8]
add eax, ecx
movsx ecx, BYTE PTR [r8+2]
add eax, ecx
cdq
and edx, 3
add eax, edx
sar eax, 2
mov DWORD PTR [rdi-4], eax
; 94 : for (int j = 1; j < w - 1; j++)
cmp rbp, 1
jle SHORT $LN9@c4filter
; 95 : output[i * w + j] = ((int)input[(i - 1) * w + j] + (int)input[(i + 1) * w + j] + (int)input[i * w + (j - 1)] + (int)input[i * w + (j + 1)]) / 4;
mov eax, r14d
lea r11, QWORD PTR [rsi+r8]
neg eax
lea rsi, QWORD PTR [rbp-1]
mov r9d, r13d
mov rbx, rdi
lea r15d, DWORD PTR [rax+rax]
npad 13
$LL10@c4filter:
lea eax, DWORD PTR [r15+r9]
movsxd rcx, eax
lea rbx, QWORD PTR [rbx+4]
lea r11, QWORD PTR [r11+1]
movsx eax, BYTE PTR [rcx+r10]
movsxd rcx, r9d
inc r9d
movsx edx, BYTE PTR [rcx+r10]
movsx ecx, BYTE PTR [r11-3]
add eax, edx
add eax, ecx
movsx ecx, BYTE PTR [r11-1]
add eax, ecx
cdq
and edx, 3
add eax, edx
sar eax, 2
mov DWORD PTR [rbx-4], eax
sub rsi, 1
jne SHORT $LL10@c4filter
mov r11d, DWORD PTR i$1$[rsp]
mov ebx, DWORD PTR tv3282[rsp]
mov rsi, QWORD PTR tv3291[rsp]
$LN9@c4filter:
; 96 : output[i*w + w - 1] = (2 * (int)input[i * w + w - 1] + (int)input[i * w + w - 2] + (int)input[(i + 2)*w - 1]) / 4;
mov rax, QWORD PTR tv3295[rsp]
inc r11d
add r13d, r14d
mov DWORD PTR i$1$[rsp], r11d
movsx ecx, BYTE PTR [rax+r8]
movsx eax, BYTE PTR [r8+1]
lea eax, DWORD PTR [rcx+rax*2]
movsx ecx, BYTE PTR [r8]
add eax, ecx
add r8, r14
mov rcx, QWORD PTR tv3296[rsp]
cdq
and edx, 3
add eax, edx
mov rdx, QWORD PTR tv3294[rsp]
sar eax, 2
mov DWORD PTR [rcx+rdi], eax
lea rax, QWORD PTR [r14*4]
mov rcx, QWORD PTR tv3292[rsp]
add rdi, rax
mov rax, QWORD PTR tv3290[rsp]
cmp r11d, ebx
jl $LL7@c4filter
mov rsi, QWORD PTR output$[rsp]
$LN6@c4filter:
; 97 : }
; 98 : output[(h - 1) * w] = (2 * (int)input[(h - 1) * w] + (int)input[(h - 1) * w + 1] + (int)input[h * w]) / 4;
mov r11d, DWORD PTR h$[rsp]
mov eax, r11d
; 99 : for (int j = 1; j < w - 1;j++)
mov r13, QWORD PTR [rsp+72]
mov r12, QWORD PTR [rsp+80]
mov rbp, QWORD PTR [rsp+136]
imul eax, r14d
imul ebx, r14d
movsxd r15, eax
movsxd r8, ebx
movsx ecx, BYTE PTR [r8+r10]
lea rdi, QWORD PTR [r8+r10]
movsx eax, BYTE PTR [rdi+1]
lea eax, DWORD PTR [rax+rcx*2]
movsx ecx, BYTE PTR [r15+r10]
add eax, ecx
cdq
and edx, 3
add eax, edx
lea edx, DWORD PTR [r14-1]
sar eax, 2
mov DWORD PTR [rsi+r8*4], eax
cmp edx, 1
jle SHORT $LN12@c4filter
; 97 : }
; 98 : output[(h - 1) * w] = (2 * (int)input[(h - 1) * w] + (int)input[(h - 1) * w + 1] + (int)input[h * w]) / 4;
movsxd rcx, ebx
lea eax, DWORD PTR [r11-2]
inc rcx
imul eax, r14d
lea r8, QWORD PTR [r10+1]
add r8, rcx
lea r11d, DWORD PTR [rdx-1]
lea r9, QWORD PTR [rsi+rcx*4]
movsxd rbx, eax
sub rbx, rcx
$LL13@c4filter:
; 100 : output[(h - 1) * w + j] = ((int)input[(h - 1) * w + j - 1] + (int)input[(h - 1) * w + j] + (int)input[(h - 1) * w + j + 1] + (int)input[(h-2) * w + j]) / 4;
movsx ecx, BYTE PTR [r8-2]
lea r9, QWORD PTR [r9+4]
movsx eax, BYTE PTR [rbx+r8]
lea r8, QWORD PTR [r8+1]
add eax, ecx
movsx ecx, BYTE PTR [r8-2]
add eax, ecx
movsx ecx, BYTE PTR [r8-1]
add eax, ecx
cdq
and edx, 3
add eax, edx
sar eax, 2
mov DWORD PTR [r9-4], eax
sub r11, 1
jne SHORT $LL13@c4filter
$LN12@c4filter:
; 101 : output[h * w - 1] = (2 * (int)input[h * w - 1] + (int)input[h * w - 2] + (int)input[h * w - w - 1]) / 4;
movsx ecx, BYTE PTR [r15+r10-1]
movsx eax, BYTE PTR [r15+r10-2]
lea eax, DWORD PTR [rax+rcx*2]
movsx ecx, BYTE PTR [rdi-1]
; 102 :
; 103 : return 0;
mov rdi, QWORD PTR [rsp+88]
add eax, ecx
cdq
and edx, 3
add eax, edx
sar eax, 2
mov DWORD PTR [rsi+r15*4-4], eax
xor eax, eax
mov r15, QWORD PTR [rsp+64]
; 104 : }
add rsp, 96 ; 00000060H
pop r14
pop rsi
pop rbx
ret 0
c4filter ENDP
_TEXT ENDS
|