summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <[email protected]>2024-04-19 15:11:16 +0200
committerAndreas Rheinhardt <[email protected]>2024-04-21 16:31:42 +0200
commit0ec886ddc79c491fe27ad64b31d50d436a72de70 (patch)
tree560db62c7cfac5a00abc7bec987d2d1e5e511551
parent1d17d84b7d564228629d78c1c510de467662c5bc (diff)
avcodec/hevcdec: Use union for AVFrame* and ProgressFrame
It avoids having to sync ProgressFrame.f and the pointer typically used to access the AVFrame. Signed-off-by: Andreas Rheinhardt <[email protected]>
-rw-r--r--libavcodec/hevc_refs.c2
-rw-r--r--libavcodec/hevcdec.c1
-rw-r--r--libavcodec/hevcdec.h8
3 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index 192d311696..8da9ec982a 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -34,7 +34,6 @@ void ff_hevc_unref_frame(HEVCFrame *frame, int flags)
frame->flags &= ~flags;
if (!frame->flags) {
ff_progress_frame_unref(&frame->tf);
- frame->frame = NULL;
av_frame_unref(frame->frame_grain);
frame->needs_fg = 0;
@@ -87,7 +86,6 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
AV_GET_BUFFER_FLAG_REF);
if (ret < 0)
return NULL;
- frame->frame = frame->tf.f;
frame->rpl = ff_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
if (!frame->rpl)
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 1974bf9cb3..50433957f7 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -3418,7 +3418,6 @@ static int hevc_ref_frame(HEVCFrame *dst, HEVCFrame *src)
int ret;
ff_progress_frame_ref(&dst->tf, &src->tf);
- dst->frame = dst->tf.f;
if (src->needs_fg) {
ret = av_frame_ref(dst->frame_grain, src->frame_grain);
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 24fcbf440a..e82daf6679 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -352,9 +352,13 @@ typedef struct DBParams {
#define HEVC_SEQUENCE_COUNTER_INVALID (HEVC_SEQUENCE_COUNTER_MASK + 1)
typedef struct HEVCFrame {
- AVFrame *frame;
+ union {
+ struct {
+ AVFrame *frame;
+ };
+ ProgressFrame tf;
+ };
AVFrame *frame_grain;
- ProgressFrame tf;
int needs_fg; /* 1 if grain needs to be applied by the decoder */
MvField *tab_mvf; ///< RefStruct reference
RefPicList *refPicList;