Commit 5c6d7ebb17 for ffmpeg
commit 5c6d7ebb17ef5901778753dd598d47ae57361c7d
Author: Niklas Haas <git@haasn.dev>
Date: Tue Nov 3 21:59:20 2026 +0100
swscale/x86/ops: add PRIV_SIZE to kernel setup
See previous commit. I went with an extra define here not just for
aesthetics, but also because it avoids interfering with the multiple
variants of CONTINUE and LOAD_CONT; all of which need this information.
Signed-off-by: Niklas Haas <git@haasn.dev>
diff --git a/libswscale/x86/ops_float.asm b/libswscale/x86/ops_float.asm
index 54facff8aa..75ba4a14dc 100644
--- a/libswscale/x86/ops_float.asm
+++ b/libswscale/x86/ops_float.asm
@@ -91,6 +91,7 @@ IF W, %1 mw2, m11, m12
%xdefine fltsize tmp1q
assert_idn FILTER_TYPE, SWS_PIXEL_F32
+%assign PRIV_SIZE 2 * gprsize
%assign SIZEOF_WEIGHT 4
mov weights, [implq + SwsOpImpl.priv] ; float *weights
@@ -209,6 +210,7 @@ IF X, add in0q, FILTER_SIZE
%xdefine FILTER_H_PX FILTER_H_ %+ TYPE
assert_idn FILTER_TYPE, SWS_PIXEL_F32
+%assign PRIV_SIZE 2 * gprsize
%ifidn TYPE, SWS_PIXEL_F32
%assign SIZEOF_WEIGHT 4 ; F32
%else
@@ -415,6 +417,7 @@ IF W, vcvtdq2ps mw%2, mw%2
%xdefine ILOAD_PX ILOAD_ %+ TYPE
assert_idn FILTER_TYPE, SWS_PIXEL_F32
+%assign PRIV_SIZE 2 * gprsize
%ifidn TYPE, SWS_PIXEL_F32
%assign SIZEOF_WEIGHT 4 ; F32
%else
@@ -467,6 +470,7 @@ IF W, mulps mw2, m10
; Arithmetic operations
%macro SCALE 0
+%assign PRIV_SIZE BYTES
vbroadcastss m8, [implq + SwsOpImpl.priv]
LOAD_CONT tmp0q
IF X, mulps mx, m8
@@ -481,6 +485,7 @@ IF W, mulps mw2, m8
%endmacro
%macro ADD 0
+%assign PRIV_SIZE 4 * BYTES
IF X, vbroadcastss m8, [implq + SwsOpImpl.priv + 0 * BYTES]
IF Y, vbroadcastss m9, [implq + SwsOpImpl.priv + 1 * BYTES]
IF Z, vbroadcastss m10, [implq + SwsOpImpl.priv + 2 * BYTES]
@@ -498,6 +503,7 @@ IF W, addps mw2, m11
%endmacro
%macro MIN 0
+%assign PRIV_SIZE 4 * BYTES
IF X, vbroadcastss m8, [implq + SwsOpImpl.priv + 0 * BYTES]
IF Y, vbroadcastss m9, [implq + SwsOpImpl.priv + 1 * BYTES]
IF Z, vbroadcastss m10, [implq + SwsOpImpl.priv + 2 * BYTES]
@@ -515,6 +521,7 @@ IF W, minps mw2, m11
%endmacro
%macro MAX 0
+%assign PRIV_SIZE 4 * BYTES
IF X, vbroadcastss m8, [implq + SwsOpImpl.priv + 0 * BYTES]
IF Y, vbroadcastss m9, [implq + SwsOpImpl.priv + 1 * BYTES]
IF Z, vbroadcastss m10, [implq + SwsOpImpl.priv + 2 * BYTES]
@@ -576,6 +583,7 @@ IF NEED(3), linear_muladdps %1, mw%4, LOAD(3), m15, FMA(3)
%endmacro
%macro LINEAR_FMA 3
+%assign PRIV_SIZE gprsize
%assign ONE_MASK %1
%assign ZERO_MASK %2
%assign EXACT_MASK %3
@@ -621,6 +629,7 @@ IF W, mova mw2, m11
%endmacro
%macro DITHER 5 ; x_off, y_off, z_off, w_off, size_log2
+%assign PRIV_SIZE gprsize
%assign SIZE_LOG2 %5
%assign SIZE (1 << SIZE_LOG2)
%assign STRIDE (SIZE * BYTES)
diff --git a/libswscale/x86/ops_include.asm b/libswscale/x86/ops_include.asm
index ab103b8f67..dfe24f85bd 100644
--- a/libswscale/x86/ops_include.asm
+++ b/libswscale/x86/ops_include.asm
@@ -182,6 +182,10 @@ endstruc
%endif
%assign BITS (BYTES * 8)
+ ; Initialize the size of this kernel's private data. This will be
+ ; overridden by the kernel itself on demand.
+ %assign PRIV_SIZE 0
+
; Calculate block size helpers
%ifdef V2
%assign BLOCK_SIZE (mmsize * (1 + V2))
@@ -215,6 +219,7 @@ endstruc
%undef COMPS
%undef BYTES
%undef BITS
+ %undef PRIV_SIZE
%undef BLOCK_SIZE
%undef BLOCK_WIDTH
%undef ADD_MUL
diff --git a/libswscale/x86/ops_int.asm b/libswscale/x86/ops_int.asm
index 20b34dc739..e3062173bc 100644
--- a/libswscale/x86/ops_int.asm
+++ b/libswscale/x86/ops_int.asm
@@ -598,6 +598,7 @@ IF V2, mova %3, %2
%endmacro
%macro CLEAR 2
+%assign PRIV_SIZE 4 * 4
%assign ONE_MASK %1
%assign ZERO_MASK %2
IF1 X, clear 0, mx, mx2
@@ -734,6 +735,12 @@ IF W, packuswb %4, m11
%endmacro
%macro SCALE 0
+%if BITS == 8
+ %assign PRIV_SIZE 4 ; packed as dword
+%else
+ %assign PRIV_SIZE BYTES
+%endif
+
LOAD_CONT tmp0q
%if BITS == 8
%if cpuflag(avx2)
@@ -870,6 +877,7 @@ IF W, mova IN3, m11
%endmacro
%macro LINEAR 2
+%assign PRIV_SIZE gprsize
%assign ONE_MASK %1
%assign ZERO_MASK %2