1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/vf_ssim: Fix x86 assembly code for SSIM calculation

This commit fixes bug #10495

The code had several bugs related to post-loop compensation code:
- test assembly instruction performs bitwise AND operation and
generate flags used by jz branch instruction. Wrong test condition
leads to incorrect branching
- Incorrect compensation code for some branches

Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com>
This commit is contained in:
Evgeny Pavlov 2023-07-31 13:26:16 +02:00 committed by Paul B Mahol
parent f0b1cab538
commit cb1479faca

View File

@ -228,25 +228,22 @@ cglobal ssim_end_line, 3, 3, 7, sum0, sum1, w
; subpd the ones we added too much
test wd, wd
jz .end
jz .end
add wd, 4
test wd, 3
jz .skip3
test wd, 2
jz .skip2
test wd, 1
jz .skip1
.skip3:
cmp wd, 1
jz .skip3
cmp wd, 2
jz .skip2
.skip1: ; 3 valid => skip 1 invalid
psrldq m5, 8
subpd m6, m5
jmp .end
.skip2:
psrldq m5, 8
jmp .end
.skip2: ; 2 valid => skip 2 invalid
subpd m6, m5
jmp .end
.skip3: ; 1 valid => skip 3 invalid
psrldq m3, 8
subpd m0, m3
jmp .end
.skip1:
psrldq m3, 16
subpd m6, m5
.end: