aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_mvpred.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-11-03 19:20:15 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-08 17:51:44 +0100
commitb629deab3d42e6db5216d6c6ee054d2d70a4071e (patch)
tree5ee06c49d2f2548918a2ad6944d587ca5f5f586c /libavcodec/h264_mvpred.h
parente127af3c2b591dacd0c4c678a82d60bcce69755f (diff)
downloadffmpeg-b629deab3d42e6db5216d6c6ee054d2d70a4071e.tar.gz
avcodec/bitstream: Allow static VLC tables to be bigger than needed
Right now the allocated size of the VLC table of a static VLC has to exactly match the size actually used for the VLC: If it is not enough, abort is called; if it is more than enough, an error message is emitted. This is no problem when one wants to initialize an individual VLC via one of the INIT_VLC macros as one just hardcodes the needed size. Yet it is an obstacle when one wants to initialize several VLCs in a loop as one then needs to add an array for the sizes/offsets of the VLC tables (unless max_depth of all arrays is one in which case the sizes are derivable from the number of bits used). Yet said size array is not necessary if one disables the warning for too big buffers. The reason is that the amount of entries needed for the table is of course generated as a byproduct of initializing the VLC. To this end a flag that disables the warning has been added. So one can proceed as follows: static VLC vlcs[NUM]; static VLC_TYPE vlc_table[BUF_SIZE][2]; for (int i = 0, offset = 0; i < NUM; i++) { vlcs[i].table = &vlc_table[offset]; vlcs[i].table_allocated = BUF_SIZE - offset; init_vlc(); /* With INIT_VLC_STATIC_OVERLONG flag */ offset += vlcs[i].table_size; } Of course, BUF_SIZE should be equal to the number of entries actually needed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/h264_mvpred.h')
0 files changed, 0 insertions, 0 deletions