Browse Source

avcodec/on2avc: Use least max_depth for get_vlc2()

The longest codes of any VLC codebooks are 18 bits long and the VLC
tables itself use 9 bits; therefore it is sufficient to read twice from
the table, yet this has been done thrice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
tags/n4.4
Andreas Rheinhardt 5 years ago
parent
commit
bce8e2f374
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/on2avc.c

+ 2
- 2
libavcodec/on2avc.c View File

@@ -195,7 +195,7 @@ static int on2avc_decode_quads(On2AVCContext *c, GetBitContext *gb, float *dst,
int i, j, val, val1;

for (i = 0; i < dst_size; i += 4) {
val = get_vlc2(gb, c->cb_vlc[type].table, 9, 3);
val = get_vlc2(gb, c->cb_vlc[type].table, 9, 2);

for (j = 0; j < 4; j++) {
val1 = sign_extend((val >> (12 - j * 4)) & 0xF, 4);
@@ -228,7 +228,7 @@ static int on2avc_decode_pairs(On2AVCContext *c, GetBitContext *gb, float *dst,
int i, val, val1, val2, sign;

for (i = 0; i < dst_size; i += 2) {
val = get_vlc2(gb, c->cb_vlc[type].table, 9, 3);
val = get_vlc2(gb, c->cb_vlc[type].table, 9, 2);

val1 = sign_extend(val >> 8, 8);
val2 = sign_extend(val & 0xFF, 8);


Loading…
Cancel
Save