Commit 1a0b1d331e for ffmpeg

commit 1a0b1d331e5c0fe515e61c84842c9dfb7f881dfc
Author: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date:   Mon Nov 23 13:06:57 2026 +0100

    avcodec/x86/vc1dsp_inv_trans: Avoid shuffles in 4x4 inv transform

    Old benchmarks:
      vc1dsp.vc1_inv_trans_4x4_c:          106.5
      vc1dsp.vc1_inv_trans_4x4_sse2:        14.0 ( 7.63x)

    New benchmarks:
      vc1dsp.vc1_inv_trans_4x4_c:          106.0
      vc1dsp.vc1_inv_trans_4x4_sse2:        13.5 ( 7.84x)

    Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

diff --git a/libavcodec/x86/vc1dsp_inv_trans.asm b/libavcodec/x86/vc1dsp_inv_trans.asm
index 3827397477..be92fb0954 100644
--- a/libavcodec/x86/vc1dsp_inv_trans.asm
+++ b/libavcodec/x86/vc1dsp_inv_trans.asm
@@ -274,16 +274,14 @@ INIT_XMM sse2
 ; void ff_vc1_inv_trans_4x4_sse2(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
 cglobal vc1_inv_trans_4x4, 3, 4, 5, dest, linesize, block, linesize3
     movq        m0, [blockq+ 0]
-    movhps      m0, [blockq+16]         ; rows 0, 1
-    movq        m2, [blockq+32]
-    movhps      m2, [blockq+48]         ; rows 2, 3
-    pshuflw     m0, m0, q3120           ; x0 x2 x1 x3 per row
-    pshufhw     m0, m0, q3120
-    pshuflw     m2, m2, q3120
-    pshufhw     m2, m2, q3120
-    mova        m1, m0
-    shufps      m0, m2, q2020           ; (x0,x2) pairs, one row per lane
-    shufps      m1, m2, q3131           ; (x1,x3) pairs
+    movq        m2, [blockq+16]
+    movq        m1, [blockq+32]
+    movq        m3, [blockq+48]
+    punpcklwd   m0, m2                  ; rows 0, 1
+    punpcklwd   m1, m3                  ; rows 2, 3
+    SBUTTERFLY  dq, 0, 1, 2             ; m0: columns 0,1, m1: columns 2,3
+    SBUTTERFLY  wd, 0, 1, 2             ; m0: (x0,x2) pairs, one row per lane
+                                        ; m1: (x1,x3) pairs, one row per lane
     VC1_IDCT4_1D 0, 1, 2, 3, pd_4, 3, 4 ; column 0: m3, 1: m0, 2: m1, 3: m2
     packssdw    m3, m0                  ; columns 0 and 1, one row per word
     packssdw    m1, m2                  ; columns 2 and 3