[FFmpeg-devel] [PATCH 100/114] avcodec/vp3: Use symbols table for VP3 motion vectors
Peter Ross
pross at xvid.org
Mon Nov 16 05:38:03 EET 2020
On Sun, Nov 15, 2020 at 06:37:25AM +0100, Andreas Rheinhardt wrote:
> 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.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'
> >
> 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).
I agree with your reasoning. Cheers,
-- 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/20201116/6bfe438a/attachment.sig>
More information about the ffmpeg-devel
mailing list