Commit 29c91f3abf for ffmpeg
commit 29c91f3abffc2e2434db900ee38e551c441fee56
Author: Zuxy Meng <zuxy.meng@gmail.com>
Date: Mon Nov 2 20:04:28 2026 -0800
avcodec/x86/vp9: convert DC predictors MMX to XMM
Convert the 4x4 and 8x8 DC, DC-top and DC-left predictors from
MMX to XMM registers, keeping the SSSE3 instructions and the
_ssse3 symbol names.
Benchmarks (checkasm, Zen 4, pinned, median of 3, cycles):
the converted functions measure 0.5-1.7 cycles, unchanged
within noise (dc_4x4_ssse3 0.8 -> 1.0, dc_8x8_ssse3 1.8 ->
1.7, dc_top/left_4x4/8x8 likewise). An untouched control,
dc_left/top_32x32_ssse3, moved 1.3-1.5x between the same runs,
so the noise floor exceeds any signal at this size.
checkasm --test=vp9dsp passes (1272/1272).
Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
diff --git a/libavcodec/x86/vp9intrapred.asm b/libavcodec/x86/vp9intrapred.asm
index 22390ca831..4f1ee85c98 100644
--- a/libavcodec/x86/vp9intrapred.asm
+++ b/libavcodec/x86/vp9intrapred.asm
@@ -93,10 +93,11 @@ SECTION .text
; dc_NxN(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, const uint8_t *a)
-INIT_MMX ssse3
-cglobal vp9_ipred_dc_4x4, 4, 4, 0, dst, stride, l, a
+INIT_XMM ssse3
+cglobal vp9_ipred_dc_4x4, 4, 4, 2, dst, stride, l, a
movd m0, [lq]
- punpckldq m0, [aq]
+ movq m1, [aq]
+ punpckldq m0, m1
pxor m1, m1
psadbw m0, m1
pmulhrsw m0, [pw_4096]
@@ -108,7 +109,7 @@ cglobal vp9_ipred_dc_4x4, 4, 4, 0, dst, stride, l, a
movd [dstq+strideq*1], m0
RET
-cglobal vp9_ipred_dc_8x8, 4, 4, 0, dst, stride, l, a
+cglobal vp9_ipred_dc_8x8, 4, 4, 3, dst, stride, l, a
movq m0, [lq]
movq m1, [aq]
DEFINE_ARGS dst, stride, stride3
@@ -215,7 +216,7 @@ DC_16to32_FUNCS
; dc_top/left_NxN(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, const uint8_t *a)
%macro DC_1D_4to8_FUNCS 2 ; dir (top or left), arg (a or l)
-cglobal vp9_ipred_dc_%1_4x4, 4, 4, 0, dst, stride, l, a
+cglobal vp9_ipred_dc_%1_4x4, 4, 4, 2, dst, stride, l, a
movd m0, [%2q]
pxor m1, m1
psadbw m0, m1
@@ -228,7 +229,7 @@ cglobal vp9_ipred_dc_%1_4x4, 4, 4, 0, dst, stride, l, a
movd [dstq+strideq*1], m0
RET
-cglobal vp9_ipred_dc_%1_8x8, 4, 4, 0, dst, stride, l, a
+cglobal vp9_ipred_dc_%1_8x8, 4, 4, 2, dst, stride, l, a
movq m0, [%2q]
DEFINE_ARGS dst, stride, stride3
lea stride3q, [strideq*3]
@@ -248,7 +249,7 @@ cglobal vp9_ipred_dc_%1_8x8, 4, 4, 0, dst, stride, l, a
RET
%endmacro
-INIT_MMX ssse3
+INIT_XMM ssse3
DC_1D_4to8_FUNCS top, a
DC_1D_4to8_FUNCS left, l