1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/hqxvlc: Include implicit +1 run in RL VLC tables

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-13 20:04:16 +01:00
parent abffd9313d
commit 09411fef3d
2 changed files with 6 additions and 5 deletions

View File

@ -115,7 +115,7 @@ static int decode_block(GetBitContext *gb, VLC *vlc,
{
int q, dc;
int ac_idx;
int run, lev, pos = 1;
int run, lev, pos = 0;
memset(block, 0, 64 * sizeof(*block));
dc = get_vlc2(gb, vlc->table, HQX_DC_VLC_BITS, 2);
@ -140,10 +140,10 @@ static int decode_block(GetBitContext *gb, VLC *vlc,
do {
hqx_get_ac(gb, &ff_hqx_ac[ac_idx], &run, &lev);
pos += run;
if (pos >= 64)
if (pos > 63)
break;
block[ff_zigzag_direct[pos++]] = lev * q;
} while (pos < 64);
block[ff_zigzag_direct[pos]] = lev * q;
} while (pos < 63);
return 0;
}

View File

@ -726,7 +726,8 @@ HQXAC ff_hqx_ac[NUM_HQX_AC] = {
};
// level is in -255..255 range, run 0..64, so it fits into 16 bits.
#define E(level, run) ((level * 128) | run)
// We offset run by 1 in order to include the implicit run of 1.
#define E(level, run) ((level * 128) | (run + 1))
static const int16_t hqx_ac_run_level[] = {
// AC table Q0 - 815 elements