[FFmpeg-cvslog] avcodec/hq_hqa: Include implicit +1 run in RL VLC table

Andreas Rheinhardt git at videolan.org
Sun Apr 13 10:01:07 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Apr  9 19:01:18 2025 +0200| [9c0d6145c9e066b7286712a292c74a0b75d69be5] | committer: Andreas Rheinhardt

avcodec/hq_hqa: Include implicit +1 run in RL VLC table

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/hq_hqa.c     | 5 ++---
 libavcodec/hq_hqadata.h | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c
index f69bf6b290..f07a11b71a 100644
--- a/libavcodec/hq_hqa.c
+++ b/libavcodec/hq_hqa.c
@@ -88,7 +88,7 @@ static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64],
     }
 
     OPEN_READER(re, gb);
-    for (int pos = 1;;) {
+    for (int pos = 0;;) {
         int level, run;
         UPDATE_CACHE(re, gb);
         GET_RL_VLC(level, run, re, gb, hq_ac_rvlc, 9, 2, 0);
@@ -101,7 +101,6 @@ static int hq_decode_block(HQContext *c, GetBitContext *gb, int16_t block[64],
         if (pos >= 64)
             break;
         block[ff_zigzag_direct[pos]] = (int)(level * (unsigned)q[pos]) >> 12;
-        pos++;
     }
     CLOSE_READER(re, gb);
 
@@ -387,7 +386,7 @@ static av_cold void hq_init_static(void)
 
         if (len > 0) {
             level = hq_ac_syms[sym];
-            run   = hq_ac_skips[sym];
+            run   = hq_ac_skips[sym] + 1;
         } else if (len < 0) { // More bits needed
             run   = 0;
         } else { // Invalid code
diff --git a/libavcodec/hq_hqadata.h b/libavcodec/hq_hqadata.h
index 8948c3a64a..e723cefaac 100644
--- a/libavcodec/hq_hqadata.h
+++ b/libavcodec/hq_hqadata.h
@@ -1155,7 +1155,7 @@ static const uint8_t hq_quant_map[NUM_HQ_QUANTS][2][4] =
     { { QMAT3A, QMAT48, QMAT4C, QMAT4C }, { QMAT3B, QMAT49, QMAT4D, QMAT4D } },
 };
 
-#define HQ_AC_INVALID_RUN 128
+#define HQ_AC_INVALID_RUN 0
 
 static const uint8_t hq_ac_bits[NUM_HQ_AC_ENTRIES] = {
      3,  3,  4,  4,  4,  5,  5,  5,  5,  5,  5,  6,  6,  6,  6,  6,



More information about the ffmpeg-cvslog mailing list