[FFmpeg-cvslog] avcodec/av1dec: add a reference to the raw frame header to AV1Frames

James Almer git at videolan.org
Fri Nov 13 15:40:52 EET 2020


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Nov 12 16:59:37 2020 -0300| [f5517be32a5928b669df57fe91cfa2a2c03f0ba4] | committer: James Almer

avcodec/av1dec: add a reference to the raw frame header to AV1Frames

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f5517be32a5928b669df57fe91cfa2a2c03f0ba4
---

 libavcodec/av1dec.c | 14 ++++++++++++++
 libavcodec/av1dec.h |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index ad8e7d1dd5..84c9ca93d5 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -442,6 +442,8 @@ static void av1_frame_unref(AVCodecContext *avctx, AV1Frame *f)
     ff_thread_release_buffer(avctx, &f->tf);
     av_buffer_unref(&f->hwaccel_priv_buf);
     f->hwaccel_picture_private = NULL;
+    av_buffer_unref(&f->header_ref);
+    f->raw_frame_header = NULL;
     f->spatial_id = f->temporal_id = 0;
     f->order_hint = 0;
     memset(f->skip_mode_frame_idx, 0,
@@ -457,6 +459,12 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s
     if (ret < 0)
         return ret;
 
+    dst->header_ref = av_buffer_ref(src->header_ref);
+    if (!dst->header_ref)
+        goto fail;
+
+    dst->raw_frame_header = src->raw_frame_header;
+
     if (src->hwaccel_picture_private) {
         dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
         if (!dst->hwaccel_priv_buf)
@@ -643,6 +651,12 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f)
     AVFrame *frame;
     int ret;
 
+    f->header_ref = av_buffer_ref(s->header_ref);
+    if (!f->header_ref)
+        return AVERROR(ENOMEM);
+
+    f->raw_frame_header = s->raw_frame_header;
+
     ret = update_context_with_frame_header(avctx, header);
     if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "Failed to update context with frame header\n");
diff --git a/libavcodec/av1dec.h b/libavcodec/av1dec.h
index bed9376a36..533ca2b30f 100644
--- a/libavcodec/av1dec.h
+++ b/libavcodec/av1dec.h
@@ -36,6 +36,9 @@ typedef struct AV1Frame {
     AVBufferRef *hwaccel_priv_buf;
     void *hwaccel_picture_private;
 
+    AVBufferRef *header_ref;
+    AV1RawFrameHeader *raw_frame_header;
+
     int temporal_id;
     int spatial_id;
 



More information about the ffmpeg-cvslog mailing list