[FFmpeg-devel] [PATCH] vc2enc: replace quantization LUT with a smaller division LUT

Rostislav Pehlivanov atomnuker at gmail.com
Sat Mar 10 16:41:19 EET 2018


On 28 February 2018 at 23:38, Michael Niedermayer <michael at niedermayer.cc>
wrote:

> On Tue, Feb 27, 2018 at 11:12:33PM +0000, Rostislav Pehlivanov wrote:
> > This commit replaces the huge and impractical LUT which converted coeffs
> > and a quantizer to bits to encode and instead uses a standard
> multiplication
> > and a shift to replace the division and then codes the values using the
> > regular golomb coding functions.
> > I was unable to see a performance difference on my machine but perhaps
> > someone else here can test. In any case, its better than the old one if
> > only because its smaller and less intrusive.
> >
> > Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
> > ---
> >  libavcodec/vc2enc.c | 118 ++++++++++++++----------------
> ----------------------
> >  1 file changed, 31 insertions(+), 87 deletions(-)
> [...]
>
> > @@ -557,7 +521,7 @@ static void encode_picture_start(VC2EncContext *s)
> >      encode_wavelet_transform(s);
> >  }
> >
> > -#define QUANT(c, qf) (((c) << 2)/(qf))
> > +#define QUANT(c, mul, add, shift) ((mul * c + add) >> shift)
>
> This needs more () otherwise this will misbehave with many
> expressions, for example a+b in mul would be a+b*c not (a+b)*c
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Many that live deserve death. And some that die deserve life. Can you give
> it to them? Then do not be too eager to deal out death in judgement. For
> even the very wise cannot see all ends. -- Gandalf
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
Fate passes, pushed with more brackets.


More information about the ffmpeg-devel mailing list