[FFmpeg-devel] [RFC] How to fix DR+lavfi+vflip crash

Stefano Sabatini stefano.sabatini-lala
Fri Dec 17 12:07:50 CET 2010

On date Wednesday 2010-12-15 13:22:24 +0100, Michael Niedermayer encoded:
> On Tue, Dec 14, 2010 at 11:17:47PM +0100, Stefano Sabatini wrote:
> > Have another look at my last patch. You see that most code is in the
> > vflip draw_slice() function. Now avfilter_draw_slice() has similar
> > code which copies the input slice to the output slice when this is
> > required for permission reasons.
> > 
> > Now we could try to move the vflipping code to
> > avfilter_draw_slice(). Now this is a problem because this way
> > avfilter_draw_slice() has to know *when* to vflip the frame, which is
> > not required when the code is in the vflip filter.
> the permission code in start_frame needs 1 line to be added for the current
> copying code in draw_slice to copy the frame.
> i dont understand the rest of your convoluted ideas.
> 1. We need copying code if buffer permissions differ, this exists and i assume
>    it works, if it doesnt work it needs to be fixed
> 2. We need to copy if we have a negative linesize and a filter not supporting
>    it
> i see nothing in your mails which would even hint on why the permission copy
> could not handle the case where linesizes differ

You're confusing different problems.

Here there is a list of some of the lavfi features related to the
linesize sign invertion:

1) having a filter only accept a buffer with non-negative linesizes in
   get_video_buffer() (can be done if you don't set
   AV_PERM_NEG_LINESIZES in perms, check ffplay.c)

2) having a filter reject a buffer with positive linesizes in
   start_frame(), and copy it to a newly allocated buffer (can be done
   using again the permission system, check the posls test filter)

3) having a filter explicitely request a buffer with negative
   linesizes in get_video_buffer() (cannot be done, it may be done
   adding another AV_PERM_POS_LINESIZES flag and changing the
   semantics of AV_PERM_NEG_LINESIZES, but I don't think we want this

4) having a filter reject a buffer with negative linesizes in
   start_frame(), and copy it to a newly allocated buffer (cannot be
   done, see above)

5) vflipping an image in vflip

Note that 1) and 2) are already implemented in my patch, but vflipping
from a buffer to another one *can't be done with linesizes invertion
FFmpeg = Freak and Fundamental Murdering Portable Everlasting Gargoyle

More information about the ffmpeg-devel mailing list