[FFmpeg-devel] [PATCH] lavfi/framesync: avoid forcing frame writability unnecessarily
Anton Khirnov
anton at khirnov.net
Wed Jul 24 18:17:06 EEST 2024
Callers of ff_framesync_get_frame() generally do not expect the result
to be writable, those that do (e.g. ff_framesync_dualinput_get_writable())
ensure writability themselves.
Significantly reduces memory consumption in complex graphs with
framesync-based filters (e.g. scale, ssim).
Reported-By: Mark Shwartzman
---
libavfilter/framesync.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index 535fbe9c7c..8e06e0e700 100644
--- a/libavfilter/framesync.c
+++ b/libavfilter/framesync.c
@@ -273,7 +273,6 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe,
AVFrame *frame;
unsigned need_copy = 0, i;
int64_t pts_next;
- int ret;
if (!fs->in[in].frame) {
*rframe = NULL;
@@ -291,10 +290,6 @@ int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe,
if (need_copy) {
if (!(frame = av_frame_clone(frame)))
return AVERROR(ENOMEM);
- if ((ret = ff_inlink_make_frame_writable(fs->parent->inputs[in], &frame)) < 0) {
- av_frame_free(&frame);
- return ret;
- }
} else {
fs->in[in].frame = NULL;
}
--
2.43.0
More information about the ffmpeg-devel
mailing list