[FFmpeg-devel] [PATCH] lavfi: add showspectrum filter.

Nicolas George nicolas.george at normalesup.org
Sun Aug 12 01:06:59 CEST 2012

Le quintidi 25 thermidor, an CCXX, Stefano Sabatini a écrit :
> I don't know why REUSE/REUSE2 were introduced in the first place, my
> interpretation is that they specify permissions used by the *frame
> allocator*, and ignored by filters which don't require special
> treatment with allocated frames. (The exception here may be a video
> sink directly accessing the video memory, but I'm not yet sure about
> which advantages this could have.)

Oh, yes, I see: the get_video_buffer method in vsink_framebuffer would be
able to return part of the video memory in normal circumstances, but would
have to revert to a mallocated buffer if REUSE2 is requested, otherwise a
filter may end up writing in the memory currently displayed and that would
cause tearing.

I have a harder time figuring a practical case for REUSE, but I can conceive
it exists.

> Regarding PRESERVE vs WRITE, I consider them redundant, and I'd
> propose to drop PRESERVE, and simply remove write permissions for
> buffers which shouldn't be written by other filters (on the other hand
> changing API would have the effect of making merges harder).

PRESERVE on top of WRITE would mean that the previous filters, who may still
hold a reference to the same frame with WRITE permissions, do not intend to
use it in the future.

But now that I think of it, once a filter has given write permissions to the
next, writing on the same buffer makes no sense: it would possibly overwrite
the work of the next. So yes, I guess PRESERVE is indeed redundant in
practical circumstances

> If you could update the thread and point to a few cases where we have
> a wrong implementation and/or buggy behavior that may help.

I think I start to see the light, and I will try to come up with a patch
series to clean this up.


  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/20120812/e89f6cfe/attachment.asc>

More information about the ffmpeg-devel mailing list