00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "libavutil/cpu.h"
00023 #include "libavutil/x86/asm.h"
00024 #include "libavutil/x86/cpu.h"
00025 #include "libavcodec/avcodec.h"
00026 #include "libavcodec/dsputil.h"
00027 #include "libavcodec/mpegvideo.h"
00028 #include "dsputil_mmx.h"
00029
00030 extern uint16_t ff_inv_zigzag_direct16[64];
00031
00032 #if HAVE_MMX_INLINE
00033 #define COMPILE_TEMPLATE_MMXEXT 0
00034 #define COMPILE_TEMPLATE_SSE2 0
00035 #define COMPILE_TEMPLATE_SSSE3 0
00036 #define RENAME(a) a ## _MMX
00037 #define RENAMEl(a) a ## _mmx
00038 #include "mpegvideoenc_template.c"
00039 #endif
00040
00041 #if HAVE_MMXEXT_INLINE
00042 #undef COMPILE_TEMPLATE_SSSE3
00043 #undef COMPILE_TEMPLATE_SSE2
00044 #undef COMPILE_TEMPLATE_MMXEXT
00045 #define COMPILE_TEMPLATE_MMXEXT 1
00046 #define COMPILE_TEMPLATE_SSE2 0
00047 #define COMPILE_TEMPLATE_SSSE3 0
00048 #undef RENAME
00049 #undef RENAMEl
00050 #define RENAME(a) a ## _MMX2
00051 #define RENAMEl(a) a ## _mmx2
00052 #include "mpegvideoenc_template.c"
00053 #endif
00054
00055 #if HAVE_SSE2_INLINE
00056 #undef COMPILE_TEMPLATE_MMXEXT
00057 #undef COMPILE_TEMPLATE_SSE2
00058 #undef COMPILE_TEMPLATE_SSSE3
00059 #define COMPILE_TEMPLATE_MMXEXT 0
00060 #define COMPILE_TEMPLATE_SSE2 1
00061 #define COMPILE_TEMPLATE_SSSE3 0
00062 #undef RENAME
00063 #undef RENAMEl
00064 #define RENAME(a) a ## _SSE2
00065 #define RENAMEl(a) a ## _sse2
00066 #include "mpegvideoenc_template.c"
00067 #endif
00068
00069 #if HAVE_SSSE3_INLINE
00070 #undef COMPILE_TEMPLATE_MMXEXT
00071 #undef COMPILE_TEMPLATE_SSE2
00072 #undef COMPILE_TEMPLATE_SSSE3
00073 #define COMPILE_TEMPLATE_MMXEXT 0
00074 #define COMPILE_TEMPLATE_SSE2 1
00075 #define COMPILE_TEMPLATE_SSSE3 1
00076 #undef RENAME
00077 #undef RENAMEl
00078 #define RENAME(a) a ## _SSSE3
00079 #define RENAMEl(a) a ## _sse2
00080 #include "mpegvideoenc_template.c"
00081 #endif
00082
00083 void ff_dct_encode_init_x86(MpegEncContext *s)
00084 {
00085 int mm_flags = av_get_cpu_flags();
00086 const int dct_algo = s->avctx->dct_algo;
00087
00088 if (dct_algo == FF_DCT_AUTO || dct_algo == FF_DCT_MMX) {
00089 #if HAVE_MMX_INLINE
00090 if (INLINE_MMX(mm_flags))
00091 s->dct_quantize = dct_quantize_MMX;
00092 #endif
00093 #if HAVE_MMXEXT_INLINE
00094 if (INLINE_MMXEXT(mm_flags))
00095 s->dct_quantize = dct_quantize_MMX2;
00096 #endif
00097 #if HAVE_SSE2_INLINE
00098 if (INLINE_SSE2(mm_flags))
00099 s->dct_quantize = dct_quantize_SSE2;
00100 #endif
00101 #if HAVE_SSSE3_INLINE
00102 if (INLINE_SSSE3(mm_flags))
00103 s->dct_quantize = dct_quantize_SSSE3;
00104 #endif
00105 }
00106 }