summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-10 20:51:51 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-10 20:51:51 +0200
commitb27c7d70d8ea6e589d0838f0d2529b99928b7192 (patch)
tree3ec19e69d80a6660230c964e0b37935c2f280412 /libavutil
parente346176de9809afec3724139ee320b613f753062 (diff)
parented219ed36606be307403b46f969a82bf0568865b (diff)
downloadffmpeg-b27c7d70d8ea6e589d0838f0d2529b99928b7192.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: mss1: fix decoding masked regions in interframes mxfdec: fix off by one error. mxfdec: only parse next partition pack if parsing forward mxfdec: let pkt->pts = mxf->current_edit_unit if intra-only mxfdec: fix frame height vs field height confusion mxfdec: Add intra_only flag to MXFTrack mxfdec: fix Avid AirSpeed files being misinterpreted as OP1a mxfdec: truncate packets that extend past the next edit unit mxfdec: set pixel format for cdci picture formats mxfdec: detect uncomp pictures using essence container ul mxfdec: set track edit rate num/den in expected order x86/cpu: implement get/set_eflags using intrinsics x86/cpu: implement support for cpuid through intrinsics x86/cpu: implement support for xgetbv through intrinsics lavu: use intrinsics for emms on systems lacking inline asm support mem: Don't abort on av_malloc(0) in debug mode Conflicts: configure libavformat/mxf.h libavformat/mxfdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/internal.h7
-rw-r--r--libavutil/x86/cpu.c41
2 files changed, 45 insertions, 3 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 0569eb2699..57a9c96070 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -231,7 +231,7 @@ struct AVDictionary {
# define ONLY_IF_THREADS_ENABLED(x) NULL
#endif
-#if HAVE_MMX
+#if HAVE_MMX && HAVE_INLINE_ASM
/**
* Empty mmx state.
* this must be called between any dsp function and float/double code.
@@ -242,8 +242,11 @@ 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
#else /* HAVE_MMX */
-#define emms_c()
+# define emms_c()
#endif /* HAVE_MMX */
#endif /* AVUTIL_INTERNAL_H */
diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index 663fb93e52..b1052247a0 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -25,6 +25,7 @@
#include "libavutil/x86_cpu.h"
#include "libavutil/cpu.h"
+#if HAVE_INLINE_ASM
/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
#define cpuid(index, eax, ebx, ecx, edx) \
__asm__ volatile ( \
@@ -33,9 +34,35 @@
"xchg %%"REG_b", %%"REG_S \
: "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx) \
: "0" (index))
-
+#elif HAVE_CPUID
+#include <intrin.h>
+
+#define cpuid(index, eax, ebx, ecx, edx) \
+ do { \
+ int info[4]; \
+ __cpuid(info, index); \
+ eax = info[0]; \
+ ebx = info[1]; \
+ ecx = info[2]; \
+ edx = info[3]; \
+ } while (0)
+#endif /* HAVE_CPUID */
+
+#if HAVE_INLINE_ASM
#define xgetbv(index, eax, edx) \
__asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index))
+#elif HAVE_XGETBV
+#include <immintrin.h>
+
+#define xgetbv(index, eax, edx) \
+ do { \
+ uint64_t res = __xgetbv(index); \
+ eax = res; \
+ edx = res >> 32; \
+ } while (0)
+#endif /* HAVE_XGETBV */
+
+#if HAVE_INLINE_ASM
#define get_eflags(x) \
__asm__ volatile ("pushfl \n" \
@@ -47,6 +74,18 @@
"popfl \n" \
:: "r"(x))
+#elif HAVE_RWEFLAGS
+
+#include <intrin.h>
+
+#define get_eflags(x) \
+ x = __readeflags()
+
+#define set_eflags(x) \
+ __writeeflags(x)
+
+#endif /* HAVE_INLINE_ASM */
+
/* Function to test if multimedia instructions are supported... */
int ff_get_cpu_flags_x86(void)
{