aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-11-12 16:59:37 -0300
committerJames Almer <jamrial@gmail.com>2020-11-13 10:38:18 -0300
commitf5517be32a5928b669df57fe91cfa2a2c03f0ba4 (patch)
treef9dda8411ff8afbe15c2a84387b14bbd7946c822
parent8f4aec719e7c00cd75074ef34d99d2f2f22e622a (diff)
downloadffmpeg-f5517be32a5928b669df57fe91cfa2a2c03f0ba4.tar.gz
avcodec/av1dec: add a reference to the raw frame header to AV1Frames
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavcodec/av1dec.c14
-rw-r--r--libavcodec/av1dec.h3
2 files changed, 17 insertions, 0 deletions
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;