summaryrefslogtreecommitdiff
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
parente346176de9809afec3724139ee320b613f753062 (diff)
parented219ed36606be307403b46f969a82bf0568865b (diff)
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>
-rwxr-xr-xconfigure9
-rw-r--r--libavcodec/mss1.c2
-rw-r--r--libavformat/mxfdec.c5
-rw-r--r--libavutil/internal.h7
-rw-r--r--libavutil/x86/cpu.c41
5 files changed, 58 insertions, 6 deletions
diff --git a/configure b/configure
index 0acbdedc88..1958fa62cd 100755
--- a/configure
+++ b/configure
@@ -1188,6 +1188,7 @@ HAVE_LIST="
clock_gettime
closesocket
cmov
+ cpuid
dcbzl
dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h
@@ -1246,6 +1247,7 @@ HAVE_LIST="
MapViewOfFile
memalign
mkstemp
+ mm_empty
mmap
nanosleep
netinet_sctp_h
@@ -1256,6 +1258,7 @@ HAVE_LIST="
rdtsc
round
roundf
+ rweflags
sched_getaffinity
sdl
sdl_video_size
@@ -1300,6 +1303,7 @@ HAVE_LIST="
windows_h
winsock2_h
xform_asm
+ xgetbv
xmm_clobbers
yasm
"
@@ -3055,7 +3059,12 @@ elif enabled sparc; then
elif enabled x86; then
+ check_code ld immintrin.h "__xgetbv(0)" "cc" && enable xgetbv
+ check_code ld intrin.h "int info[4]; __cpuid(info, 0)" "cc" && enable cpuid
check_code ld intrin.h "__rdtsc()" "cc" && enable rdtsc
+ check_code ld intrin.h "unsigned int x = __readeflags()" "cc" && enable rweflags
+
+ check_code ld mmintrin.h "_mm_empty()" "cc" && enable mm_empty
enable local_aligned_8 local_aligned_16
diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c
index 6299037d01..302a5b84b1 100644
--- a/libavcodec/mss1.c
+++ b/libavcodec/mss1.c
@@ -499,7 +499,7 @@ static int decode_region_masked(MSS1Context *ctx, ArithCoder *acoder,
dst += x + y * stride;
mask += x + y * mask_stride;
- if (mask[0] != 0xFF)
+ if (mask[0] == 0xFF)
dst[0] = decode_top_left_pixel(acoder, pctx);
for (j = 0; j < height; j++) {
for (i = 0; i < width; i++) {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 3e79265e3f..a553eb5630 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -1527,7 +1527,8 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
if (st->codec->codec_id == CODEC_ID_RAWVIDEO) {
st->codec->pix_fmt = descriptor->pix_fmt;
if (st->codec->pix_fmt == PIX_FMT_NONE) {
- pix_fmt_ul = mxf_get_codec_ul(ff_mxf_pixel_format_uls, &descriptor->essence_codec_ul);
+ pix_fmt_ul = mxf_get_codec_ul(ff_mxf_pixel_format_uls,
+ &descriptor->essence_codec_ul);
st->codec->pix_fmt = pix_fmt_ul->id;
if (st->codec->pix_fmt == PIX_FMT_NONE) {
/* support files created before RP224v10 by defaulting to UYVY422
@@ -1972,7 +1973,7 @@ static int64_t mxf_set_current_edit_unit(MXFContext *mxf, int64_t current_offset
* around this fixes the infinite loop on zzuf3.mxf */
av_log(mxf->fc, AV_LOG_ERROR,
"next_ofs didn't change. not deriving packet timestamps\n");
- return - 1;
+ return -1;
}
if (next_ofs > current_offset)
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)
{