summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-09 03:23:32 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-31 12:00:15 +0100
commit8af82be946186921d8391eff3a82815d75b44b99 (patch)
treec2107d290f370b164546498a71191e8ce5e3fced
parentebbdb928e88e160fddedf6eb182503bfefadb37d (diff)
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>
-rw-r--r--libavcodec/h261dec.c1
-rw-r--r--libavcodec/h263dec.c1
-rw-r--r--libavcodec/mpeg12dec.c3
-rw-r--r--libavcodec/mpegvideo.c7
-rw-r--r--libavcodec/mpegvideo.h1
-rw-r--r--libavcodec/rv10.c1
-rw-r--r--libavcodec/rv34.c1
7 files changed, 2 insertions, 13 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 4373a60df4..c6440ba902 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -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;
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 32e26a57de..8b441b2951 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -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;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 7d797c259a..123ede4704 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -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);
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index c28d1adef7..f92792ae98 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -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)
+void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
{
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;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 974c71b6bd..aa84449c2d 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -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);
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index d118515c3b..d5c7480611 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -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;
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 13f9b609e2..f8cc837985 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -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;