[FFmpeg-devel] [PATCH] libavfilter-soc: implement pad filter

Stefano Sabatini stefano.sabatini-lala
Sat Jul 25 21:53:38 CEST 2009


On date Sunday 2009-07-19 01:17:09 +0200, Stefano Sabatini encoded:
[...]
> Now I'm posting other patches, what I'd like to discuss are these two
> points:
> 
> * I tried both to put the information required for padding (x, y, h,
>   w, exp_h, exp_w) in the link and pass it in the get_video_buffer()
>   params, they're pretty equivalent but the second method (as in the
>   patch) seems more flexible, as the information is not stored
>   statically in the links, so it doesn't need a reconfiguration when
>   changing it.  (BTW maybe we can as well remove w/h from the link,
>   that should make simpler to implement variable size filters, I still
>   have to experiment with this).

In other words: storing the information in the link is faster if the
padding doesn't chain during the filtering, as we don't have to
re-compute the padding for each frame, on the other hand it needs
reconfiguration of the whole chain if the padding changes (same
consideration is valid for the video frame size, which is currently
stored in the link).

What would be best for us?

> * I tinkered about the vflip problem much time, and I could'nt find some 
>   way to keep the previous behavior with the new system.
>   The new system assumes that the position of the area to pad
>   (referred by the x/y params in the picref) needs to be invariant
>   when passing a picref to the next filter.
>   That's because the pad filter expects this:
>
> static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
> {
>     PadContext *pad = link->dst->priv;
>     AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0);
>     link->dst->outputs[0]->outpic = ref2;
> 
>     ref2->data[0] -=  pad->x             + (pad->y * ref2->linesize[0]);
>     ref2->data[1] -= (pad->x>>pad->hsub) + (pad->y * ref2->linesize[1]>>pad->vsub);
>     ref2->data[2] -= (pad->x>>pad->hsub) + (pad->y * ref2->linesize[2]>>pad->vsub);
>     if (ref2->data[3])
>         ref2->data[3] -= pad->x + pad->y * ref2->linesize[3];
>     ref2->x -= pad->x;
>     ref2->y -= pad->y;
>     ref2->w = pad->out_w;
>     ref2->h = pad->out_h;
> 
>     avfilter_start_frame(link->dst->outputs[0], ref2);
> }
> 
> to work.
> 
> My solution is to change the way the vflip filter works, as in the
> attached patch, which makes it less efficient (indeed it becomes
> necessary to allocate an extra buffer and copy data to it as in the
> hflip filter).
> 
> Please comment on these.

Ping.
-- 
FFmpeg = Fierce & Fundamental Monstrous Programmable Efficient Ghost



More information about the ffmpeg-devel mailing list