1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/mpegvideo: Merge ff_mpv_decode_defaults into ff_mpv_decode_init

These two are always called directly after each other (with the
exception of the calls in mpeg_decode_init() where some irrelevant
modifications of the avctx (which could just as well be done before
ff_mpv_decode_defaults(), because it doesn't have a pointer to the
AVCodecContext at all and therefore can't see these modifications at
all) are performed in between), so merge ff_mpv_decode_defaults() in
ff_mpv_decode_init().

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-12-09 03:23:32 +01:00
parent ebbdb928e8
commit 8af82be946
7 changed files with 3 additions and 14 deletions

View File

@ -75,7 +75,6 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
MpegEncContext *const s = &h->s;
// set defaults
ff_mpv_decode_defaults(s);
ff_mpv_decode_init(s, avctx);
s->out_format = FMT_H261;

View File

@ -73,7 +73,6 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
s->out_format = FMT_H263;
// set defaults
ff_mpv_decode_defaults(s);
ff_mpv_decode_init(s, avctx);
s->quant_precision = 5;

View File

@ -1050,8 +1050,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
Mpeg1Context *s = avctx->priv_data;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
ff_mpv_decode_defaults(s2);
if ( avctx->codec_tag != AV_RL32("VCR2")
&& avctx->codec_tag != AV_RL32("BW10"))
avctx->coded_width = avctx->coded_height = 0; // do not trust dimensions from input
@ -3099,7 +3097,6 @@ static av_cold int ipu_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
ff_mpv_decode_defaults(m);
ff_mpv_decode_init(m, avctx);
s->m.avctx = avctx;
ff_mpv_idct_init(m);

View File

@ -660,17 +660,14 @@ void ff_mpv_common_defaults(MpegEncContext *s)
}
/**
* Set the given MpegEncContext to defaults for decoding.
* Initialize the given MpegEncContext for decoding.
* the changed fields will not depend upon
* the prior state of the MpegEncContext.
*/
void ff_mpv_decode_defaults(MpegEncContext *s)
{
ff_mpv_common_defaults(s);
}
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
{
ff_mpv_common_defaults(s);
s->avctx = avctx;
s->width = avctx->coded_width;
s->height = avctx->coded_height;

View File

@ -694,7 +694,6 @@ void ff_mpv_common_init_mips(MpegEncContext *s);
int ff_mpv_common_frame_size_change(MpegEncContext *s);
void ff_mpv_common_end(MpegEncContext *s);
void ff_mpv_decode_defaults(MpegEncContext *s);
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx);
void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64]);
void ff_mpv_report_decode_progress(MpegEncContext *s);

View File

@ -374,7 +374,6 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
avctx->coded_height, 0, avctx)) < 0)
return ret;
ff_mpv_decode_defaults(s);
ff_mpv_decode_init(s, avctx);
s->out_format = FMT_H263;

View File

@ -1487,7 +1487,6 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
MpegEncContext *s = &r->s;
int ret;
ff_mpv_decode_defaults(s);
ff_mpv_decode_init(s, avctx);
s->out_format = FMT_H263;