PR #24130 opened by mkver URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24130 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24130.patch
>From 7c022f9626ae7071bc251d123b4eae7fd92bc98c Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 15:15:01 +0200 Subject: [PATCH 01/14] avcodec/x86/{h264_chromamc,rv40dsp}: Don't use PAVGB macro It always just expands to pavgb as there are no pure mmx functions here. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/x86/h264_chromamc.asm | 4 ++-- libavcodec/x86/rv40dsp.asm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/x86/h264_chromamc.asm b/libavcodec/x86/h264_chromamc.asm index 32564058ba..705da95feb 100644 --- a/libavcodec/x86/h264_chromamc.asm +++ b/libavcodec/x86/h264_chromamc.asm @@ -117,11 +117,11 @@ cglobal %1_%2_chroma_mc2, 6, 7, 0 %macro NOTHING 2-3 %endmacro %macro DIRECT_AVG 2 - PAVGB %1, %2 + pavgb %1, %2 %endmacro %macro COPY_AVG 3 movd %2, %3 - PAVGB %1, %2 + pavgb %1, %2 %endmacro diff --git a/libavcodec/x86/rv40dsp.asm b/libavcodec/x86/rv40dsp.asm index 07c119636a..53ad221c40 100644 --- a/libavcodec/x86/rv40dsp.asm +++ b/libavcodec/x86/rv40dsp.asm @@ -97,7 +97,7 @@ SECTION .text %endif packuswb %1, %1 %ifidn %3, avg - PAVGB %1, %2 + pavgb %1, %2 %endif movh [dstq], %1 %endmacro -- 2.52.0 >From 456596b17dcdcc9e0760fd45206421f8bb67658f Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 15:20:40 +0200 Subject: [PATCH 02/14] avutil/x86/x86util: Remove PAVGB macro It is no longer used anywhere and it would make no sense to ever use it again. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavutil/x86/x86util.asm | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 6632155c99..5b63413dd8 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -501,22 +501,6 @@ %endif %endmacro -%macro PAVGB 2-4 -%if cpuflag(mmxext) - pavgb %1, %2 -%elif cpuflag(3dnow) - pavgusb %1, %2 -%elif cpuflag(mmx) - movu %3, %2 - por %3, %1 - pxor %1, %2 - pand %1, %4 - psrlq %1, 1 - psubb %3, %1 - SWAP %1, %3 -%endif -%endmacro - %macro PSHUFLW 1+ %if mmsize == 8 pshufw %1 -- 2.52.0 >From ef5b428c519824baa6f2a7a1ff615866093ea97f Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 15:23:50 +0200 Subject: [PATCH 03/14] avutil/x86/x86util: Remove unused PSWAPD Unused since ec735579814b6b73e17da601ff011a918c49e40f. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavutil/x86/x86util.asm | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 5b63413dd8..95dbfdb88a 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -509,18 +509,6 @@ %endif %endmacro -%macro PSWAPD 2 -%if cpuflag(mmxext) - pshufw %1, %2, q1032 -%elif cpuflag(3dnowext) - pswapd %1, %2 -%elif cpuflag(3dnow) - movq %1, %2 - psrlq %1, 32 - punpckldq %1, %2 -%endif -%endmacro - %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from %ifnum %5 pand m%3, m%5, m%4 ; src .. y6 .. y4 -- 2.52.0 >From 150146ee3df23f075da2295809218068fda17517 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 15:30:42 +0200 Subject: [PATCH 04/14] avutil/x86/x86util: Remove ABSB{,2} macros Seem to have always been unused. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavutil/x86/x86util.asm | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 95dbfdb88a..c0fd07c69e 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -361,30 +361,6 @@ %endif %endmacro -%macro ABSB 2 ; source mmreg, temp mmreg (unused for SSSE3) -%if cpuflag(ssse3) - pabsb %1, %1 -%else - pxor %2, %2 - psubb %2, %1 - pminub %1, %2 -%endif -%endmacro - -%macro ABSB2 4 ; src1, src2, tmp1, tmp2 (tmp1/2 unused for SSSE3) -%if cpuflag(ssse3) - pabsb %1, %1 - pabsb %2, %2 -%else - pxor %3, %3 - pxor %4, %4 - psubb %3, %1 - psubb %4, %2 - pminub %1, %3 - pminub %2, %4 -%endif -%endmacro - %macro ABSD2 4 pxor %3, %3 pxor %4, %4 -- 2.52.0 >From 942961be61287cb2066dc28c56782ed91657b997 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 15:35:08 +0200 Subject: [PATCH 05/14] avutil/x86/x86util: Remove ABSD2 macro Always unused, new code can just use SSSE3 pabsd directly. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavutil/x86/x86util.asm | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index c0fd07c69e..3b09cc8207 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -361,17 +361,6 @@ %endif %endmacro -%macro ABSD2 4 - pxor %3, %3 - pxor %4, %4 - pcmpgtd %3, %1 - pcmpgtd %4, %2 - pxor %1, %3 - pxor %2, %4 - psubd %1, %3 - psubd %2, %4 -%endmacro - %macro ABS4 6 ABS2 %1, %2, %5, %6 ABS2 %3, %4, %5, %6 -- 2.52.0 >From 20b5ea76021d338861e0aa8e7e8ca077033172ad Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 15:41:45 +0200 Subject: [PATCH 06/14] swscale/x86/rgb_2_rgb: Remove useless macro x86inc's VEX emulation can handle this just fine. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libswscale/x86/rgb_2_rgb.asm | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm index 120cc95c4a..a9de16116d 100644 --- a/libswscale/x86/rgb_2_rgb.asm +++ b/libswscale/x86/rgb_2_rgb.asm @@ -57,16 +57,6 @@ shuf_packus_avx2: db 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0,\ SECTION .text -%macro RSHIFT_COPY 3 -; %1 dst ; %2 src ; %3 shift -%if cpuflag(avx) || cpuflag(avx2) || cpuflag(avx512icl) - psrldq %1, %2, %3 -%else - mova %1, %2 - RSHIFT %1, %3 -%endif -%endmacro - ;------------------------------------------------------------------------------ ; shuffle_bytes_## (const uint8_t *src, uint8_t *dst, int src_size) ;------------------------------------------------------------------------------ @@ -315,10 +305,10 @@ cglobal uyvytoyuv422, 9, 14, 8 + cpuflag(avx2) + cpuflag(avx512icl), ydst, udst, movu [ydstq + wq + mmsize], m7 %else ; extract y part 1 - RSHIFT_COPY m6, m2, 1 ; UYVY UYVY -> YVYU YVY... + psrldq m6, m2, 1 ; UYVY UYVY -> YVYU YVY... pand m6, m1 ; YxYx YxYx... - RSHIFT_COPY m7, m3, 1 ; UYVY UYVY -> YVYU YVY... + psrldq m7, m3, 1 ; UYVY UYVY -> YVYU YVY... pand m7, m1 ; YxYx YxYx... packuswb m6, m7 ; YYYY YYYY... @@ -328,10 +318,10 @@ cglobal uyvytoyuv422, 9, 14, 8 + cpuflag(avx2) + cpuflag(avx512icl), ydst, udst, movu [ydstq + wq], m6 ; extract y part 2 - RSHIFT_COPY m6, m4, 1 ; UYVY UYVY -> YVYU YVY... + psrldq m6, m4, 1 ; UYVY UYVY -> YVYU YVY... pand m6, m1 ; YxYx YxYx... - RSHIFT_COPY m7, m5, 1 ; UYVY UYVY -> YVYU YVY... + psrldq m7, m5, 1 ; UYVY UYVY -> YVYU YVY... pand m7, m1 ; YxYx YxYx... packuswb m6, m7 ; YYYY YYYY... -- 2.52.0 >From f5625f2f505f40d7a77f2ed374ba0b6805241c03 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 15:52:04 +0200 Subject: [PATCH 07/14] av*/x86/yadif,lossless-videodsp: Don't use LSHIFT, RSHIFT macros There is no mmx code in these files. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/x86/lossless_videodsp.asm | 16 ++++++++-------- libavfilter/x86/vf_yadif.asm | 6 +++--- libavfilter/x86/yadif-10.asm | 8 ++++---- libavfilter/x86/yadif-16.asm | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libavcodec/x86/lossless_videodsp.asm b/libavcodec/x86/lossless_videodsp.asm index 5815c8e5ae..bcfb55b3a7 100644 --- a/libavcodec/x86/lossless_videodsp.asm +++ b/libavcodec/x86/lossless_videodsp.asm @@ -46,7 +46,7 @@ cglobal add_median_pred, 6,6,8, dst, top, diff, w, left, left_top movu m0, [topq] mova m2, m0 movd m4, [left_topq] - LSHIFT m2, 1 + pslldq m2, 1 mova m1, m0 por m4, m2 movd m3, [leftq] @@ -59,7 +59,7 @@ cglobal add_median_pred, 6,6,8, dst, top, diff, w, left, left_top .loop: movu m4, [topq+wq] mova m0, m4 - LSHIFT m4, 1 + pslldq m4, 1 por m4, m1 mova m1, m0 ; t psubb m0, m4 ; t-tl @@ -77,17 +77,17 @@ cglobal add_median_pred, 6,6,8, dst, top, diff, w, left, left_top paddb m3, m2 ; +residual %if i==0 mova m7, m3 - LSHIFT m7, mmsize-1 + pslldq m7, mmsize-1 %else mova m6, m3 - RSHIFT m7, 1 - LSHIFT m6, mmsize-1 + psrldq m7, 1 + pslldq m6, mmsize-1 por m7, m6 %endif %if i<mmsize-1 - RSHIFT m0, 1 - RSHIFT m1, 1 - RSHIFT m2, 1 + psrldq m0, 1 + psrldq m1, 1 + psrldq m2, 1 %endif %assign i i+1 %endrep diff --git a/libavfilter/x86/vf_yadif.asm b/libavfilter/x86/vf_yadif.asm index 809cebdd3f..5a0ba50fa0 100644 --- a/libavfilter/x86/vf_yadif.asm +++ b/libavfilter/x86/vf_yadif.asm @@ -39,7 +39,7 @@ SECTION .text pavgb m5, m3 pand m4, [pb_1] psubusb m5, m4 - RSHIFT m5, 1 + psrldq m5, 1 punpcklbw m5, m7 mova m4, m2 psubusb m2, m3 @@ -47,8 +47,8 @@ SECTION .text pmaxub m2, m3 mova m3, m2 mova m4, m2 - RSHIFT m3, 1 - RSHIFT m4, 2 + psrldq m3, 1 + psrldq m4, 2 punpcklbw m2, m7 punpcklbw m3, m7 punpcklbw m4, m7 diff --git a/libavfilter/x86/yadif-10.asm b/libavfilter/x86/yadif-10.asm index c6952db64b..3a6b3ef759 100644 --- a/libavfilter/x86/yadif-10.asm +++ b/libavfilter/x86/yadif-10.asm @@ -48,15 +48,15 @@ SECTION .text pavgw m5, m3 pand m4, [pw_1] psubusw m5, m4 - RSHIFT m5, 2 + psrldq m5, 2 mova m4, m2 psubusw m2, m3 psubusw m3, m4 PMAXUW m2, m3 mova m3, m2 mova m4, m2 - RSHIFT m3, 2 - RSHIFT m4, 4 + psrldq m3, 2 + psrldq m4, 4 paddw m2, m3 paddw m2, m4 %endmacro @@ -153,7 +153,7 @@ SECTION .text psubusw m3, m4 PMAXUW m2, m3 mova m3, m2 - RSHIFT m3, 4 + psrldq m3, 4 paddw m0, m2 paddw m0, m3 psubw m0, [pw_1] diff --git a/libavfilter/x86/yadif-16.asm b/libavfilter/x86/yadif-16.asm index 09cc543d7e..a161164a0d 100644 --- a/libavfilter/x86/yadif-16.asm +++ b/libavfilter/x86/yadif-16.asm @@ -72,7 +72,7 @@ SECTION .text pavgw m5, m3 pand m4, [pw_1] psubusw m5, m4 - RSHIFT m5, 2 + psrldq m5, 2 punpcklwd m5, m7 mova m4, m2 psubusw m2, m3 @@ -80,8 +80,8 @@ SECTION .text PMAXUW m2, m3 mova m3, m2 mova m4, m2 - RSHIFT m3, 2 - RSHIFT m4, 4 + psrldq m3, 2 + psrldq m4, 4 punpcklwd m2, m7 punpcklwd m3, m7 punpcklwd m4, m7 @@ -186,7 +186,7 @@ SECTION .text psubusw m3, m4 PMAXUW m2, m3 mova m3, m2 - RSHIFT m3, 4 + psrldq m3, 4 punpcklwd m2, m7 punpcklwd m3, m7 paddd m0, m2 -- 2.52.0 >From 9f540d745f0f7e9f9cc1b373cd7a521aeaf492d4 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 15:57:48 +0200 Subject: [PATCH 08/14] avutil/x86/x86util: Remove unused LSHIFT, RSHIFT macros Useless in the absence of mmx. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavutil/x86/x86util.asm | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 3b09cc8207..929edbb457 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -872,22 +872,6 @@ %endif %endmacro -%macro LSHIFT 2 -%if mmsize > 8 - pslldq %1, %2 -%else - psllq %1, 8*(%2) -%endif -%endmacro - -%macro RSHIFT 2 -%if mmsize > 8 - psrldq %1, %2 -%else - psrlq %1, 8*(%2) -%endif -%endmacro - %macro MOVHL 2 ; dst, src %ifidn %1, %2 punpckhqdq %1, %2 -- 2.52.0 >From d074b3dd0e5dc6a57171ea7a1964dd7b926bdff4 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 16:02:59 +0200 Subject: [PATCH 09/14] avcodec/x86/ac3dsp: Avoid using PMINUB macro Forgotten in fd98594a8831ce037a495b6d7e090bd8f81e83a1. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/x86/ac3dsp.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm index 21f59708b7..5b16af99c5 100644 --- a/libavcodec/x86/ac3dsp.asm +++ b/libavcodec/x86/ac3dsp.asm @@ -42,7 +42,7 @@ SECTION .text ;----------------------------------------------------------------------------- %macro AC3_EXPONENT_MIN 0 -cglobal ac3_exponent_min, 3, 4, 2, exp, reuse_blks, expn, offset +cglobal ac3_exponent_min, 3, 4, 1, exp, reuse_blks, expn, offset shl reuse_blksd, 8 jz .end LOOP_ALIGN @@ -52,7 +52,7 @@ cglobal ac3_exponent_min, 3, 4, 2, exp, reuse_blks, expn, offset sub offsetq, 256 LOOP_ALIGN .nextblk: - PMINUB m0, [expq+offsetq], m1 + pminub m0, [expq+offsetq] sub offsetq, 256 jae .nextblk mova [expq], m0 -- 2.52.0 >From 566e8550b1b28833297b6c8b213f920c349b1021 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 16:05:19 +0200 Subject: [PATCH 10/14] avutil/x86/x86util: Remove unused PMINUB macro Useless in the absence of mmx. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavutil/x86/x86util.asm | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 929edbb457..75d2fee3d2 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -685,16 +685,6 @@ movh [%7+%8], %4 %endmacro -%macro PMINUB 3 ; dst, src, ignored -%if cpuflag(mmxext) - pminub %1, %2 -%else ; dst, src, tmp - mova %3, %1 - psubusb %3, %2 - psubb %1, %3 -%endif -%endmacro - %macro SPLATW 2-3 0 %if cpuflag(avx2) && %3 == 0 vpbroadcastw %1, %2 -- 2.52.0 >From 1db6cede16444b01ba70d95940fe3da8e35a56fa Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 16:12:24 +0200 Subject: [PATCH 11/14] av*/x86/resample,h264_intrapred: Avoid using PSHUFLW It is useless in the absence of mmx. Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/x86/h264_intrapred.asm | 8 ++++---- libswresample/x86/resample.asm | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm index d01d4b5386..798900f9b2 100644 --- a/libavcodec/x86/h264_intrapred.asm +++ b/libavcodec/x86/h264_intrapred.asm @@ -259,9 +259,9 @@ cglobal pred16x16_plane_%1_8, 2,9,5 %endif movhlps m1, m0 paddw m0, m1 - PSHUFLW m1, m0, q0032 + pshuflw m1, m0, q0032 paddw m0, m1 - PSHUFLW m1, m0, q0001 + pshuflw m1, m0, q0001 paddw m0, m1 ; sum of H coefficients lea r4, [r0+r2*8-1] @@ -467,11 +467,11 @@ cglobal pred8x8_plane_8, 2,9,5 paddw m0, m1 %if notcpuflag(ssse3) - PSHUFLW m1, m0, q0032 + pshuflw m1, m0, q0032 paddw m0, m1 %endif ; !ssse3 - PSHUFLW m1, m0, q0001 + pshuflw m1, m0, q0001 paddw m0, m1 ; sum of H coefficients lea r4, [r0+r2*4-1] diff --git a/libswresample/x86/resample.asm b/libswresample/x86/resample.asm index e155f171d1..d6501e1373 100644 --- a/libswresample/x86/resample.asm +++ b/libswresample/x86/resample.asm @@ -461,8 +461,8 @@ cglobal resample_linear_%1, 1, 7, 5, ctx, min_filter_length_x4, filter2, \ paddd m0, m1 %endif %if notcpuflag(xop) - PSHUFLW m3, m2, q0032 - PSHUFLW m1, m0, q0032 + pshuflw m3, m2, q0032 + pshuflw m1, m0, q0032 paddd m2, m3 paddd m0, m1 %endif -- 2.52.0 >From 2d66d07d88c69f398f5e6943aa80a10165621748 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 16:18:02 +0200 Subject: [PATCH 12/14] avutil/x86/x86util: Remove PSHUFLW macro Useless in the absence of mmx(ext). Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavutil/x86/x86util.asm | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 75d2fee3d2..775c5275c9 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -403,12 +403,7 @@ paddd %1, %2 %endif %if notcpuflag(xop) || sizeof%1 != 16 -%if cpuflag(mmxext) - PSHUFLW %2, %1, q0032 -%else ; mmx - mova %2, %1 - psrlq %2, 32 -%endif + pshuflw %2, %1, q0032 paddd %1, %2 %endif %undef %1 @@ -466,14 +461,6 @@ %endif %endmacro -%macro PSHUFLW 1+ - %if mmsize == 8 - pshufw %1 - %else - pshuflw %1 - %endif -%endmacro - %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from %ifnum %5 pand m%3, m%5, m%4 ; src .. y6 .. y4 -- 2.52.0 >From 433b4f8672df3011662306f1704a858ffd19610c Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 16:49:47 +0200 Subject: [PATCH 13/14] avutil/x86/x86util: Move broken PSIGNW macro to its only user The non-SSSE3 version does not do what psignw does: If the second operand is zero, the first is unchanged. In any case, the end result is '(%1 and not %2)-(%2 and not %1)'. So it only works in case %2 is -1, which is how vp9itxfm.asm actually uses it. So move it there and rename it to NEGATE. See also f2fd167835b6f039a593e46ab3a84e1b9a453660 for an instance when this macro actually caused problems. (Would pxor %2,%2 psubw %2,%1 SWAP %1,%2 not actually be better?) Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/x86/vp9itxfm.asm | 39 +++++++++++++++++++++++-------------- libavutil/x86/x86util.asm | 9 --------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/libavcodec/x86/vp9itxfm.asm b/libavcodec/x86/vp9itxfm.asm index bd5966646c..71e462c0bc 100644 --- a/libavcodec/x86/vp9itxfm.asm +++ b/libavcodec/x86/vp9itxfm.asm @@ -102,6 +102,15 @@ cextern pd_8192 SECTION .text +%macro NEGATE 2 ; dst/src, pw_m1 +%if cpuflag(ssse3) + psignw %1, %2 +%else + pxor %1, %2 + psubw %1, %2 +%endif +%endmacro + %macro VP9_UNPACK_MULSUB_2D_4X 6 ; dst1 [src1], dst2 [src2], dst3, dst4, mul1, mul2 punpckhwd m%4, m%2, m%1 punpcklwd m%2, m%1 @@ -735,7 +744,7 @@ VP9_IDCT_IDCT_8x8_ADD_XMM ssse3, 13 SCRATCH 1, 12, blockq+ 0*16 VP9_RND_SH_SUMSUB_BA 5, 7, 4, 3, 1, D_8192_REG UNSCRATCH 1, 12, blockq+ 0*16 - PSIGNW m5, W_M1_REG ; m5=out1[w], m7=t6[w] + NEGATE m5, W_M1_REG ; m5=out1[w], m7=t6[w] VP9_RND_SH_SUMSUB_BA 2, 0, 6, 1, 3, D_8192_REG ; m2=out6[w], m0=t7[w] UNSCRATCH 1, 8, blockq+16*1 @@ -746,7 +755,7 @@ VP9_IDCT_IDCT_8x8_ADD_XMM ssse3, 13 SUMSUB_BA w, 6, 4, 2 ; m6=out0[w], m4=t2[w] SUMSUB_BA w, 1, 3, 2 - PSIGNW m1, W_M1_REG ; m1=out7[w], m3=t3[w] + NEGATE m1, W_M1_REG ; m1=out7[w], m3=t3[w] ; m6=out0, m5=out1, m4=t2, m3=t3, m7=t6, m0=t7, m2=out6, m1=out7 @@ -764,8 +773,8 @@ VP9_IDCT_IDCT_8x8_ADD_XMM ssse3, 13 VP9_UNPACK_MULSUB_2W_4X 7, 0, 11585, 11585, D_8192_REG, 2, 5 UNSCRATCH 5, 9, blockq+16*1 %endif - PSIGNW m3, W_M1_REG ; out3 - PSIGNW m7, W_M1_REG ; out5 + NEGATE m3, W_M1_REG ; out3 + NEGATE m7, W_M1_REG ; out5 ; m6=out0, m5=out1, m0=out2, m3=out3, m4=out4, m7=out5, m2=out6, m1=out7 @@ -1593,7 +1602,7 @@ VP9_IDCT_IDCT_16x16_ADD_XMM ssse3 UNSCRATCH 7, 15, tmpq+12*%%str SUMSUB_BA w, 3, 7, 1 - PSIGNW m3, [pw_m1] ; m3=out1[w], m7=t10[w] + NEGATE m3, [pw_m1] ; m3=out1[w], m7=t10[w] SUMSUB_BA w, 2, 6, 1 ; m2=out14[w], m6=t11[w] ; unfortunately, the code below overflows in some cases, e.g. @@ -1619,7 +1628,7 @@ VP9_IDCT_IDCT_16x16_ADD_XMM ssse3 VP9_RND_SH_SUMSUB_BA 5, 6, 1, 3, 0, [pd_8192] ; m5=out2[w], m6=t14[w] UNSCRATCH 0, 9, tmpq+ 2*%%str VP9_RND_SH_SUMSUB_BA 4, 7, 0, 2, 1, [pd_8192] - PSIGNW m4, [pw_m1] ; m4=out13[w], m7=t15[w] + NEGATE m4, [pw_m1] ; m4=out13[w], m7=t15[w] ; unfortunately, the code below overflows in some cases %if 0; cpuflag(ssse3) @@ -1627,7 +1636,7 @@ VP9_IDCT_IDCT_16x16_ADD_XMM ssse3 pmulhrsw m7, [pw_m11585x2] ; m7=out5[w] pmulhrsw m6, [pw_11585x2] ; m6=out10[w] %else - PSIGNW m7, [pw_m1] + NEGATE m7, [pw_m1] VP9_UNPACK_MULSUB_2W_4X 7, 6, 11585, 11585, [pd_8192], 1, 0 %endif @@ -1663,7 +1672,7 @@ VP9_IDCT_IDCT_16x16_ADD_XMM ssse3 SCRATCH 6, 10, tmpq+ 0*%%str VP9_RND_SH_SUMSUB_BA 0, 3, 1, 5, 6, [pd_8192] UNSCRATCH 6, 10, tmpq+ 0*%%str - PSIGNW m0, [pw_m1] ; m0=out3[w], m3=t6[w] + NEGATE m0, [pw_m1] ; m0=out3[w], m3=t6[w] VP9_RND_SH_SUMSUB_BA 4, 2, 6, 7, 5, [pd_8192] ; m9=out12[w], m2=t7[w] UNSCRATCH 1, 8, tmpq+10*%%str @@ -1674,7 +1683,7 @@ VP9_IDCT_IDCT_16x16_ADD_XMM ssse3 SUMSUB_BA w, 1, 6, 4 ; m13=out0[w], m1=t2[w] SUMSUB_BA w, 5, 7, 4 - PSIGNW m5, [pw_m1] ; m12=out15[w], m8=t3[w] + NEGATE m5, [pw_m1] ; m12=out15[w], m8=t3[w] ; unfortunately, the code below overflows in some cases, e.g. ; http://downloads.webmproject.org/test_data/libvpx/vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm @@ -1928,12 +1937,12 @@ IADST16_FN iadst, IADST16, iadst, IADST16, ssse3 VP9_UNPACK_MULSUB_2D_4X 2, 13, 1, 6, 6270, 15137 ; m2/x=t14[d], m13/x=t15[d] VP9_RND_SH_SUMSUB_BA 2, 0, 1, 12, 14, [pd_8192] ; m2=out2[w], m0=t14a[w] VP9_RND_SH_SUMSUB_BA 13, 15, 6, 9, 14, [pd_8192] - PSIGNW m13, [pw_m1] ; m13=out13[w], m15=t15a[w] + NEGATE m13, [pw_m1] ; m13=out13[w], m15=t15a[w] VP9_UNPACK_MULSUB_2D_4X 8, 7, 12, 9, 15137, 6270 ; m8/x=t5[d], m7/x=t4[d] VP9_UNPACK_MULSUB_2D_4X 5, 10, 1, 6, 6270, 15137 ; m5/x=t6[d], m10/x=t7[d] VP9_RND_SH_SUMSUB_BA 5, 7, 1, 9, 14, [pd_8192] - PSIGNW m5, [pw_m1] ; m5=out3[w], m7=t6[w] + NEGATE m5, [pw_m1] ; m5=out3[w], m7=t6[w] VP9_RND_SH_SUMSUB_BA 10, 8, 6, 12, 14, [pd_8192] ; m10=out12[w], m8=t7[w] mova m1, [blockq+ 0] @@ -1946,19 +1955,19 @@ IADST16_FN iadst, IADST16, iadst, IADST16, ssse3 SUMSUB_BA w, 14, 12, 5 ; m14=out0, m12=t2a SUMSUB_BA w, 1, 3, 5 - PSIGNW m1, [pw_m1] ; m1=out15, m3=t3a + NEGATE m1, [pw_m1] ; m1=out15, m3=t3a SUMSUB_BA w, 9, 11, 5 - PSIGNW m9, [pw_m1] ; m9=out1, m11=t10 + NEGATE m9, [pw_m1] ; m9=out1, m11=t10 SUMSUB_BA w, 6, 4, 5 ; m6=out14, m4=t11 VP9_UNPACK_MULSUB_2W_4X 4, 11, 11585, 11585, [pd_8192], 5, 10 ; m4=out9, m11=out6 mova m5, [blockq+128] mova [blockq+192], m11 - PSIGNW m15, [pw_m1] + NEGATE m15, [pw_m1] VP9_UNPACK_MULSUB_2W_4X 15, 0, 11585, 11585, [pd_8192], 10, 11 ; m15=out5, m0=out10 - PSIGNW m3, [pw_m1] + NEGATE m3, [pw_m1] VP9_UNPACK_MULSUB_2W_4X 3, 12, 11585, 11585, [pd_8192], 10, 11 ; m3=out7,m12=out8 VP9_UNPACK_MULSUB_2W_4X 8, 7, 11585, 11585, [pd_8192], 10, 11 ; m8=out11,m7=out4 diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm index 775c5275c9..2365a1e65c 100644 --- a/libavutil/x86/x86util.asm +++ b/libavutil/x86/x86util.asm @@ -314,15 +314,6 @@ %endif %endmacro -%macro PSIGNW 2 -%if cpuflag(ssse3) - psignw %1, %2 -%else - pxor %1, %2 - psubw %1, %2 -%endif -%endmacro - %macro ABS1 2 %if cpuflag(ssse3) pabsw %1, %1 -- 2.52.0 >From 2bcca25a90e97b5cfe054d0f4c10e15f5fd39b5e Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <[email protected]> Date: Thu, 13 Aug 2026 17:49:50 +0200 Subject: [PATCH 14/14] avcodec/x86/vp9itxfm: Avoid load Signed-off-by: Andreas Rheinhardt <[email protected]> --- libavcodec/x86/vp9itxfm.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/vp9itxfm.asm b/libavcodec/x86/vp9itxfm.asm index 71e462c0bc..6d120a1be4 100644 --- a/libavcodec/x86/vp9itxfm.asm +++ b/libavcodec/x86/vp9itxfm.asm @@ -822,7 +822,7 @@ cglobal vp9_%1_%3_8x8_add, 3, 3, %6, dst, stride, block, eob mova m15, [pw_11585x2] ; often used %endif mova m13, [pd_8192] ; rounding - mova m14, [pw_m1] + pcmpeqw m14, m14 ; pw_m1 %define W_11585x2_REG m15 %define D_8192_REG m13 %define W_M1_REG m14 -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
