mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avcodec/mpegvideo: Factor ff_mpv_decode_init() out
Reviewed-by: Benoit Fouet <benoit.fouet@free.fr> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
0b890425e3
commit
4dee4a4470
@ -76,14 +76,11 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
|
||||
|
||||
// set defaults
|
||||
ff_mpv_decode_defaults(s);
|
||||
s->avctx = avctx;
|
||||
s->width = s->avctx->coded_width;
|
||||
s->height = s->avctx->coded_height;
|
||||
s->codec_id = s->avctx->codec->id;
|
||||
ff_mpv_decode_init(s, avctx);
|
||||
|
||||
s->out_format = FMT_H261;
|
||||
s->low_delay = 1;
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
s->codec_id = avctx->codec->id;
|
||||
|
||||
ff_h261_common_init();
|
||||
h261_decode_init_vlc(h);
|
||||
|
@ -48,14 +48,12 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
|
||||
MpegEncContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
s->avctx = avctx;
|
||||
s->out_format = FMT_H263;
|
||||
s->width = avctx->coded_width;
|
||||
s->height = avctx->coded_height;
|
||||
s->workaround_bugs = avctx->workaround_bugs;
|
||||
|
||||
// set defaults
|
||||
ff_mpv_decode_defaults(s);
|
||||
ff_mpv_decode_init(s, avctx);
|
||||
|
||||
s->quant_precision = 5;
|
||||
s->decode_mb = ff_h263_decode_mb;
|
||||
s->low_delay = 1;
|
||||
|
@ -1120,10 +1120,9 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
|
||||
MpegEncContext *s2 = &s->mpeg_enc_ctx;
|
||||
|
||||
ff_mpv_decode_defaults(s2);
|
||||
ff_mpv_decode_init(s2, avctx);
|
||||
|
||||
s->mpeg_enc_ctx.avctx = avctx;
|
||||
s->mpeg_enc_ctx.flags = avctx->flags;
|
||||
s->mpeg_enc_ctx.flags2 = avctx->flags2;
|
||||
|
||||
/* we need some permutation to store matrices,
|
||||
* until the decoder sets the real permutation. */
|
||||
|
@ -1109,6 +1109,18 @@ void ff_mpv_decode_defaults(MpegEncContext *s)
|
||||
ff_mpv_common_defaults(s);
|
||||
}
|
||||
|
||||
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
|
||||
{
|
||||
s->avctx = avctx;
|
||||
s->width = avctx->coded_width;
|
||||
s->height = avctx->coded_height;
|
||||
s->codec_id = avctx->codec->id;
|
||||
s->workaround_bugs = avctx->workaround_bugs;
|
||||
s->flags = avctx->flags;
|
||||
s->flags2 = avctx->flags2;
|
||||
|
||||
}
|
||||
|
||||
static int init_er(MpegEncContext *s)
|
||||
{
|
||||
ERContext *er = &s->er;
|
||||
|
@ -726,6 +726,7 @@ 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_decode_mb(MpegEncContext *s, int16_t block[12][64]);
|
||||
void ff_mpv_report_decode_progress(MpegEncContext *s);
|
||||
|
||||
|
@ -475,10 +475,9 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
|
||||
return ret;
|
||||
|
||||
ff_mpv_decode_defaults(s);
|
||||
ff_mpv_decode_init(s, avctx);
|
||||
|
||||
s->avctx = avctx;
|
||||
s->out_format = FMT_H263;
|
||||
s->codec_id = avctx->codec_id;
|
||||
|
||||
rv->orig_width =
|
||||
s->width = avctx->coded_width;
|
||||
|
@ -1490,14 +1490,9 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
|
||||
int ret;
|
||||
|
||||
ff_mpv_decode_defaults(s);
|
||||
s->avctx = avctx;
|
||||
ff_mpv_decode_init(s, avctx);
|
||||
s->out_format = FMT_H263;
|
||||
s->codec_id = avctx->codec_id;
|
||||
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
|
||||
r->s.avctx = avctx;
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
avctx->has_b_frames = 1;
|
||||
s->low_delay = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user