]> git.sesse.net Git - ffmpeg/commit
avcodec/rv40: Make better use of VLC symbols table
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 31 Oct 2020 21:44:12 +0000 (22:44 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 8 Dec 2020 16:51:46 +0000 (17:51 +0100)
commitfcde452a47d8987208df0cdaae1dd6025d7fbf3e
tree97e47d9f31bef0c430db6bb487a24006bfa4869e
parent47a72391d0745f5e558c1eecf97525b03161e136
avcodec/rv40: Make better use of VLC symbols table

RealVideo 4.0 has a VLC that encodes two intra types per code; each
intra type is in the range 0..8 (inclusive) and up until now the VLC
used symbols in the range 0..80; one type was encoded as the remainder
when dividing the symbol by 9 whereas the other type was encoded as
symbol / 9. This is suboptimal; a better way would be to use the high
and low nibble to encode each symbol. But an even better way is to use
16bit symbols so that the two intra types can be directly written as
a 16bit value.

This commit implements this; in order to avoid huge tables the symbols
are stored as uint8_t with high and low nibbles encoding one type each;
they are only unpacked to uint16_t during initialization.

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