PR #24157 opened by zuxy URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24157 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24157.patch
No more use of mm registers and emms. Performance identical except when bpp=8 (very rare in practice), for which the SSE2 version is ~2x faster. Signed-off-by: Zuxy Meng <[email protected]> >From 5be8d9bab560a2d7a4d40904ca10c1dfec3b8195 Mon Sep 17 00:00:00 2001 From: Zuxy Meng <[email protected]> Date: Wed, 12 Aug 2026 00:18:34 -0700 Subject: [PATCH] avcodec/x86/pngdsp.asm: replace MMX with SSE2 No more use of mm registers and emms. Performance identical except when bpp=8 (very rare in practice), for which the SSE2 version is ~2x faster. Signed-off-by: Zuxy Meng <[email protected]> --- libavcodec/x86/pngdsp.asm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/x86/pngdsp.asm b/libavcodec/x86/pngdsp.asm index e0a3b602de..59f16569a7 100644 --- a/libavcodec/x86/pngdsp.asm +++ b/libavcodec/x86/pngdsp.asm @@ -76,8 +76,8 @@ cglobal add_bytes_l2, 4, 6, 2, dst, src1, src2, wa, w, i jl .loop_s RET -INIT_MMX ssse3 -cglobal png_add_paeth_prediction, 5, 7, 0, dst, src, top, w, bpp, end, cntr +INIT_XMM ssse3 +cglobal png_add_paeth_prediction, 5, 7, 8, dst, src, top, w, bpp, end, cntr %if ARCH_X86_64 movsxd bppq, bppd movsxd wq, wd @@ -89,8 +89,10 @@ cglobal png_add_paeth_prediction, 5, 7, 0, dst, src, top, w, bpp, end, cntr pxor m7, m7 PUSH dstq - lea cntrq, [bppq-1] - shr cntrq, 2 + mmsize/16 + xor cntrd, cntrd + cmp bppd, 6 + jne .bpp_loop + inc cntrd .bpp_loop: lea dstq, [dstq+cntrq*(mmsize/2)] movh m0, [dstq] @@ -138,5 +140,4 @@ cglobal png_add_paeth_prediction, 5, 7, 0, dst, src, top, w, bpp, end, cntr dec cntrq jge .bpp_loop POP dstq - emms RET -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
