From 28f9ab7029bd1a02f659995919f899f84ee7361b Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Tue, 17 Jul 2012 16:47:43 +0100 Subject: vp3: move idct and loop filter pointers to new vp3dsp context This moves all VP3-specific function pointers from dsputil to a new vp3dsp context. There is no reason to ever use the VP3 IDCT where an MPEG2 IDCT is expected or vice versa. Signed-off-by: Mans Rullgard --- libavcodec/vp3.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'libavcodec/vp3.c') diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 373f5e0b68..948167c2e8 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -40,6 +40,7 @@ #include "get_bits.h" #include "vp3data.h" +#include "vp3dsp.h" #include "xiph.h" #include "thread.h" @@ -135,6 +136,7 @@ typedef struct Vp3DecodeContext { AVFrame current_frame; int keyframe; DSPContext dsp; + VP3DSPContext vp3dsp; int flipped_image; int last_slice_end; int skip_loop_filter; @@ -1302,14 +1304,14 @@ static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int ye { /* do not perform left edge filter for left columns frags */ if (x > 0) { - s->dsp.vp3_h_loop_filter( + s->vp3dsp.h_loop_filter( plane_data + 8*x, stride, bounding_values); } /* do not perform top edge filter for top row fragments */ if (y > 0) { - s->dsp.vp3_v_loop_filter( + s->vp3dsp.v_loop_filter( plane_data + 8*x, stride, bounding_values); } @@ -1319,7 +1321,7 @@ static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int ye * in this frame (it will be filtered in next iteration) */ if ((x < width - 1) && (s->all_fragments[fragment + 1].coding_method == MODE_COPY)) { - s->dsp.vp3_h_loop_filter( + s->vp3dsp.h_loop_filter( plane_data + 8*x + 8, stride, bounding_values); } @@ -1329,7 +1331,7 @@ static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int ye * in this frame (it will be filtered in the next row) */ if ((y < height - 1) && (s->all_fragments[fragment + width].coding_method == MODE_COPY)) { - s->dsp.vp3_v_loop_filter( + s->vp3dsp.v_loop_filter( plane_data + 8*x + 8*stride, stride, bounding_values); } @@ -1577,9 +1579,7 @@ static void render_slice(Vp3DecodeContext *s, int slice) index = vp3_dequant(s, s->all_fragments + i, plane, 0, block); if (index > 63) continue; - if(s->avctx->idct_algo!=FF_IDCT_VP3) - block[0] += 128<<3; - s->dsp.idct_put( + s->vp3dsp.idct_put( output_plane + first_pixel, stride, block); @@ -1588,12 +1588,12 @@ static void render_slice(Vp3DecodeContext *s, int slice) if (index > 63) continue; if (index > 0) { - s->dsp.idct_add( + s->vp3dsp.idct_add( output_plane + first_pixel, stride, block); } else { - s->dsp.vp3_idct_dc_add(output_plane + first_pixel, stride, block); + s->vp3dsp.idct_dc_add(output_plane + first_pixel, stride, block); } } } else { @@ -1676,10 +1676,10 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) if (avctx->pix_fmt == PIX_FMT_NONE) avctx->pix_fmt = PIX_FMT_YUV420P; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; - if(avctx->idct_algo==FF_IDCT_AUTO) - avctx->idct_algo=FF_IDCT_VP3; ff_dsputil_init(&s->dsp, avctx); + 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); /* initialize to an impossible value which will force a recalculation -- cgit v1.2.3