Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Nuo Mi <nuomi2021@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Frank Plowman <post@frankplowman.com>, Nuo Mi <nuomi2021@gmail.com>
Subject: [FFmpeg-devel] [PATCH 2/3] lavc/vvcdec: remove unneeded VVCContext->pix_fmt
Date: Sun, 26 Jan 2025 11:10:20 +0800
Message-ID: <20250126031021.309218-2-nuomi2021@gmail.com> (raw)
In-Reply-To: <20250126031021.309218-1-nuomi2021@gmail.com>

AVCodecContext->sw_pix_fmt is used to hold the software pixel format.

Co-authored-by: Frank Plowman <post@frankplowman.com>
---
 libavcodec/vvc/dec.c | 17 ++++++-----------
 libavcodec/vvc/dec.h |  2 --
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index daf537294f..51dd60ae92 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -799,18 +799,15 @@ static int export_frame_params(VVCContext *s, const VVCFrameContext *fc)
     AVCodecContext *c = s->avctx;
     const VVCSPS *sps = fc->ps.sps;
     const VVCPPS *pps = fc->ps.pps;
-    int ret;
 
-    // Reset HW config if pix_fmt/w/h change.
-    if (s->pix_fmt != sps->pix_fmt || c->coded_width != pps->width || c->coded_height != pps->height) {
+    // Reset the format if pix_fmt/w/h change.
+    if (c->sw_pix_fmt != sps->pix_fmt || c->coded_width != pps->width || c->coded_height != pps->height) {
         c->coded_width  = pps->width;
         c->coded_height = pps->height;
-        ret = get_format(c, sps);
-        if (ret < 0)
-            return ret;
-
-        c->pix_fmt = ret;
-        s->pix_fmt = sps->pix_fmt;
+        c->sw_pix_fmt   = sps->pix_fmt;
+        c->pix_fmt      = get_format(c, sps);
+        if (c->pix_fmt < 0)
+            return AVERROR_INVALIDDATA;
     }
 
     c->width  = pps->width  - ((pps->r->pps_conf_win_left_offset + pps->r->pps_conf_win_right_offset) << sps->hshift[CHROMA]);
@@ -1138,8 +1135,6 @@ static av_cold int vvc_decode_init(AVCodecContext *avctx)
     GDR_SET_RECOVERED(s);
     ff_thread_once(&init_static_once, init_default_scale_m);
 
-    s->pix_fmt = AV_PIX_FMT_NONE;
-
     return 0;
 }
 
diff --git a/libavcodec/vvc/dec.h b/libavcodec/vvc/dec.h
index 382311e3be..6aa3121550 100644
--- a/libavcodec/vvc/dec.h
+++ b/libavcodec/vvc/dec.h
@@ -241,8 +241,6 @@ typedef struct VVCContext {
 
     uint64_t nb_frames;     ///< processed frames
     int nb_delayed;         ///< delayed frames
-
-    enum AVPixelFormat pix_fmt; ///< pix format of current frame
 }  VVCContext ;
 
 #endif /* AVCODEC_VVC_DEC_H */
-- 
2.34.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:[~2025-01-26  3:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-26  3:10 [FFmpeg-devel] [PATCH 1/3] lavc/vvcdec: remove unneeded set_output_format Nuo Mi
2025-01-26  3:10 ` Nuo Mi [this message]
2025-01-27  2:33   ` [FFmpeg-devel] [PATCH 2/3] lavc/vvcdec: remove unneeded VVCContext->pix_fmt Wang, Fei W
2025-01-26  3:10 ` [FFmpeg-devel] [PATCH 3/3] lavc/vvcdec: ensure slices contain nonzero CTUs Nuo Mi
2025-01-29  8:40   ` Frank Plowman
2025-01-29 10:30     ` Nuo Mi

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=20250126031021.309218-2-nuomi2021@gmail.com \
    --to=nuomi2021@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=post@frankplowman.com \
    /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