[FFmpeg-cvslog] avcodec/proresenc_anatoliy: make a few cosmetics in encode_acs()

Clément Bœsch git at videolan.org
Wed Jan 10 15:22:51 EET 2024


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Mon Dec 11 02:29:36 2023 +0100| [cc2206d1422d2cc9cdac90461075b320f90c5217] | committer: Clément Bœsch

avcodec/proresenc_anatoliy: make a few cosmetics in encode_acs()

This makes the function pretty much identical to the function of the
same name in proresenc_kostya.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc2206d1422d2cc9cdac90461075b320f90c5217
---

 libavcodec/proresenc_anatoliy.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index c0e8e69cf7..6be6a98089 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -286,32 +286,28 @@ static void encode_acs(PutBitContext *pb, int16_t *blocks,
                        int blocks_per_slice,
                        int *qmat, const uint8_t *scan)
 {
-    int idx;
+    int idx, i;
     int prev_run = 4;
     int prev_level = 2;
-    int max_coeffs;
-    int run = 0, level, code, i;
+    int run = 0, level;
+    int max_coeffs, abs_level;
 
     max_coeffs = blocks_per_slice << 6;
 
     for (i = 1; i < 64; i++) {
         for (idx = scan[i]; idx < max_coeffs; idx += 64) {
-            int val = blocks[idx] / qmat[scan[i]];
-            if (val) {
+            level = blocks[idx] / qmat[scan[i]];
+            if (level) {
+                abs_level = FFABS(level);
                 encode_vlc_codeword(pb, ff_prores_run_to_cb[prev_run], run);
-
-                level      = FFABS(val);
-                code       = level - 1;
-
-                encode_vlc_codeword(pb, ff_prores_level_to_cb[prev_level], code);
-
-                put_sbits(pb, 1, GET_SIGN(val));
+                encode_vlc_codeword(pb, ff_prores_level_to_cb[prev_level], abs_level - 1);
+                put_sbits(pb, 1, GET_SIGN(level));
 
                 prev_run   = FFMIN(run, 15);
-                prev_level = FFMIN(level, 9);
+                prev_level = FFMIN(abs_level, 9);
                 run        = 0;
             } else {
-                ++run;
+                run++;
             }
         }
     }



More information about the ffmpeg-cvslog mailing list