Peter Ross: > On Tue, Nov 10, 2020 at 11:58:22AM +0100, Andreas Rheinhardt wrote: >> Expressions like array[get_vlc2()] can be optimized by using a symbols >> table if the array is always the same for a given VLC. This requirement >> is fulfilled for the VLC used for VP3 motion vectors. The reason it >> hasn't been done before is probably that the array in this case >> contained entries in the range -31..31; but this is no problem with >> ff_init_vlc_from_lengths(): Just apply an offset of 31 to the symbols >> before storing them in the table used to initialize VP3 motion vectors >> and apply an offset of -31 when initializing the actual VLC. >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> >> --- >> libavcodec/vp3.c | 20 ++++++++++++------- >> libavcodec/vp3data.h | 46 +++++++++++--------------------------------- >> 2 files changed, 24 insertions(+), 42 deletions(-) >> >> diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c >> index 7037d03a98..f288a53fe1 100644 >> --- a/libavcodec/vp3.c >> +++ b/libavcodec/vp3.c >> @@ -48,6 +48,7 @@ >> #include "vp3dsp.h" >> #include "xiph.h" >> >> +#define VP3_MV_VLC_BITS 6 >> #define VP4_MV_VLC_BITS 6 >> #define SUPERBLOCK_VLC_BITS 6 > > or just use '#define MV_VLC_BITS 6' > This patch has to modify all the lines that use the motion_vector_vlc VLC table, so using a named constant can be easily done while at it; this is no longer true when also changing VP4. Furthermore, there is no a-priori reason why it should forever be so that both of these are six (the longest VP3 MV code is only eight bits long, which is not excessive; I pondered changing it, but decided that it is outside the remit of this patchset). But if you want to, I can use one constant for both.
- Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".