AVCodecContext->sw_pix_fmt is used to hold the software pixel format.
Co-authored-by: Frank Plowman <[email protected]>
---
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
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".