diff options
Diffstat (limited to 'libavutil/internal.h')
-rw-r--r-- | libavutil/internal.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h index b5cc2a6cd1..51bf40936e 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -37,6 +37,7 @@ #include "config.h" #include "attributes.h" #include "timer.h" +#include "cpu.h" #ifndef attribute_align_arg #if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2) @@ -222,4 +223,19 @@ # define ONLY_IF_THREADS_ENABLED(x) NULL #endif +#if HAVE_MMX +/** + * Empty mmx state. + * this must be called between any dsp function and float/double code. + * for example sin(); dsp->idct_put(); emms_c(); cos() + */ +static av_always_inline void emms_c(void) +{ + if(av_get_cpu_flags() & AV_CPU_FLAG_MMX) + __asm__ volatile ("emms" ::: "memory"); +} +#else /* HAVE_MMX */ +#define emms_c() +#endif /* HAVE_MMX */ + #endif /* AVUTIL_INTERNAL_H */ |