diff options
author | James Almer <jamrial@gmail.com> | 2020-09-09 19:14:01 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-09-12 13:10:16 -0300 |
commit | 9c6026bc72905d40b6628fdbecba35bb1aceb8ce (patch) | |
tree | 82cb66de3924e8dc8e5ddf074cc71db54640c608 /libavcodec | |
parent | b80c66bb6b23334666dbbb7b132fa5d49523d461 (diff) | |
download | ffmpeg-9c6026bc72905d40b6628fdbecba35bb1aceb8ce.tar.gz |
avcodec/av1dec: update reference frame state on show_existing_frame
As defined in Section 7.4
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/av1dec.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index b39a509f31..4a419d69d6 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -580,15 +580,9 @@ static int set_output_frame(AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt, int *got_frame) { AV1DecContext *s = avctx->priv_data; - const AV1RawFrameHeader *header = s->raw_frame_header; - const AVFrame *srcframe; + const AVFrame *srcframe = s->cur_frame.tf.f; int ret; - if (header->show_existing_frame) - srcframe = s->ref[header->frame_to_show_map_idx].tf.f; - else - srcframe = s->cur_frame.tf.f; - ret = av_frame_ref(frame, srcframe); if (ret < 0) return ret; @@ -733,6 +727,22 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame, s->raw_frame_header = &obu->obu.frame_header; if (s->raw_frame_header->show_existing_frame) { + if (s->cur_frame.tf.f->buf[0]) + av1_frame_unref(avctx, &s->cur_frame); + + ret = av1_frame_ref(avctx, &s->cur_frame, + &s->ref[s->raw_frame_header->frame_to_show_map_idx]); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to get reference frame.\n"); + goto end; + } + + ret = update_reference_list(avctx); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to update reference list.\n"); + goto end; + } + ret = set_output_frame(avctx, frame, pkt, got_frame); if (ret < 0) av_log(avctx, AV_LOG_ERROR, "Set output frame error.\n"); |