1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

lavc/snow: only allocate mconly_picture for decoding

It is not used in the encoder.
This commit is contained in:
Anton Khirnov 2022-03-23 16:15:06 +01:00
parent cd78d5bba9
commit a4ce370659

View File

@ -513,16 +513,20 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) {
int ret, emu_buf_size; int ret, emu_buf_size;
if(!s->scratchbuf) { if(!s->scratchbuf) {
if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, if (av_codec_is_decoder(avctx->codec)) {
AV_GET_BUFFER_FLAG_REF)) < 0) if ((ret = ff_get_buffer(s->avctx, s->mconly_picture,
return ret; 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); 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) || 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)) !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size))
return AVERROR(ENOMEM); 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"); av_log(avctx, AV_LOG_ERROR, "pixel format changed\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }