Merge commit '4db96649ca700db563d9da4ebe70bf9fc4c7a6ba'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 15 Feb 2013 11:10:08 +0000 (12:10 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 15 Feb 2013 11:10:08 +0000 (12:10 +0100)
* commit '4db96649ca700db563d9da4ebe70bf9fc4c7a6ba':
  avutil: Ensure that emms_c is always defined, even on non-x86
  configure: Move MinGW CPPFLAGS setting to libc section, where it belongs
  avutil: Move emms code to x86-specific header

Conflicts:
configure
libavutil/internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
configure
libavutil/internal.h
libavutil/x86/emms.h

diff --cc configure
+++ b/configure
@@@ -3224,9 -2912,9 +3224,8 @@@ case $target_os i
          SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
          SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
          objformat="win32"
 -        dlltool="${cross_prefix}dlltool"
          ranlib=:
          enable dos_paths
-         add_cppflags -U__STRICT_ANSI__
          ;;
      win32|win64)
          if enabled shared; then
@@@ -3370,11 -3056,7 +3369,12 @@@ elif check_header _mingw.h; the
          "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
              (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
          die "ERROR: MinGW runtime version must be >= 3.15."
+     add_cppflags -U__STRICT_ANSI__
 +    if check_cpp_condition _mingw.h "defined(__MINGW64_VERSION_MAJOR) && \
 +            __MINGW64_VERSION_MAJOR < 3"; then
 +        add_compat msvcrt/snprintf.o
 +        add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
 +    fi
  elif check_func_headers stdlib.h _get_doserrno; then
      libc_type=msvcrt
      add_compat strtod.o strtod=avpriv_strtod
  #include "config.h"
  #include "attributes.h"
  #include "timer.h"
 +#include "cpu.h"
  #include "dict.h"
  
+ #if ARCH_X86
+ #   include "x86/emms.h"
+ #endif
+ #ifndef emms_c
+ #   define emms_c()
+ #endif
  #ifndef attribute_align_arg
  #if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2)
  #    define attribute_align_arg __attribute__((force_align_arg_pointer))
  #ifndef AVUTIL_X86_EMMS_H
  #define AVUTIL_X86_EMMS_H
  
+ #include "config.h"
+ #include "libavutil/attributes.h"
  void avpriv_emms_yasm(void);
  
 -    __asm__ volatile ("emms" ::: "memory");
+ #if HAVE_MMX_INLINE
+ #   define emms_c emms_c
+ /**
+  * 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");
+ }
+ #elif HAVE_MMX && HAVE_MM_EMPTY
+ #   include <mmintrin.h>
+ #   define emms_c _mm_empty
+ #elif HAVE_MMX_EXTERNAL
+ #   define emms_c avpriv_emms_yasm
+ #endif /* HAVE_MMX_INLINE */
  #endif /* AVUTIL_X86_EMMS_H */