diff options
-rw-r--r-- | libavcodec/h261dec.c | 7 | ||||
-rw-r--r-- | libavcodec/h263dec.c | 6 | ||||
-rw-r--r-- | libavcodec/mpeg12dec.c | 3 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 12 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 1 | ||||
-rw-r--r-- | libavcodec/rv10.c | 3 | ||||
-rw-r--r-- | libavcodec/rv34.c | 7 |
7 files changed, 20 insertions, 19 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index a8aae6ed39..ead81fce81 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -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); diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 9f5500dbab..b39a63bfa9 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -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; diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 40aad165da..ed3490b1ba 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -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. */ diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 85cb41da92..f5306cb3b2 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -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; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index fa20665f89..87fe87ff99 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -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); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 4a5cf41496..7097b29d5e 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -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; diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index c8aa6b6738..a232ab2593 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -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; |