You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/vp6: Don't reload unnecessarily often in get_vlc2()
The VLC trees used here have very few different codes and are therefore guaranteed to not be very deep: The AC/DC VLCs have 12 elements and therefore a depth <= 11 whereas the run VLCs have only nine elements and therefore a depth <= 8. This allows to reduce the worst-case number of reloads for reading a VLC code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -415,7 +415,7 @@ static int vp6_parse_coeff_huffman(VP56Context *s)
|
||||
VP56Model *model = s->modelp;
|
||||
uint8_t *permute = s->idct_scantable;
|
||||
VLC *vlc_coeff;
|
||||
int coeff, sign, coeff_idx;
|
||||
int sign, coeff_idx;
|
||||
int b, cg, idx;
|
||||
int pt = 0; /* plane type (0 for Y, 1 for U or V) */
|
||||
|
||||
@ -433,11 +433,11 @@ static int vp6_parse_coeff_huffman(VP56Context *s)
|
||||
} else {
|
||||
if (get_bits_left(&s->gb) <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
coeff = get_vlc2(&s->gb, vlc_coeff->table, FF_HUFFMAN_BITS, 3);
|
||||
int coeff = get_vlc2(&s->gb, vlc_coeff->table, FF_HUFFMAN_BITS, 2);
|
||||
if (coeff == 0) {
|
||||
if (coeff_idx) {
|
||||
int pt = (coeff_idx >= 6);
|
||||
run += get_vlc2(&s->gb, s->runv_vlc[pt].table, FF_HUFFMAN_BITS, 3);
|
||||
run += get_vlc2(&s->gb, s->runv_vlc[pt].table, FF_HUFFMAN_BITS, 1);
|
||||
if (run >= 9)
|
||||
run += get_bits(&s->gb, 6);
|
||||
} else
|
||||
|
Reference in New Issue
Block a user