[FFmpeg-cvslog] avcodec/proresenc_anatoliy: rework inner loop in encode_acs()

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


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

avcodec/proresenc_anatoliy: rework inner loop in encode_acs()

This matches the logic from the function of the same name in proresenc_kostya.

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

 libavcodec/proresenc_anatoliy.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 442910c46d..bc25b96965 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -286,14 +286,17 @@ static void encode_acs(PutBitContext *pb, int16_t *blocks,
                        int blocks_per_slice,
                        int *qmat, const uint8_t *scan)
 {
+    int idx;
     int prev_run = 4;
     int prev_level = 2;
+    int max_coeffs;
+    int run = 0, level, code, i;
+
+    max_coeffs = blocks_per_slice << 6;
 
-    int run = 0, level, code, i, j;
     for (i = 1; i < 64; i++) {
-        int indp = scan[i];
-        for (j = 0; j < blocks_per_slice; j++) {
-            int val = (blocks[(j << 6) + indp]) / qmat[indp];
+        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);
 



More information about the ffmpeg-cvslog mailing list