From 9a0aa8d02a313e815234bd854f9225a97ac996f7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 26 Apr 2013 22:45:38 +0200 Subject: [PATCH] avcodec/intrax8: fix regression with wmv3 This also decreases dependancies between intrax8 and the outside Signed-off-by: Michael Niedermayer --- libavcodec/intrax8.c | 14 +++++++++----- libavcodec/intrax8.h | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c index 67e16ab8da..1d02ec3180 100644 --- a/libavcodec/intrax8.c +++ b/libavcodec/intrax8.c @@ -437,7 +437,7 @@ lut2[q>12][c]={ static void x8_ac_compensation(IntraX8Context * const w, int const direction, int const dc_level){ MpegEncContext * const s= w->s; int t; -#define B(x,y) s->block[0][s->dsp.idct_permutation[(x)+(y)*8]] +#define B(x,y) s->block[0][w->idct_permutation[(x)+(y)*8]] #define T(x) ((x) * dc_level + 0x8000) >> 16; switch(direction){ case 0: @@ -643,7 +643,7 @@ static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){ s->current_picture.f.linesize[!!chroma] ); } if(!zeros_only) - s->dsp.idct_add ( s->dest[chroma], + w->wdsp.idct_add (s->dest[chroma], s->current_picture.f.linesize[!!chroma], s->block[0] ); @@ -695,9 +695,13 @@ av_cold void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s av_assert0(s->mb_width>0); w->prediction_table=av_mallocz(s->mb_width*2*2);//two rows, 2 blocks per cannon mb - ff_init_scantable(s->dsp.idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); - ff_init_scantable(s->dsp.idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]); - ff_init_scantable(s->dsp.idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]); + ff_wmv2dsp_init(&w->wdsp); + ff_init_scantable_permutation(w->idct_permutation, + w->wdsp.idct_perm); + + ff_init_scantable(w->idct_permutation, &w->scantable[0], ff_wmv1_scantable[0]); + ff_init_scantable(w->idct_permutation, &w->scantable[1], ff_wmv1_scantable[2]); + ff_init_scantable(w->idct_permutation, &w->scantable[2], ff_wmv1_scantable[3]); ff_intrax8dsp_init(&w->dsp); } diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h index 40d689a93c..9981785403 100644 --- a/libavcodec/intrax8.h +++ b/libavcodec/intrax8.h @@ -22,6 +22,7 @@ #include "get_bits.h" #include "mpegvideo.h" #include "intrax8dsp.h" +#include "wmv2dsp.h" typedef struct IntraX8Context { VLC * j_ac_vlc[4];//they point to the static j_mb_vlc @@ -32,6 +33,8 @@ typedef struct IntraX8Context { //set by ff_intrax8_common_init uint8_t * prediction_table;//2*(mb_w*2) ScanTable scantable[3]; + WMV2DSPContext wdsp; + uint8_t idct_permutation[64]; //set by the caller codec MpegEncContext * s; IntraX8DSPContext dsp;