[FFmpeg-devel] [PATCH] lavu/buffer: reuse AVBufferRef alloction
Anton Khirnov
anton at khirnov.net
Wed Nov 18 15:28:55 EET 2020
Quoting Gil Pedersen (2020-11-18 12:24:09)
> This is an optimization to av_buffer_replace() to avoid a redundant allocation
> when the src and dst are non-NULL.
>
> Instead of doing a unref + ref, the dst buffer is reused and buffer counters
> updated accordingly.
>
> Signed-off-by: Gil Pedersen <git at gpost.dk>
> ---
> libavutil/buffer.c | 26 +++++++++++++++++++-------
> 1 file changed, 19 insertions(+), 7 deletions(-)
Is there a reason to think this optimization has a measurable effect on
performance?
The code that fiddles with buffer internals should ideally be localized
in as few places as possible, your patch is spreading it. I'd like to
hear some arguments for why that is worth it.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list