mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
avcodec/snowdec: fix mconly
Fixes non repeatable checksums This also avoids allocating the mc only buffer when its not used Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -540,7 +540,7 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) {
|
||||
int plane_index, level, orientation;
|
||||
|
||||
if(!s->scratchbuf) {
|
||||
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->current_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE))
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
|
||||
@@ -605,14 +605,16 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||
if ((res = decode_header(s)) < 0)
|
||||
return res;
|
||||
|
||||
if (!s->mconly_picture->data[0]) {
|
||||
if (avctx->debug & 2048) {
|
||||
av_frame_unref(s->mconly_picture);
|
||||
res = ff_get_buffer(avctx, s->mconly_picture, AV_GET_BUFFER_FLAG_REF);
|
||||
if (res < 0)
|
||||
return res;
|
||||
}
|
||||
if (s->mconly_picture->format != avctx->pix_fmt) {
|
||||
|
||||
if (s->current_picture->data[0] && s->current_picture->format != avctx->pix_fmt) {
|
||||
av_log(avctx, AV_LOG_ERROR, "pixel format changed\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if ((res=ff_snow_common_init_after_header(avctx)) < 0)
|
||||
|
||||
Reference in New Issue
Block a user