diff options
author | Diego Biurrun <diego@biurrun.de> | 2012-09-05 16:42:57 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2012-09-11 10:12:17 +0200 |
commit | 1648a508fabcbdcefd091fcd7c324ba973437858 (patch) | |
tree | 0f919c946ea9b2dcb7684f35a23bf1236b988b17 | |
parent | 0e8dccb79b4ecb0dfcba731bf6db75a08cfc4a7b (diff) | |
download | ffmpeg-1648a508fabcbdcefd091fcd7c324ba973437858.tar.gz |
x86: dsputil: Move specific optimization settings out of global init function
They belong in the init functions specific to each CPU capability.
-rw-r--r-- | libavcodec/x86/dsputil_mmx.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index f3ee342d72..136a5b1ee3 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2589,6 +2589,21 @@ static void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, int mm_flags) SET_HPEL_FUNCS(put_no_rnd, 1, 8, mmx); SET_HPEL_FUNCS(avg, 1, 8, mmx); SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx); + + switch (avctx->idct_algo) { + case FF_IDCT_AUTO: + case FF_IDCT_SIMPLEMMX: + c->idct_put = ff_simple_idct_put_mmx; + c->idct_add = ff_simple_idct_add_mmx; + c->idct = ff_simple_idct_mmx; + c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; + break; + case FF_IDCT_XVIDMMX: + c->idct_put = ff_idct_xvid_mmx_put; + c->idct_add = ff_idct_xvid_mmx_add; + c->idct = ff_idct_xvid_mmx; + break; + } } #if ARCH_X86_32 || !HAVE_YASM @@ -2656,6 +2671,12 @@ static void dsputil_init_mmx2(DSPContext *c, AVCodecContext *avctx, } } + if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX) { + c->idct_put = ff_idct_xvid_mmx2_put; + c->idct_add = ff_idct_xvid_mmx2_add; + c->idct = ff_idct_xvid_mmx2; + } + if (CONFIG_VP3_DECODER && (avctx->codec_id == AV_CODEC_ID_VP3 || avctx->codec_id == AV_CODEC_ID_THEORA)) { c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_exact_mmx2; @@ -2885,6 +2906,13 @@ static void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx, H264_QPEL_FUNCS(3, 2, sse2); H264_QPEL_FUNCS(3, 3, sse2); } + + if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX) { + c->idct_put = ff_idct_xvid_sse2_put; + c->idct_add = ff_idct_xvid_sse2_add; + c->idct = ff_idct_xvid_sse2; + c->idct_permutation_type = FF_SSE2_IDCT_PERM; + } #endif /* HAVE_INLINE_ASM */ #if HAVE_YASM @@ -3011,37 +3039,8 @@ void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx) c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov; #endif - if (mm_flags & AV_CPU_FLAG_MMX) { -#if HAVE_INLINE_ASM - const int idct_algo = avctx->idct_algo; - - if (avctx->bits_per_raw_sample <= 8) { - if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) { - c->idct_put = ff_simple_idct_put_mmx; - c->idct_add = ff_simple_idct_add_mmx; - c->idct = ff_simple_idct_mmx; - c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; - } else if (idct_algo == FF_IDCT_XVIDMMX) { - if (mm_flags & AV_CPU_FLAG_SSE2) { - c->idct_put = ff_idct_xvid_sse2_put; - c->idct_add = ff_idct_xvid_sse2_add; - c->idct = ff_idct_xvid_sse2; - c->idct_permutation_type = FF_SSE2_IDCT_PERM; - } else if (mm_flags & AV_CPU_FLAG_MMXEXT) { - c->idct_put = ff_idct_xvid_mmx2_put; - c->idct_add = ff_idct_xvid_mmx2_add; - c->idct = ff_idct_xvid_mmx2; - } else { - c->idct_put = ff_idct_xvid_mmx_put; - c->idct_add = ff_idct_xvid_mmx_add; - c->idct = ff_idct_xvid_mmx; - } - } - } -#endif /* HAVE_INLINE_ASM */ - + if (mm_flags & AV_CPU_FLAG_MMX) dsputil_init_mmx(c, avctx, mm_flags); - } if (mm_flags & AV_CPU_FLAG_MMXEXT) dsputil_init_mmx2(c, avctx, mm_flags); |