* [FFmpeg-devel] [PATCH] avfilter/vf_ssim: Fix x86 assembly code for SSIM calculation
@ 2023-07-31 11:26 Evgeny Pavlov
2023-08-14 22:37 ` Paul B Mahol
0 siblings, 1 reply; 2+ messages in thread
From: Evgeny Pavlov @ 2023-07-31 11:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Evgeny Pavlov
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>
---
libavfilter/x86/vf_ssim.asm | 25 +++++++++++--------------
1 file 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:
--
2.41.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-14 22:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-31 11:26 [FFmpeg-devel] [PATCH] avfilter/vf_ssim: Fix x86 assembly code for SSIM calculation Evgeny Pavlov
2023-08-14 22:37 ` Paul B Mahol
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git