From cd304f719a27a5e142659e3bc076d8a67110867e Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 24 Feb 2025 19:05:32 +0100 Subject: [PATCH 20/30] avcodec/vc1: Add max_b_frames field to VC1Context Don't reuse MpegEncContext.max_b_frames, which is supposed to be encoder-only. Signed-off-by: Andreas Rheinhardt --- libavcodec/dxva2_vc1.c | 2 +- libavcodec/mss2.c | 2 +- libavcodec/nvdec_vc1.c | 2 +- libavcodec/vc1.c | 4 ++-- libavcodec/vc1.h | 1 + libavcodec/vdpau_vc1.c | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c index bc9ad9648e..a7b440c0d9 100644 --- a/libavcodec/dxva2_vc1.c +++ b/libavcodec/dxva2_vc1.c @@ -117,7 +117,7 @@ void ff_dxva2_vc1_fill_picture_parameters(AVCodecContext *avctx, (v->multires << 5) | (v->resync_marker << 4) | (v->rangered << 3) | - (s->max_b_frames ); + (v->max_b_frames ); pp->bPicExtrapolation = (!v->interlace || v->fcm == PROGRESSIVE) ? 1 : 2; pp->bPicDeblocked = ((!pp->bPicBackwardPrediction && v->overlap) << 6) | ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) | diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 1888053eb2..74a25b3e55 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -844,7 +844,7 @@ static av_cold int wmv9_init(AVCodecContext *avctx) v->resync_marker = 0; v->rangered = 0; - v->s.max_b_frames = avctx->max_b_frames = 0; + v->max_b_frames = avctx->max_b_frames = 0; v->quantizer_mode = 0; v->finterpflag = 0; diff --git a/libavcodec/nvdec_vc1.c b/libavcodec/nvdec_vc1.c index 0668863cb4..fbfba1ecb4 100644 --- a/libavcodec/nvdec_vc1.c +++ b/libavcodec/nvdec_vc1.c @@ -84,7 +84,7 @@ static int nvdec_vc1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u .multires = v->multires, .syncmarker = v->resync_marker, .rangered = v->rangered, - .maxbframes = s->max_b_frames, + .maxbframes = v->max_b_frames, .panscan_flag = v->panscanflag, .refdist_flag = v->refdist_flag, diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index d263c70be7..dec3e16ea2 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -343,7 +343,7 @@ int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitCo "RANGERED should be set to 0 in Simple Profile\n"); } - v->s.max_b_frames = avctx->max_b_frames = get_bits(gb, 3); //common + v->max_b_frames = avctx->max_b_frames = get_bits(gb, 3); //common v->quantizer_mode = get_bits(gb, 2); //common v->finterpflag = get_bits1(gb); //common @@ -431,7 +431,7 @@ FF_ENABLE_DEPRECATION_WARNINGS av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n"); return -1; } - v->s.max_b_frames = v->s.avctx->max_b_frames = 7; + v->max_b_frames = v->s.avctx->max_b_frames = 7; if (get_bits1(gb)) { //Display Info - decoding is not affected by it int w, h, ar = 0; av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n"); diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index 185236662f..df814405d0 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -222,6 +222,7 @@ typedef struct VC1Context{ int dquant; ///< How qscale varies with MBs, 2 bits (not in Simple) int vstransform; ///< variable-size [48]x[48] transform type + info int overlap; ///< overlapped transforms in use + int max_b_frames; int quantizer_mode; ///< 2 bits, quantizer mode used for sequence, see QUANT_* int finterpflag; ///< INTERPFRM present //@} diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c index d02a454bb8..20208c6dbc 100644 --- a/libavcodec/vdpau_vc1.c +++ b/libavcodec/vdpau_vc1.c @@ -92,7 +92,7 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx, info->multires = v->multires; info->syncmarker = v->resync_marker; info->rangered = v->rangered | (v->rangeredfrm << 1); - info->maxbframes = v->s.max_b_frames; + info->maxbframes = v->max_b_frames; info->deblockEnable = v->postprocflag & 1; info->pquant = v->pq; -- 2.45.2