aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-19 05:42:29 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-24 20:58:21 +0100
commit8ee071122806724a00eecb6b1eff639890c4be48 (patch)
tree060b24e806f898344537e161c9f25fca2ccf5d2c /libswscale
parent64ed1d40df82949114ca5c4cbf33858ae94cc7f9 (diff)
downloadffmpeg-8ee071122806724a00eecb6b1eff639890c4be48.tar.gz
swscale/utils: Don't allocate AVFrames for slice contexts
Only the parent context's AVFrames are ever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/utils.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index c6fa07f752..053c6bb76b 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1317,11 +1317,6 @@ static int context_init_threaded(SwsContext *c,
}
}
- c->frame_src = av_frame_alloc();
- c->frame_dst = av_frame_alloc();
- if (!c->frame_src || !c->frame_dst)
- return AVERROR(ENOMEM);
-
return 0;
}
@@ -1581,11 +1576,6 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter,
if (!FF_ALLOCZ_TYPED_ARRAY(c->formatConvBuffer, FFALIGN(srcW * 2 + 78, 16) * 2))
goto nomem;
- c->frame_src = av_frame_alloc();
- c->frame_dst = av_frame_alloc();
- if (!c->frame_src || !c->frame_dst)
- goto nomem;
-
c->srcBpc = desc_src->comp[0].depth;
if (c->srcBpc < 8)
c->srcBpc = 8;
@@ -2055,6 +2045,11 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
{
int ret;
+ c->frame_src = av_frame_alloc();
+ c->frame_dst = av_frame_alloc();
+ if (!c->frame_src || !c->frame_dst)
+ return AVERROR(ENOMEM);
+
if (c->nb_threads != 1) {
ret = context_init_threaded(c, srcFilter, dstFilter);
if (ret < 0 || c->nb_threads > 1)