From 940b56a5c68bb9bb888f352b19ba68f1a92db52b Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 25 Mar 2025 07:39:26 +0100 Subject: [PATCH 17/44] avcodec/h263dec: Simplify setting pix_fmt There is no reason to check AVCodecContext.bits_per_raw_sample here, as h263_get_format() does implicitly. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 19029e8d97..28e1cc2101 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -165,7 +165,13 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) /* Defer initializing the context for codecs with in-band dimensions. */ if (init_now) { - avctx->pix_fmt = h263_get_format(avctx); + if (CONFIG_GRAY && (avctx->flags & AV_CODEC_FLAG_GRAY)) { + if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED) + avctx->color_range = AVCOL_RANGE_MPEG; + avctx->pix_fmt = AV_PIX_FMT_GRAY8; + } else + avctx->pix_fmt = AV_PIX_FMT_YUV420P; + if ((ret = ff_mpv_common_init(s)) < 0) return ret; } -- 2.45.2