summaryrefslogtreecommitdiff
path: root/libavfilter/x86
diff options
context:
space:
mode:
authorEvgeny Pavlov <lucenticus@gmail.com>2023-07-31 13:26:16 +0200
committerPaul B Mahol <onemda@gmail.com>2023-08-21 17:04:51 +0200
commitcb1479faca0f41f575d680784f66b7d519a24b14 (patch)
tree7f3c576a4a6d6c6fd5acf7fe734c7315a38c364b /libavfilter/x86
parentf0b1cab53816aa53b78e63d3c53d02aa2a081820 (diff)
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>
Diffstat (limited to 'libavfilter/x86')
-rw-r--r--libavfilter/x86/vf_ssim.asm25
1 files changed, 11 insertions, 14 deletions
diff --git a/libavfilter/x86/vf_ssim.asm b/libavfilter/x86/vf_ssim.asm
index 78809305de..e3e0c8104b 100644
--- a/libavfilter/x86/vf_ssim.asm
+++ b/libavfilter/x86/vf_ssim.asm
@@ -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: