[FFmpeg-devel] [PATCH 33/35] avcodec/proresenc_anatoliy: execute AC run/level FFMIN() at assignment

Clément Bœsch u at pkh.me
Mon Dec 11 03:35:34 EET 2023


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 161a05a6e6..2515ee38f8 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_lev_to_cb[FFMIN(prev_level, 9)], code);
-
-                prev_level = level;
+                encode_vlc_codeword(pb, ff_prores_lev_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;
             }
-- 
2.43.0



More information about the ffmpeg-devel mailing list