Commit 0ff97245ad for ffmpeg
commit 0ff97245ad4563ea3669e6e7fb6e6f75263ee3b1
Author: Jun Zhao <barryjzhao@tencent.com>
Date: Fri Nov 20 20:23:26 2026 +0800
tests/checkasm/vvc_alf: size ALF classify index buffers by block count
class_idx and transpose_idx hold one int per 4x4 ALF block. For the largest
case (128x128) that is 1024 ints, and the decoder allocates exactly
ALF_MAX_BLOCKS_IN_CTU ints for the same array (libavcodec/vvc/filter.c).
The checkasm buffers were instead dimensioned with SRC_BUF_SIZE, which is
a byte count for the uint8_t pixel buffers (38592). Used as an int element
count, that made each of the four arrays 154368 bytes instead of 4096.
Only id_size bytes were ever compared, so the 37.7x over-allocation went
unnoticed and pushed check_alf_classify's stack frame to 746 KiB.
Use ALF_MAX_BLOCKS_IN_CTU. The C reference writes exactly 1024 ints; the
x86 tail stores are exact-width and the aarch64 stores scalar, so no
headroom is needed. A guard-region canary on this build (all sizes, bit
depths and NEON/SME2 variants) confirms nothing is written past 1024 ints.
The frame drops to 159 KiB, still above the 120 KiB -Wstack-usage
threshold; removing the warning requires moving the buffers to the
heap, which is a separate change.
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
diff --git a/tests/checkasm/vvc_alf.c b/tests/checkasm/vvc_alf.c
index fcb9ca0bc0..b6ca2d354f 100644
--- a/tests/checkasm/vvc_alf.c
+++ b/tests/checkasm/vvc_alf.c
@@ -133,10 +133,10 @@ static void check_alf_filter(VVCDSPContext *c, const int bit_depth)
static void check_alf_classify(VVCDSPContext *c, const int bit_depth)
{
- LOCAL_ALIGNED_32(int, class_idx0, [SRC_BUF_SIZE]);
- LOCAL_ALIGNED_32(int, transpose_idx0, [SRC_BUF_SIZE]);
- LOCAL_ALIGNED_32(int, class_idx1, [SRC_BUF_SIZE]);
- LOCAL_ALIGNED_32(int, transpose_idx1, [SRC_BUF_SIZE]);
+ LOCAL_ALIGNED_32(int, class_idx0, [ALF_MAX_BLOCKS_IN_CTU]);
+ LOCAL_ALIGNED_32(int, transpose_idx0, [ALF_MAX_BLOCKS_IN_CTU]);
+ LOCAL_ALIGNED_32(int, class_idx1, [ALF_MAX_BLOCKS_IN_CTU]);
+ LOCAL_ALIGNED_32(int, transpose_idx1, [ALF_MAX_BLOCKS_IN_CTU]);
LOCAL_ALIGNED_32(uint8_t, src0, [SRC_BUF_SIZE]);
LOCAL_ALIGNED_32(uint8_t, src1, [SRC_BUF_SIZE]);
LOCAL_ALIGNED_32(int32_t, alf_gradient_tmp, [ALF_GRADIENT_SIZE * ALF_GRADIENT_SIZE * ALF_NUM_DIR]);