diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-04 05:20:10 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-24 11:35:03 +0100 |
commit | 92209cf4c9be74197a1585e656443fedf215b344 (patch) | |
tree | df5dd95e386441e4dde64f2ab5bb48158b6ec6ea /libavcodec/atrac9dec.c | |
parent | 0339af05a4eaa1adbf153b7fa2213eea7e531573 (diff) | |
download | ffmpeg-92209cf4c9be74197a1585e656443fedf215b344.tar.gz |
avcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength
The whole point of VLCs with their tables is to read more than one bit
at a time; therefore max_depth, the number of times one has to
(maximally) read further bits is given by ceil(max_code_length / table_bits)
which in the case of ATRAC9's coefficient VLCs gives an upper bound of
two. Instead the maximum length of a code of the given VLC has been used
(which is not even a compile-time constant). Use two instead.
Furthermore, given that this was the only usage of the field containing
the maximum of all the code lengths of a given VLC the field has been
removed from its containing struct.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/atrac9dec.c')
-rw-r--r-- | libavcodec/atrac9dec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c index 075d610e75..a1af3c22ef 100644 --- a/libavcodec/atrac9dec.c +++ b/libavcodec/atrac9dec.c @@ -411,7 +411,7 @@ static inline void read_coeffs_coarse(ATRAC9Context *s, ATRAC9BlockData *b, const int groups = bands >> huff->value_cnt_pow; for (int j = 0; j < groups; j++) { - uint16_t val = get_vlc2(gb, tab->table, 9, huff->max_bit_size); + uint16_t val = get_vlc2(gb, tab->table, 9, 2); for (int k = 0; k < huff->value_cnt; k++) { coeffs[k] = sign_extend(val, huff->value_bits); |