[FFmpeg-cvslog] lavc/vvcdec: remove unneeded VVCContext->pix_fmt

Nuo Mi git at videolan.org
Wed Jan 29 12:26:11 EET 2025


ffmpeg | branch: master | Nuo Mi <nuomi2021 at gmail.com> | Sun Jan 26 11:10:20 2025 +0800| [974d4a8f0a43baca57104359deb4b08703590135] | committer: Nuo Mi

lavc/vvcdec: remove unneeded VVCContext->pix_fmt

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

Co-authored-by: Frank Plowman <post at frankplowman.com>

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

 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 */



More information about the ffmpeg-cvslog mailing list