]> git.sesse.net Git - ffmpeg/commit
avcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 4 Nov 2020 04:20:10 +0000 (05:20 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 24 Nov 2020 10:35:03 +0000 (11:35 +0100)
commit92209cf4c9be74197a1585e656443fedf215b344
treedf5dd95e386441e4dde64f2ab5bb48158b6ec6ea
parent0339af05a4eaa1adbf153b7fa2213eea7e531573
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>
libavcodec/atrac9dec.c
libavcodec/atrac9tab.h