[FFmpeg-devel] [PATCH 1/2] VP56: move vp56_edge_filter to new VP56DSPContext

Aurelien Jacobs aurel
Fri Apr 30 23:07:48 CEST 2010


On Fri, Apr 23, 2010 at 03:24:33PM +0100, Mans Rullgard wrote:
> 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.

I'm not very fond of macro templates, but the result seems worth it.

> --- /dev/null
> +++ b/libavcodec/vp56dsp.c
> [...]
> +
> +#define VP56_EDGE_FILTER(pfx, suf, pix_inc, line_inc, adjust)           \
> +static void pfx##_edge_filter_##suf(uint8_t *yuv, int stride, int t)    \
> +{                                                                       \
> +    int pix2_inc = 2 * pix_inc;                                         \
> +    int i, v;                                                           \
> +                                                                        \
> +    for (i=0; i<12; i++) {                                              \
> +        v = (yuv[-pix2_inc] + 3*(yuv[0]-yuv[-pix_inc]) - yuv[pix_inc] + 4)>>3;\
> +        v = adjust(v, t);                                               \

Here you may use pfx##_adjust() and simplify the macro by removing its
adjust paramer.

Except this, patch is OK for me.

Aurel



More information about the ffmpeg-devel mailing list