diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-05-17 11:12:04 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-05-17 11:12:04 +0000 |
commit | 8b6103da0f0f2ac73cf2698e8f26d7b989a564ac (patch) | |
tree | e3de9b1ac794d351fc0654ff54e8180bff9b893d /libavcodec/vp3.c | |
parent | ea191e08d6cefad09bfb1e6d9317874dfd4080be (diff) | |
download | ffmpeg-8b6103da0f0f2ac73cf2698e8f26d7b989a564ac.tar.gz |
porting vp3 idct over to lavc idct api
Originally committed as revision 4257 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r-- | libavcodec/vp3.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 7923229dc1..da4f531d29 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -2053,7 +2053,7 @@ static void render_fragments(Vp3DecodeContext *s, int height, int plane /* 0 = Y, 1 = U, 2 = V */) { - int x, y; + int x, y, j; int m, n; int i = first_fragment; int16_t *dequantizer; @@ -2188,21 +2188,32 @@ av_log(s->avctx, AV_LOG_ERROR, " help! got beefy vector! (%X, %X)\n", motion_x, i, s->all_fragments[i].coding_method, s->all_fragments[i].coeffs[0], dequantizer[0]); + if(s->avctx->idct_algo==FF_IDCT_VP3){ + for (j = 0; j < 64; j++) { + s->all_fragments[i].coeffs[j] *= dequantizer[j]; + } + }else{ + for (j = 0; j < 64; j++) { + s->all_fragments[i].coeffs[j]= (dequantizer[j] * s->all_fragments[i].coeffs[j] + 2) >> 2; + } + } + /* invert DCT and place (or add) in final output */ - s->dsp.vp3_idct(s->all_fragments[i].coeffs, - dequantizer, - s->all_fragments[i].coeff_count, - output_samples); - memset(s->all_fragments[i].coeffs, 0, 64*sizeof(DCTELEM)); + if (s->all_fragments[i].coding_method == MODE_INTRA) { - s->dsp.put_signed_pixels_clamped(output_samples, + if(s->avctx->idct_algo!=FF_IDCT_VP3) + s->all_fragments[i].coeffs[0] += 128<<3; + s->dsp.idct_put( output_plane + s->all_fragments[i].first_pixel, - stride); + stride, + s->all_fragments[i].coeffs); } else { - s->dsp.add_pixels_clamped(output_samples, + s->dsp.idct_add( output_plane + s->all_fragments[i].first_pixel, - stride); + stride, + s->all_fragments[i].coeffs); } + memset(s->all_fragments[i].coeffs, 0, 64*sizeof(DCTELEM)); debug_idct("block after idct_%s():\n", (s->all_fragments[i].coding_method == MODE_INTRA)? @@ -2496,8 +2507,9 @@ static int vp3_decode_init(AVCodecContext *avctx) #endif avctx->pix_fmt = PIX_FMT_YUV420P; avctx->has_b_frames = 0; + if(avctx->idct_algo==FF_IDCT_AUTO) + avctx->idct_algo=FF_IDCT_VP3; dsputil_init(&s->dsp, avctx); - s->dsp.vp3_dsp_init(); /* initialize to an impossible value which will force a recalculation * in the first frame decode */ |