diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-03-23 16:15:06 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-05-11 10:33:55 +0200 |
commit | a4ce3706595edd9b537861f0e5447e31babf2100 (patch) | |
tree | d85de7a9a15433f827b9344bf15793795c3a5578 /libavcodec | |
parent | cd78d5bba9a61500e65a7d1a69871b25a03df956 (diff) | |
download | ffmpeg-a4ce3706595edd9b537861f0e5447e31babf2100.tar.gz |
lavc/snow: only allocate mconly_picture for decoding
It is not used in the encoder.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/snow.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 0a500695ce..97b0448dbf 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -513,16 +513,20 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { int ret, emu_buf_size; if(!s->scratchbuf) { - if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, - AV_GET_BUFFER_FLAG_REF)) < 0) - return ret; + if (av_codec_is_decoder(avctx->codec)) { + if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, + AV_GET_BUFFER_FLAG_REF)) < 0) + return ret; + } + emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) || !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size)) return AVERROR(ENOMEM); } - if(s->mconly_picture->format != avctx->pix_fmt) { + if (av_codec_is_decoder(avctx->codec) && + s->mconly_picture->format != avctx->pix_fmt) { av_log(avctx, AV_LOG_ERROR, "pixel format changed\n"); return AVERROR_INVALIDDATA; } |