[FFmpeg-devel] [PATCH 04/11] avcodec/mdec: allow/use permuted IDCTs
Ronald S. Bultje
rsbultje at gmail.com
Mon Jun 19 21:02:25 EEST 2017
Hi,
On Mon, Jun 19, 2017 at 12:39 PM, Michael Niedermayer <
michael at niedermayer.cc> wrote:
> On Mon, Jun 19, 2017 at 05:10:57PM +0200, James Darnley wrote:
> > From: "Ronald S. Bultje" <rsbultje at gmail.com>
> >
> > ---
> > libavcodec/mdec.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
> > index 97bfebbeb7..1e1c8f4c55 100644
> > --- a/libavcodec/mdec.c
> > +++ b/libavcodec/mdec.c
> > @@ -94,7 +94,7 @@ static inline int mdec_decode_block_intra(MDECContext
> *a, int16_t *block, int n)
> > return AVERROR_INVALIDDATA;
> > }
> > j = scantable[i];
> > - level = (level * qscale * quant_matrix[j]) >> 3;
> > + level = (level * qscale * quant_matrix[ff_zigzag_direct[i]])
> >> 3;
> > level = (level ^ SHOW_SBITS(re, &a->gb, 1)) -
> SHOW_SBITS(re, &a->gb, 1);
> > LAST_SKIP_BITS(re, &a->gb, 1);
> > } else {
> > @@ -111,11 +111,11 @@ static inline int mdec_decode_block_intra(MDECContext
> *a, int16_t *block, int n)
> > j = scantable[i];
> > if (level < 0) {
> > level = -level;
> > - level = (level * (unsigned)qscale *
> quant_matrix[j]) >> 3;
> > + level = (level * (unsigned)qscale *
> quant_matrix[ff_zigzag_direct[i]]) >> 3;
> > level = (level - 1) | 1;
> > level = -level;
> > } else {
> > - level = (level * (unsigned)qscale *
> quant_matrix[j]) >> 3;
> > + level = (level * (unsigned)qscale *
> quant_matrix[ff_zigzag_direct[i]]) >> 3;
> > level = (level - 1) | 1;
> > }
> > }
>
> quant_matrix can be permuted during init to avoid the per coef
> permutation here
Or it could be done per frame and also include the multiplication with
> qscale
We're not talking about a complex codec here, so I prefer simplicity over
speed. (I.e. I personally believe per-frame quant table init is overkill.)
Ronald
More information about the ffmpeg-devel
mailing list