1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avcodec/mpegvideo: Don't set [bf]_code for non-MPEG-4 decoders

It is only used by encoders and the MPEG-4 decoder.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-25 04:22:27 +01:00
parent 8e070e1a75
commit 116fd73143
7 changed files with 7 additions and 13 deletions

View File

@@ -97,8 +97,6 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
if (skip_1stop_8data_bits(&s->gb) < 0) if (skip_1stop_8data_bits(&s->gb) < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
s->f_code = 1;
if (s->ehc_mode) if (s->ehc_mode)
s->avctx->sample_aspect_ratio= (AVRational){1,2}; s->avctx->sample_aspect_ratio= (AVRational){1,2};

View File

@@ -118,7 +118,6 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
/* PEI */ /* PEI */
if (skip_1stop_8data_bits(&s->gb) < 0) if (skip_1stop_8data_bits(&s->gb) < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
s->f_code = 1;
ff_h263_show_pict_info(s); ff_h263_show_pict_info(s);

View File

@@ -1353,7 +1353,6 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
return -1; return -1;
} }
} }
s->f_code = 1;
if (s->pict_type == AV_PICTURE_TYPE_B) if (s->pict_type == AV_PICTURE_TYPE_B)
s->low_delay = 0; s->low_delay = 0;

View File

@@ -3329,6 +3329,8 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
} }
} }
s->f_code = 1;
s->b_code = 1;
if (ctx->shape != BIN_ONLY_SHAPE) { if (ctx->shape != BIN_ONLY_SHAPE) {
s->chroma_qscale = s->qscale = get_bits(gb, ctx->quant_precision); s->chroma_qscale = s->qscale = get_bits(gb, ctx->quant_precision);
if (s->qscale == 0) { if (s->qscale == 0) {
@@ -3345,8 +3347,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
s->f_code = 1; s->f_code = 1;
return AVERROR_INVALIDDATA; // makes no sense to continue, as there is nothing left from the image then return AVERROR_INVALIDDATA; // makes no sense to continue, as there is nothing left from the image then
} }
} else }
s->f_code = 1;
if (s->pict_type == AV_PICTURE_TYPE_B) { if (s->pict_type == AV_PICTURE_TYPE_B) {
s->b_code = get_bits(gb, 3); s->b_code = get_bits(gb, 3);
@@ -3356,8 +3357,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
s->b_code=1; s->b_code=1;
return AVERROR_INVALIDDATA; // makes no sense to continue, as the MV decoding will break very quickly return AVERROR_INVALIDDATA; // makes no sense to continue, as the MV decoding will break very quickly
} }
} else }
s->b_code = 1;
if (s->avctx->debug & FF_DEBUG_PICT_INFO) { if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
av_log(s->avctx, AV_LOG_DEBUG, av_log(s->avctx, AV_LOG_DEBUG,

View File

@@ -236,9 +236,6 @@ av_cold void ff_mpv_common_defaults(MpegEncContext *s)
s->picture_number = 0; s->picture_number = 0;
s->f_code = 1;
s->b_code = 1;
s->slice_context_count = 1; s->slice_context_count = 1;
} }

View File

@@ -285,6 +285,9 @@ static av_cold void mpv_encode_defaults(MPVMainEncContext *const m)
ff_mpv_common_defaults(&s->c); ff_mpv_common_defaults(&s->c);
s->c.f_code = 1;
s->c.b_code = 1;
if (!m->fcode_tab) { if (!m->fcode_tab) {
m->fcode_tab = default_fcode_tab + MAX_MV; m->fcode_tab = default_fcode_tab + MAX_MV;
ff_thread_once(&init_static_once, mpv_encode_init_static); ff_thread_once(&init_static_once, mpv_encode_init_static);

View File

@@ -150,7 +150,6 @@ static int rv10_decode_picture_header(MpegEncContext *s)
mb_count = s->mb_width * s->mb_height; mb_count = s->mb_width * s->mb_height;
} }
skip_bits(&s->gb, 3); /* ignored */ skip_bits(&s->gb, 3); /* ignored */
s->f_code = 1;
return mb_count; return mb_count;
} }
@@ -284,7 +283,6 @@ static int rv20_decode_picture_header(RVDecContext *rv, int whole_size)
// binary decoder reads 3+2 bits here but they don't seem to be used // binary decoder reads 3+2 bits here but they don't seem to be used
skip_bits(&s->gb, 5); skip_bits(&s->gb, 5);
s->f_code = 1;
s->h263_aic = s->pict_type == AV_PICTURE_TYPE_I; s->h263_aic = s->pict_type == AV_PICTURE_TYPE_I;
s->modified_quant = 1; s->modified_quant = 1;
if (!s->avctx->lowres) if (!s->avctx->lowres)