]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mpegvideo: Factor ff_mpv_decode_init() out
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 5 Sep 2014 14:57:57 +0000 (16:57 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 5 Sep 2014 18:48:06 +0000 (20:48 +0200)
Reviewed-by: Benoit Fouet <benoit.fouet@free.fr>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/h261dec.c
libavcodec/h263dec.c
libavcodec/mpeg12dec.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h
libavcodec/rv10.c
libavcodec/rv34.c

index a8aae6ed39e7ce05bd3e16f3386df391ecacb924..ead81fce81c52c84ac5b6dfdca7a6ccd8ae0298b 100644 (file)
@@ -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);
index 9f5500dbab1dbc31320cdf7515a9e1285ec466f5..b39a63bfa9400a8c5d464bef6d2e0a69d7b41dc8 100644 (file)
@@ -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;
index 40aad165da0c44fdd19f4979c1bc1a9d5ff4a96e..ed3490b1baa746b5d665c7ebb762eab82efa2bf2 100644 (file)
@@ -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. */
index 85cb41da92e29623ebcc084538e7810fb41dc9b7..f5306cb3b276df923fe7046ee6f77dc27f314f2f 100644 (file)
@@ -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;
index fa20665f8935c903e7ea4b9a1312a5099442a5a6..87fe87ff99ca94df72122cb20baf45854c0096ae 100644 (file)
@@ -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);
 
index 4a5cf414966df569295509eb252d47aaf2e1d9ed..7097b29d5ef8b669e19b6b0ea6b37ff6c5cb30d3 100644 (file)
@@ -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;
index c8aa6b6738782393f262d49790078439eae4d160..a232ab259302ea1e00dbc6f49d3eded5d3219016 100644 (file)
@@ -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;