diff options
author | Janne Grunau <janne-libav@jannau.net> | 2014-01-29 20:36:40 +0400 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2014-01-31 14:09:11 +0400 |
commit | 7716dd9fbbcea2700a100c995df967d5547c2eb9 (patch) | |
tree | a3069f72dcd8221cf66f19e7377d216f9e352b36 /libavcodec/mpeg4videodec.c | |
parent | 78987a88a88b28d93d03ed6c228bcb33f178444f (diff) |
xvid: switch to xvid mmx idct as soon as possible
The idct implementation cannot be changed after the quantization matrices
are read since it use a different permutaion.
Bug-Id: videolan/7411
Diffstat (limited to 'libavcodec/mpeg4videodec.c')
-rw-r--r-- | libavcodec/mpeg4videodec.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 0e4154854c..b6925ac664 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2044,6 +2044,35 @@ static int decode_user_data(Mpeg4DecContext *ctx, GetBitContext *gb) if (e == 1) ctx->xvid_build = build; + if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == -1) { + if (s->stream_codec_tag == AV_RL32("XVID") || + s->codec_tag == AV_RL32("XVID") || + s->codec_tag == AV_RL32("XVIX") || + s->codec_tag == AV_RL32("RMP4") || + s->codec_tag == AV_RL32("ZMP4") || + s->codec_tag == AV_RL32("SIPP")) + ctx->xvid_build = 0; + } + + if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == -1) + if (s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 && + s->vol_control_parameters == 0) + ctx->divx_version = 400; // divx 4 + + if (ctx->xvid_build >= 0 && ctx->divx_version >= 0) { + ctx->divx_version = + ctx->divx_build = -1; + } + +#if HAVE_MMX + if (ctx->xvid_build >= 0 && + s->avctx->idct_algo == FF_IDCT_AUTO && + (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) { + s->avctx->idct_algo = FF_IDCT_XVIDMMX; + ff_dct_common_init(s); + } +#endif + return 0; } @@ -2405,26 +2434,6 @@ end: s->low_delay = 1; s->avctx->has_b_frames = !s->low_delay; - if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == -1) { - if (s->stream_codec_tag == AV_RL32("XVID") || - s->codec_tag == AV_RL32("XVID") || - s->codec_tag == AV_RL32("XVIX") || - s->codec_tag == AV_RL32("RMP4") || - s->codec_tag == AV_RL32("ZMP4") || - s->codec_tag == AV_RL32("SIPP")) - ctx->xvid_build = 0; - } - - if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == -1) - if (s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 && - s->vol_control_parameters == 0) - ctx->divx_version = 400; // divx 4 - - if (ctx->xvid_build >= 0 && ctx->divx_version >= 0) { - ctx->divx_version = - ctx->divx_build = -1; - } - if (s->workaround_bugs & FF_BUG_AUTODETECT) { if (s->codec_tag == AV_RL32("XVIX")) s->workaround_bugs |= FF_BUG_XVID_ILACE; @@ -2475,15 +2484,6 @@ end: s->workaround_bugs |= FF_BUG_HPEL_CHROMA; } -#if HAVE_MMX - if (s->codec_id == AV_CODEC_ID_MPEG4 && ctx->xvid_build >= 0 && - s->avctx->idct_algo == FF_IDCT_AUTO && - (av_get_cpu_flags() & AV_CPU_FLAG_MMX)) { - s->avctx->idct_algo = FF_IDCT_XVIDMMX; - ff_dct_common_init(s); - s->picture_number = 0; - } -#endif if (s->avctx->debug & FF_DEBUG_BUGS) av_log(s->avctx, AV_LOG_DEBUG, |