Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/hevcdec: Use union for AVFrame* and ProgressFrame
Date: Fri, 19 Apr 2024 18:07:31 +0200
Message-ID: <AS8P250MB0744DF6B34770BE83896EF018F0D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB074434FCF48B2095E6D088D48F0D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

It avoids having to sync ProgressFrame.f and the pointer
typically used to access the AVFrame.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/hevc_refs.c | 2 --
 libavcodec/hevcdec.c   | 1 -
 libavcodec/hevcdec.h   | 8 ++++++--
 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;
-- 
2.40.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2024-04-19 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19 15:58 [FFmpeg-devel] [PATCH 1/5] avcodec/progressframe: Explain how unnamed union can simplify accesses Andreas Rheinhardt
2024-04-19 16:07 ` Andreas Rheinhardt [this message]
2024-04-19 16:07 ` [FFmpeg-devel] [PATCH 3/5] avcodec/av1dec: Use ProgressFrames Andreas Rheinhardt
2024-04-20 20:22   ` James Almer
2024-04-19 16:07 ` [FFmpeg-devel] [PATCH 4/5] avcodec/av1dec: Make av1_frame_replace() out of av1_frame_ref() Andreas Rheinhardt
2024-04-19 16:07 ` [FFmpeg-devel] [PATCH 5/5] avcodec/vaapi_av1: Use ProgressFrames Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744DF6B34770BE83896EF018F0D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git