Commit b27c7d70 authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents e346176d ed219ed3
......@@ -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
......
......@@ -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++) {
......
......@@ -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)
......
......@@ -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 */
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment