[FFmpeg-devel] [PATCH] lavfi/kerndeint: use aligned linesizes for the temporary buffer.

Stefano Sabatini stefasab at gmail.com
Sun Jan 6 19:39:20 CET 2013


On date Sunday 2013-01-06 19:34:16 +0100, Clément Bœsch encoded:
> This improves the performances just enough to match mp=kerndeint.
> ---
>  libavfilter/vf_kerndeint.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavfilter/vf_kerndeint.c b/libavfilter/vf_kerndeint.c
> index 382b8a7..a929714 100644
> --- a/libavfilter/vf_kerndeint.c
> +++ b/libavfilter/vf_kerndeint.c
> @@ -102,7 +102,7 @@ static int config_props(AVFilterLink *inlink)
>      kerndeint->vsub = desc->log2_chroma_h;
>  
>      ret = av_image_alloc(kerndeint->tmp_data, kerndeint->tmp_bwidth,
> -                          inlink->w, inlink->h, inlink->format, 1);
> +                          inlink->w, inlink->h, inlink->format, 16);

so now you should rename tmp_bwidth to tmp_linesize.

>      if (ret < 0)
>          return ret;
>      memset(kerndeint->tmp_data[0], 0, ret);
> @@ -157,7 +157,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpic)
>  
>      for (plane = 0; inpic->data[plane] && plane < 4; plane++) {
>          h = plane == 0 ? inlink->h : inlink->h >> kerndeint->vsub;
> -        bwidth = kerndeint->tmp_bwidth[plane];
> +        bwidth = av_image_get_linesize(inlink->format, inlink->w, plane);

Alternatively, compute bwidth in config_props and store it in the
kerndeint context, so you don't have to do it at each iteration.

[...]
-- 
FFmpeg = Fiendish & Faithless Minimal Portable Elitarian God


More information about the ffmpeg-devel mailing list