diff options
author | Stefan Gehrer <stefan.gehrer@gmx.de> | 2006-07-29 08:45:33 +0000 |
---|---|---|
committer | Stefan Gehrer <stefan.gehrer@gmx.de> | 2006-07-29 08:45:33 +0000 |
commit | 595e7bd94029713d87e3e4943b40676df1b2d0a0 (patch) | |
tree | 0c30f5202a46e09763827473c61e32e5a509b1ee /libavcodec/cavs.c | |
parent | 09be55df9c78c494d597d1a073f4f9ccc0e55cfc (diff) | |
download | ffmpeg-595e7bd94029713d87e3e4943b40676df1b2d0a0.tar.gz |
some MMX optimizations for the CAVS decoder
Originally committed as revision 5846 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/cavs.c')
-rw-r--r-- | libavcodec/cavs.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index 220a731529..5200892685 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -78,6 +78,7 @@ typedef struct { int qp; int qp_fixed; int cbp; + ScanTable scantable; /** intra prediction is done with un-deblocked samples they are saved here before deblocking the MB */ @@ -97,6 +98,7 @@ typedef struct { int scale_den[2]; ///< for scaling neighbouring MVs int got_keyframe; + DCTELEM *block; } AVSContext; /***************************************************************************** @@ -649,10 +651,9 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb, int dqm = dequant_mul[qp]; int dqs = dequant_shift[qp]; int dqa = 1 << (dqs - 1); - const uint8_t *scantab = ff_zigzag_direct; - DCTELEM block[64]; + const uint8_t *scantab = h->scantable.permutated; + DCTELEM *block = h->block; - memset(block,0,64*sizeof(DCTELEM)); for(i=0;i<65;i++) { level_code = get_ue_code(gb,r->golomb_order); if(level_code >= ESCAPE_CODE) { @@ -1135,8 +1136,10 @@ static int decode_pic(AVSContext *h) { enum mb_t mb_type; if (!s->context_initialized) { + s->avctx->idct_algo = FF_IDCT_CAVS; if (MPV_common_init(s) < 0) return -1; + ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct); } get_bits(&s->gb,16);//bbv_dwlay if(h->stc == PIC_PB_START_CODE) { @@ -1281,6 +1284,7 @@ static void init_top_lines(AVSContext *h) { /* alloc space for co-located MVs and types */ h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(vector_t)); h->col_type_base = av_malloc(h->mb_width*h->mb_height); + h->block = av_mallocz(64*sizeof(DCTELEM)); } static int decode_seq_header(AVSContext *h) { @@ -1478,6 +1482,7 @@ static int cavs_decode_end(AVCodecContext * avctx) { av_free(h->top_border_v); av_free(h->col_mv); av_free(h->col_type_base); + av_free(h->block); return 0; } |