[FFmpeg-devel] [PATCH 100/114] avcodec/vp3: Use symbols table for VP3 motion vectors

Peter Ross pross at xvid.org
Sat Nov 14 10:17:10 EET 2020


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.rheinhardt at 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'

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20201114/c3f15c6f/attachment.sig>


More information about the ffmpeg-devel mailing list