]> git.sesse.net Git - ffmpeg/commit
avcodec/mpc8: Avoid code duplication when initializing VLCs
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 30 Oct 2020 10:43:06 +0000 (11:43 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 8 Dec 2020 16:51:45 +0000 (17:51 +0100)
commit83ff99adc4bf04c4ba2e3436ce2d18a5098132d1
treeaa845dd3a473ea191692f4c9998a12b9ca21b8e9
parent6c8e85c66074cdd687c0c63754c15911e46abc9b
avcodec/mpc8: Avoid code duplication when initializing VLCs

Up until now, VLCs that were part of an array of VLCs were often not
initialized in a loop, but separately. The probable reason for this
was that these VLCs differed slightly in the parameters to be used for
them (i.e. the number of codes or the number of bits to be used
differs), so that one would have to provide these parameters e.g. via
arrays.

Yet these problems have actually largely been solved by now: The length
information is contained in a run-length encoded form that is the same
for all VLCs and both the number of codes as well as the number of bits
to use for each VLC can be easily derived from them.

There is just one problem to be solved: When the underlying tables have
a different number of elements, putting them into an array of arrays
would be wasteful; using an array of pointers to the arrays would
also be wasteful. Therefore this commit combines the tables into bigger
tables. (Given that all the length tables have the same layout this
applies only to the symbols tables.)

Finally, the array containing the offset of the VLC's buffer in the big
buffer has also been removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/mpc8.c
libavcodec/mpc8huff.h