Commit c81e35cf2b for ffmpeg
commit c81e35cf2b6ea570f3363ec3ffa7318281f5f6be
Author: Wesley Maa <wesley.maa@gmail.com>
Date: Sun Nov 8 11:16:07 2026 -0500
checkasm/vc1dsp: test inverse transforms with a large in-range DC
The random coefficients used for the adding inverse transforms are
attenuated by a factor of 4 so that implementations limited to 16-bit
intermediates still pass, which means the upper part of the range the
VC-1 spec allows is never exercised. This hid 16-bit overflows for
valid input in the aarch64, arm and riscv implementations.
In addition to the random input, run each function on a DC-only block
of either sign whose output lies just outside the 8-bit range (about
+-280). The DC is chosen per transform size so that all intermediate
and final values stay within the spec limits.
Without the preceding fixes this reports inv_trans_8x4 and 4x4 on
aarch64, inv_trans_8x4, 4x8 and 4x4 on arm, and inv_trans_8x4, 4x8, 4x4
and all four inv_trans_*_dc on riscv as failing.
Signed-off-by: Wesley Maa <wesley.maa@gmail.com>
diff --git a/tests/checkasm/vc1dsp.c b/tests/checkasm/vc1dsp.c
index 532fcae63b..c16f1063ff 100644
--- a/tests/checkasm/vc1dsp.c
+++ b/tests/checkasm/vc1dsp.c
@@ -323,6 +323,21 @@ static void check_inv_trans_adding(void)
call_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1);
if (memcmp(inv_trans_out0, inv_trans_out1, 10 * 24))
fail();
+
+ for (int sign = -1; sign <= 1; sign += 2) {
+ int dc = tests[k].width == 8 && tests[k].height == 8 ? 2000 :
+ tests[k].width == 4 && tests[k].height == 4 ? 1000 :
+ 1400;
+ memset(inv_trans_in0, 0, 8 * 8 * sizeof (int16_t));
+ memset(inv_trans_in1, 0, 8 * 8 * sizeof (int16_t));
+ inv_trans_in0[0] = inv_trans_in1[0] = sign * dc;
+ RANDOMIZE_BUFFER8(inv_trans_out, 10 * 24);
+ call_ref(inv_trans_out0 + 24 + 8, 24, inv_trans_in0);
+ call_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1);
+ if (memcmp(inv_trans_out0, inv_trans_out1, 10 * 24))
+ fail();
+ }
+
bench_new(inv_trans_out1 + 24 + 8, 24, inv_trans_in1);
av_free(coeffs);
}