[FFmpeg-devel] [PATCH] lavfi/overlay: switch to filter_frame API

Nicolas George nicolas.george at normalesup.org
Wed Dec 19 10:43:49 CET 2012


Le quintidi 25 frimaire, an CCXXI, Stefano Sabatini a écrit :
> > This is more an RFC than a patch, also if Nicolas or someone else
> > wants to work on it that's welcome.

Sorry for the delay, I have been rather busy.

> >From 0a69dbea43dd63bdadb6ded7cb6c501efb68d46e Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefasab at gmail.com>
> Date: Sat, 8 Dec 2012 15:15:20 +0100
> Subject: [PATCH] lavfi/overlay: switch to filter_frame API
> 
> ---
>  libavfilter/vf_overlay.c |  131 ++++++++++------------------------------------
>  1 file changed, 29 insertions(+), 102 deletions(-)
> 
> diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
> index 33db9ef..23f4e79 100644
> --- a/libavfilter/vf_overlay.c
> +++ b/libavfilter/vf_overlay.c
> @@ -294,22 +294,22 @@ static int config_output(AVFilterLink *outlink)
>  // ((((x) + (y)) << 8) - ((x) + (y)) - (y) * (x)) is a faster version of: 255 * (x + y)
>  #define UNPREMULTIPLY_ALPHA(x, y) ((((x) << 16) - ((x) << 9) + (x)) / ((((x) + (y)) << 8) - ((x) + (y)) - (y) * (x)))
>  
> -static void blend_slice(AVFilterContext *ctx,
> +/**
> + * Blend image in src to destination buffer dst at position (x, y).
> + *
> + * It is assumed that the src image at position (x, y) is contained in
> + * dst.
> + */
> +static void blend_image(AVFilterContext *ctx,
>                          AVFilterBufferRef *dst, AVFilterBufferRef *src,
> -                        int x, int y, int w, int h,
> -                        int slice_y, int slice_w, int slice_h)
> +                        int x, int y)
>  {
>      OverlayContext *over = ctx->priv;
>      int i, j, k;
> -    int width, height;
> -    int overlay_end_y = y+h;
> -    int slice_end_y = slice_y+slice_h;
> -    int end_y, start_y;
> -
> -    width = FFMIN(slice_w - x, w);
> -    end_y = FFMIN(slice_end_y, overlay_end_y);
> -    start_y = FFMAX(y, slice_y);
> -    height = end_y - start_y;
> +    int width   = src->video->w;

> +    int start_y = y;
> +    int end_y   = y + src->video->h;
> +    int height  = end_y - start_y;

height = src->video->h?

The rest looks right, thanks for the effort.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121219/dc314c39/attachment.asc>


More information about the ffmpeg-devel mailing list