comparison vp56.c @ 11665:85ee3d14b906 libavcodec

VP56: move vp56_edge_filter to new VP56DSPContext Using macro templates allows the vp[56]_adjust functions to be inlined instead of called through function pointers. The new function pointers enable optimised implementations of the filters. 4% faster VP6 decoding on Cortex-A8.
author mru
date Fri, 30 Apr 2010 21:30:22 +0000
parents 7dd2a45249a9
children d8364962cc4a
comparison
equal deleted inserted replaced
11664:3da317f52661 11665:85ee3d14b906
298 lb->ref_frame = ref_frame; 298 lb->ref_frame = ref_frame;
299 s->block_coeff[b][idx] *= s->dequant_dc; 299 s->block_coeff[b][idx] *= s->dequant_dc;
300 } 300 }
301 } 301 }
302 302
303 static void vp56_edge_filter(VP56Context *s, uint8_t *yuv,
304 int pix_inc, int line_inc, int t)
305 {
306 int pix2_inc = 2 * pix_inc;
307 int i, v;
308
309 for (i=0; i<12; i++) {
310 v = (yuv[-pix2_inc] + 3*(yuv[0]-yuv[-pix_inc]) - yuv[pix_inc] + 4) >>3;
311 v = s->adjust(v, t);
312 yuv[-pix_inc] = av_clip_uint8(yuv[-pix_inc] + v);
313 yuv[0] = av_clip_uint8(yuv[0] - v);
314 yuv += line_inc;
315 }
316 }
317
318 static void vp56_deblock_filter(VP56Context *s, uint8_t *yuv, 303 static void vp56_deblock_filter(VP56Context *s, uint8_t *yuv,
319 int stride, int dx, int dy) 304 int stride, int dx, int dy)
320 { 305 {
321 int t = vp56_filter_threshold[s->quantizer]; 306 int t = vp56_filter_threshold[s->quantizer];
322 if (dx) vp56_edge_filter(s, yuv + 10-dx , 1, stride, t); 307 if (dx) s->vp56dsp.edge_filter_hor(yuv + 10-dx , stride, t);
323 if (dy) vp56_edge_filter(s, yuv + stride*(10-dy), stride, 1, t); 308 if (dy) s->vp56dsp.edge_filter_ver(yuv + stride*(10-dy), stride, t);
324 } 309 }
325 310
326 static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, 311 static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src,
327 int stride, int x, int y) 312 int stride, int x, int y)
328 { 313 {
663 avctx->pix_fmt = has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P; 648 avctx->pix_fmt = has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P;
664 649
665 if (avctx->idct_algo == FF_IDCT_AUTO) 650 if (avctx->idct_algo == FF_IDCT_AUTO)
666 avctx->idct_algo = FF_IDCT_VP3; 651 avctx->idct_algo = FF_IDCT_VP3;
667 dsputil_init(&s->dsp, avctx); 652 dsputil_init(&s->dsp, avctx);
653 ff_vp56dsp_init(&s->vp56dsp, avctx->codec->id);
668 ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct); 654 ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct);
669 655
670 for (i=0; i<4; i++) 656 for (i=0; i<4; i++)
671 s->framep[i] = &s->frames[i]; 657 s->framep[i] = &s->frames[i];
672 s->framep[VP56_FRAME_UNUSED] = s->framep[VP56_FRAME_GOLDEN]; 658 s->framep[VP56_FRAME_UNUSED] = s->framep[VP56_FRAME_GOLDEN];