From 8fb2e96d7e61891b415b63dcbaaa77f6fdc00f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Mon, 11 Dec 2023 02:26:10 +0100 Subject: [PATCH] avcodec/proresenc_anatoliy: execute AC run/level FFMIN() at assignment This matches the logic from the function of the same name in proresenc_kostya. --- libavcodec/proresenc_anatoliy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index bc25b96965..c0e8e69cf7 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -298,18 +298,18 @@ static void encode_acs(PutBitContext *pb, int16_t *blocks, for (idx = scan[i]; idx < max_coeffs; idx += 64) { int val = blocks[idx] / qmat[scan[i]]; if (val) { - encode_vlc_codeword(pb, ff_prores_run_to_cb[FFMIN(prev_run, 15)], run); + encode_vlc_codeword(pb, ff_prores_run_to_cb[prev_run], run); - prev_run = run; - run = 0; level = FFABS(val); code = level - 1; - encode_vlc_codeword(pb, ff_prores_level_to_cb[FFMIN(prev_level, 9)], code); - - prev_level = level; + encode_vlc_codeword(pb, ff_prores_level_to_cb[prev_level], code); put_sbits(pb, 1, GET_SIGN(val)); + + prev_run = FFMIN(run, 15); + prev_level = FFMIN(level, 9); + run = 0; } else { ++run; }