From f3eb00834362273dcb1fd3320faa5f8f5a00fb22 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 29 Jul 2012 13:09:10 +0100 Subject: eamad/eatgq/eatqi: call special EA IDCT directly These decoders use a special non-MPEG2 IDCT. Call it directly instead of going through dsputil. There is never any reason to use a regular IDCT with these decoders or to use the EA IDCT with other codecs. This also fixes the bizarre situation of eamad and eatqi decoding incorrectly if eatgq is disabled. Signed-off-by: Mans Rullgard --- libavcodec/eatgq.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'libavcodec/eatgq.c') diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c index e53b992..a55b061 100644 --- a/libavcodec/eatgq.c +++ b/libavcodec/eatgq.c @@ -34,10 +34,10 @@ #include "bytestream.h" #include "dsputil.h" #include "aandcttab.h" +#include "eaidct.h" typedef struct TgqContext { AVCodecContext *avctx; - DSPContext dsp; AVFrame frame; int width,height; ScanTable scantable; @@ -48,11 +48,10 @@ typedef struct TgqContext { static av_cold int tgq_decode_init(AVCodecContext *avctx){ TgqContext *s = avctx->priv_data; + uint8_t idct_permutation[64]; s->avctx = avctx; - if(avctx->idct_algo==FF_IDCT_AUTO) - avctx->idct_algo=FF_IDCT_EA; - ff_dsputil_init(&s->dsp, avctx); - ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct); + ff_init_scantable_permutation(idct_permutation, FF_NO_IDCT_PERM); + ff_init_scantable(idct_permutation, &s->scantable, ff_zigzag_direct); avctx->time_base = (AVRational){1, 15}; avctx->pix_fmt = PIX_FMT_YUV420P; return 0; @@ -109,13 +108,13 @@ static void tgq_idct_put_mb(TgqContext *s, DCTELEM (*block)[64], int mb_x, int m uint8_t *dest_cb = s->frame.data[1] + (mb_y * 8 * s->frame.linesize[1]) + mb_x * 8; uint8_t *dest_cr = s->frame.data[2] + (mb_y * 8 * s->frame.linesize[2]) + mb_x * 8; - s->dsp.idct_put(dest_y , linesize, block[0]); - s->dsp.idct_put(dest_y + 8, linesize, block[1]); - s->dsp.idct_put(dest_y + 8*linesize , linesize, block[2]); - s->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]); + ff_ea_idct_put_c(dest_y , linesize, block[0]); + ff_ea_idct_put_c(dest_y + 8, linesize, block[1]); + ff_ea_idct_put_c(dest_y + 8*linesize , linesize, block[2]); + ff_ea_idct_put_c(dest_y + 8*linesize + 8, linesize, block[3]); if(!(s->avctx->flags&CODEC_FLAG_GRAY)){ - s->dsp.idct_put(dest_cb, s->frame.linesize[1], block[4]); - s->dsp.idct_put(dest_cr, s->frame.linesize[2], block[5]); + ff_ea_idct_put_c(dest_cb, s->frame.linesize[1], block[4]); + ff_ea_idct_put_c(dest_cr, s->frame.linesize[2], block[5]); } } @@ -180,10 +179,7 @@ static void tgq_calculate_qtable(TgqContext *s, int quant){ const int b = (11*(100-quant))/100 + 4; for(j=0;j<8;j++) for(i=0;i<8;i++) - if (s->avctx->idct_algo==FF_IDCT_EA) - s->qtable[j*8+i] = ((a*(j+i)/(7+7) + b)*ff_inv_aanscales[j*8+i])>>(14-4); - else - s->qtable[j*8+i] = (a*(j+i)/(7+7) + b)<<3; + s->qtable[j*8+i] = ((a*(j+i)/(7+7) + b)*ff_inv_aanscales[j*8+i])>>(14-4); } static int tgq_decode_frame(AVCodecContext *avctx, -- cgit v1.1