[05/13] vp3: Embed idct_permutation array directly in VP3DecoderContext

Message ID 1364995179-98359-5-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö April 3, 2013, 1:19 p.m.
From: "Ronald S. Bultje" <rsbultje@gmail.com>

This makes the vp3 decoder less dependent on dsputil, and will aid
in making it (eventually) dsputil-independent.
---
 libavcodec/vp3.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Luca Barbato April 3, 2013, 1:36 p.m. | #1
On 03/04/13 15:19, Martin Storsjö wrote:
> From: "Ronald S. Bultje" <rsbultje@gmail.com>
> 
> This makes the vp3 decoder less dependent on dsputil, and will aid
> in making it (eventually) dsputil-independent.
> ---
>  libavcodec/vp3.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Ok.
Diego Biurrun April 4, 2013, 2:58 p.m. | #2
On Wed, Apr 03, 2013 at 04:19:31PM +0300, Martin Storsjö wrote:
> 
> This makes the vp3 decoder less dependent on dsputil, and will aid
> in making it (eventually) dsputil-independent.
> --- a/libavcodec/vp3.c
> +++ b/libavcodec/vp3.c
> @@ -374,7 +375,8 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi)
>  
> -                s->qmat[qpi][inter][plane][s->dsp.idct_permutation[i]]= av_clip((qscale * coeff)/100 * 4, qmin, 4096);
> +                s->qmat[qpi][inter][plane][s->idct_permutation[i]] =
> +                    av_clip((qscale * coeff)/100 * 4, qmin, 4096);

One could add spaces around / here, while changing the line anyway.

Probably OK otherwise.

Diego
Martin Storsjö April 4, 2013, 3:46 p.m. | #3
On Thu, 4 Apr 2013, Diego Biurrun wrote:

> On Wed, Apr 03, 2013 at 04:19:31PM +0300, Martin Storsjö wrote:
>>
>> This makes the vp3 decoder less dependent on dsputil, and will aid
>> in making it (eventually) dsputil-independent.
>> --- a/libavcodec/vp3.c
>> +++ b/libavcodec/vp3.c
>> @@ -374,7 +375,8 @@ static void init_dequantizer(Vp3DecodeContext *s, int qpi)
>>
>> -                s->qmat[qpi][inter][plane][s->dsp.idct_permutation[i]]= av_clip((qscale * coeff)/100 * 4, qmin, 4096);
>> +                s->qmat[qpi][inter][plane][s->idct_permutation[i]] =
>> +                    av_clip((qscale * coeff)/100 * 4, qmin, 4096);
>
> One could add spaces around / here, while changing the line anyway.

Amended locally.

// Martin

Patch

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 3d55c78..9921b34 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -135,6 +135,7 @@  typedef struct Vp3DecodeContext {
     ThreadFrame last_frame;
     ThreadFrame current_frame;
     int keyframe;
+    uint8_t idct_permutation[64];
     DSPContext dsp;
     VideoDSPContext vdsp;
     VP3DSPContext vp3dsp;
@@ -374,7 +375,8 @@  static void init_dequantizer(Vp3DecodeContext *s, int qpi)
                 int qmin= 8<<(inter + !i);
                 int qscale= i ? ac_scale_factor : dc_scale_factor;
 
-                s->qmat[qpi][inter][plane][s->dsp.idct_permutation[i]]= av_clip((qscale * coeff)/100 * 4, qmin, 4096);
+                s->qmat[qpi][inter][plane][s->idct_permutation[i]] =
+                    av_clip((qscale * coeff)/100 * 4, qmin, 4096);
             }
             // all DC coefficients use the same quant so as not to interfere with DC prediction
             s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0];
@@ -1698,8 +1700,8 @@  static av_cold int vp3_decode_init(AVCodecContext *avctx)
     ff_videodsp_init(&s->vdsp, 8);
     ff_vp3dsp_init(&s->vp3dsp, avctx->flags);
 
-    ff_init_scantable_permutation(s->dsp.idct_permutation, s->vp3dsp.idct_perm);
-    ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
+    ff_init_scantable_permutation(s->idct_permutation, s->vp3dsp.idct_perm);
+    ff_init_scantable(s->idct_permutation, &s->scantable, ff_zigzag_direct);
 
     /* initialize to an impossible value which will force a recalculation
      * in the first frame decode */