aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-15 02:08:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-15 02:25:14 +0200
commit2fd87a3d7895ce36e558a306d03e33697d456086 (patch)
tree99a9b5ef8a07475a55d89050993a0071e9ea4008
parent8b6cbc3c3319f7942d679d6f6319971c102cfbd3 (diff)
parent998c9f15d1ca8c7489775ebcca51623b915988f1 (diff)
downloadffmpeg-2fd87a3d7895ce36e558a306d03e33697d456086.tar.gz
Merge commit '998c9f15d1ca8c7489775ebcca51623b915988f1'
* commit '998c9f15d1ca8c7489775ebcca51623b915988f1': idct: remove call to ff_idctdsp_init from ff_MPV_common_init Conflicts: libavcodec/dnxhdenc.c libavcodec/h263dec.c libavcodec/mpegvideo.c libavcodec/mpegvideo.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/dnxhdenc.c3
-rw-r--r--libavcodec/h261dec.c4
-rw-r--r--libavcodec/h263dec.c8
-rw-r--r--libavcodec/mpeg12dec.c12
-rw-r--r--libavcodec/mpeg4videodec.c2
-rw-r--r--libavcodec/mpegvideo.c15
-rw-r--r--libavcodec/mpegvideo.h2
-rw-r--r--libavcodec/mpegvideo_enc.c1
-rw-r--r--libavcodec/rv10.c1
-rw-r--r--libavcodec/rv34.c2
10 files changed, 32 insertions, 18 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 3ad625352a..3388f51e25 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -324,10 +324,9 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
ff_blockdsp_init(&ctx->bdsp, avctx);
ff_fdctdsp_init(&ctx->m.fdsp, avctx);
- ff_idctdsp_init(&ctx->m.idsp, avctx);
+ ff_mpv_idct_init(&ctx->m);
ff_mpegvideoencdsp_init(&ctx->m.mpvencdsp, avctx);
ff_pixblockdsp_init(&ctx->m.pdsp, avctx);
- ff_dct_common_init(&ctx->m);
ff_dct_encode_init(&ctx->m);
if (!ctx->m.dct_quantize)
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 7e63f29492..9c46f2de23 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -590,10 +590,12 @@ static int h261_decode_frame(AVCodecContext *avctx, void *data,
retry:
init_get_bits(&s->gb, buf, buf_size * 8);
- if (!s->context_initialized)
+ if (!s->context_initialized) {
// we need the IDCT permutaton for reading a custom matrix
+ ff_mpv_idct_init(s);
if (ff_MPV_common_init(s) < 0)
return -1;
+ }
ret = h261_decode_picture_header(h);
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 31ec642e9f..74e4be43a1 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -121,9 +121,11 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
/* for h263, we allocate the images after having read the header */
if (avctx->codec->id != AV_CODEC_ID_H263 &&
avctx->codec->id != AV_CODEC_ID_H263P &&
- avctx->codec->id != AV_CODEC_ID_MPEG4)
+ avctx->codec->id != AV_CODEC_ID_MPEG4) {
+ ff_mpv_idct_init(s);
if ((ret = ff_MPV_common_init(s)) < 0)
return ret;
+ }
ff_h263dsp_init(&s->h263dsp);
ff_qpeldsp_init(&s->qdsp);
@@ -454,10 +456,12 @@ retry:
if (ret < 0)
return ret;
- if (!s->context_initialized)
+ if (!s->context_initialized) {
// we need the idct permutaton for reading a custom matrix
+ ff_mpv_idct_init(s);
if ((ret = ff_MPV_common_init(s)) < 0)
return ret;
+ }
/* We need to set current_picture_ptr before reading the header,
* otherwise we cannot store anyting in there */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 85bb7b0705..1f2bf50a5b 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1118,18 +1118,16 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
{
Mpeg1Context *s = avctx->priv_data;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
- int i;
-
- /* we need some permutation to store matrices,
- * until MPV_common_init() sets the real permutation. */
- for (i = 0; i < 64; i++)
- s2->idsp.idct_permutation[i] = i;
ff_MPV_decode_defaults(s2);
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. */
+ ff_mpv_idct_init(s2);
ff_mpeg12_common_init(&s->mpeg_enc_ctx);
ff_mpeg12_init_vlcs();
@@ -1359,6 +1357,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
* if DCT permutation is changed. */
memcpy(old_permutation, s->idsp.idct_permutation, 64 * sizeof(uint8_t));
+ ff_mpv_idct_init(s);
if (ff_MPV_common_init(s) < 0)
return -2;
@@ -2187,6 +2186,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
avctx->pix_fmt = mpeg_get_pixelformat(avctx);
setup_hwaccel_for_pixfmt(avctx);
+ ff_mpv_idct_init(s);
if (ff_MPV_common_init(s) < 0)
return -1;
s1->mpeg_enc_ctx_allocated = 1;
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 021f2c5ac6..56661b4203 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2215,7 +2215,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
avctx->idct_algo == FF_IDCT_AUTO &&
(av_get_cpu_flags() & AV_CPU_FLAG_MMX)) {
avctx->idct_algo = FF_IDCT_XVID;
- ff_dct_common_init(s);
+ ff_mpv_idct_init(s);
return 1;
}
#endif
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 4672359d71..f6b9a04094 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -377,12 +377,11 @@ static void gray8(uint8_t *dst, const uint8_t *src, ptrdiff_t linesize, int h)
}
/* init common dct for both encoder and decoder */
-av_cold int ff_dct_common_init(MpegEncContext *s)
+static av_cold int dct_init(MpegEncContext *s)
{
ff_blockdsp_init(&s->bdsp, s->avctx);
ff_h264chroma_init(&s->h264chroma, 8); //for lowres
ff_hpeldsp_init(&s->hdsp, s->avctx->flags);
- ff_idctdsp_init(&s->idsp, s->avctx);
ff_me_cmp_init(&s->mecc, s->avctx);
ff_mpegvideodsp_init(&s->mdsp);
ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);
@@ -421,6 +420,13 @@ av_cold int ff_dct_common_init(MpegEncContext *s)
if (ARCH_X86)
ff_MPV_common_init_x86(s);
+ return 0;
+}
+
+av_cold void ff_mpv_idct_init(MpegEncContext *s)
+{
+ ff_idctdsp_init(&s->idsp, s->avctx);
+
/* load & permutate scantables
* note: only wmv uses different ones
*/
@@ -433,8 +439,6 @@ av_cold int ff_dct_common_init(MpegEncContext *s)
}
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
-
- return 0;
}
static int frame_size_alloc(MpegEncContext *s, int linesize)
@@ -959,6 +963,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst,
if (s1->context_initialized){
// s->picture_range_start += MAX_PICTURE_COUNT;
// s->picture_range_end += MAX_PICTURE_COUNT;
+ ff_mpv_idct_init(s);
if((ret = ff_MPV_common_init(s)) < 0){
memset(s, 0, sizeof(MpegEncContext));
s->avctx = dst;
@@ -1302,7 +1307,7 @@ av_cold int ff_MPV_common_init(MpegEncContext *s)
av_image_check_size(s->width, s->height, 0, s->avctx))
return -1;
- ff_dct_common_init(s);
+ dct_init(s);
s->flags = s->avctx->flags;
s->flags2 = s->avctx->flags2;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 2e819c03dd..6a27a55723 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -751,7 +751,7 @@ void ff_MPV_report_decode_progress(MpegEncContext *s);
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src);
void ff_set_qscale(MpegEncContext * s, int qscale);
-int ff_dct_common_init(MpegEncContext *s);
+void ff_mpv_idct_init(MpegEncContext *s);
int ff_dct_encode_init(MpegEncContext *s);
void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64],
const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra);
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index eefde7aaa7..774e235dd4 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -837,6 +837,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
s->alternate_scan);
/* init */
+ ff_mpv_idct_init(s);
if (ff_MPV_common_init(s) < 0)
return -1;
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index be6ca84dc3..985644d7f7 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -517,6 +517,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ ff_mpv_idct_init(s);
if ((ret = ff_MPV_common_init(s)) < 0)
return ret;
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index d82b41e2a0..19e4ce024b 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1502,6 +1502,7 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
avctx->has_b_frames = 1;
s->low_delay = 0;
+ ff_mpv_idct_init(s);
if ((ret = ff_MPV_common_init(s)) < 0)
return ret;
@@ -1538,6 +1539,7 @@ int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx)
if (avctx->internal->is_copy) {
r->tmp_b_block_base = NULL;
+ ff_mpv_idct_init(&r->s);
if ((err = ff_MPV_common_init(&r->s)) < 0)
return err;
if ((err = rv34_decoder_alloc(r)) < 0) {