frame->key_frame = s->key_frame;
frame->pict_type = s->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
+ if (!s->key_frame) {
+ if (!s->prev_frame->data[0]) {
+ av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
if (header) {
if (avctx->codec_tag == MKTAG('A', 'G', 'M', '0') ||
avctx->codec_tag == MKTAG('A', 'G', 'M', '1'))
else
ret = decode_intra(avctx, gb, frame);
} else {
- if (!s->prev_frame->data[0]) {
- av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n");
- return AVERROR_INVALIDDATA;
- }
if (s->prev_frame-> width != frame->width ||
s->prev_frame->height != frame->height)
return AVERROR_INVALIDDATA;