Commit e689cc63f0 for ffmpeg

commit e689cc63f0a5f81abb86234b0d186507fa30114c
Author: Marcos Ashton Iglesias <marcosashiglesias@gmail.com>
Date:   Thu Sep 24 19:22:55 2026 +0100

    avcodec/x86/hevc: skip zero columns in the 16x16 and 32x32 idct

    Columns at or beyond col_limit are zero, so skip their strips in the
    first pass. Most 16x16 and 32x32 calls in real streams have
    col_limit <= 8.

    checkasm --bench on a Core Ultra 7 155H, before and after:
    hevc_idct_16x16_8_sparse_sse2:     409.2   325.0 (1.26x)
    hevc_idct_16x16_8_sparse_avx:      409.4   325.3 (1.26x)
    hevc_idct_16x16_10_sparse_sse2:    410.2   327.4 (1.25x)
    hevc_idct_16x16_10_sparse_avx:     409.4   325.3 (1.26x)
    hevc_idct_32x32_8_sparse_sse2:    2212.7  1510.8 (1.46x)
    hevc_idct_32x32_8_sparse_avx:     2212.9  1513.1 (1.46x)
    hevc_idct_32x32_10_sparse_sse2:   2262.2  1498.2 (1.51x)
    hevc_idct_32x32_10_sparse_avx:    2209.8  1531.3 (1.44x)

    HEVC decode: 5% fewer instructions, 2-3% fewer cycles.

diff --git a/libavcodec/x86/hevc/idct.asm b/libavcodec/x86/hevc/idct.asm
index cfa156c705..c4cc0521ae 100644
--- a/libavcodec/x86/hevc/idct.asm
+++ b/libavcodec/x86/hevc/idct.asm
@@ -698,8 +698,13 @@ cglobal hevc_idct_transpose_16x16, 0, 0, 0
 ; void ff_hevc_idct_16x16_{8,10}_<opt>(int16_t *coeffs, int col_limit)
 ; %1 = bitdepth
 %macro IDCT_16x16 1
-cglobal hevc_idct_16x16_%1, 1, 2, 16, coeffs
-    mov r1d, 3
+cglobal hevc_idct_16x16_%1, 2, 3, 16, coeffs, col_limit
+    ; skip 4-column strips at or beyond col_limit, clamped to the block width
+    dec r1d
+    shr r1d, 2
+    mov r2d, 3
+    cmp r1d, r2d
+    cmova r1d, r2d
 .loop16:
     TR_16x4 8 * r1, 7, [pd_64], 64, 2, 32, 8, 16, 1, 0
     dec r1d
@@ -860,8 +865,13 @@ cglobal hevc_idct_transpose_32x32, 0, 0, 0
 ; void ff_hevc_idct_32x32_{8,10}_<opt>(int16_t *coeffs, int col_limit)
 ; %1 = bitdepth
 %macro IDCT_32x32 1
-cglobal hevc_idct_32x32_%1, 1, 6, 16, 256, coeffs
-    mov r1d, 7
+cglobal hevc_idct_32x32_%1, 2, 6, 16, 256, coeffs, col_limit
+    ; skip 4-column strips at or beyond col_limit, clamped to the block width
+    dec r1d
+    shr r1d, 2
+    mov r2d, 7
+    cmp r1d, r2d
+    cmova r1d, r2d
 .loop32:
     TR_32x4 8 * r1, %1, 1
     dec r1d