summaryrefslogtreecommitdiff
path: root/ffmpeg/libavutil
diff options
context:
space:
mode:
Diffstat (limited to 'ffmpeg/libavutil')
-rw-r--r--ffmpeg/libavutil/Makefile41
-rw-r--r--ffmpeg/libavutil/adler32.c9
-rw-r--r--ffmpeg/libavutil/adler32.h12
-rw-r--r--ffmpeg/libavutil/arm/asm.S2
-rw-r--r--ffmpeg/libavutil/arm/cpu.c9
-rw-r--r--ffmpeg/libavutil/arm/cpu.h23
-rw-r--r--ffmpeg/libavutil/arm/float_dsp_arm.h2
-rw-r--r--ffmpeg/libavutil/arm/float_dsp_init_arm.c5
-rw-r--r--ffmpeg/libavutil/arm/float_dsp_init_neon.c11
-rw-r--r--ffmpeg/libavutil/arm/float_dsp_init_vfp.c5
-rw-r--r--ffmpeg/libavutil/arm/float_dsp_neon.S8
-rw-r--r--ffmpeg/libavutil/atomic.c5
-rw-r--r--ffmpeg/libavutil/atomic.h13
-rw-r--r--ffmpeg/libavutil/attributes.h16
-rw-r--r--ffmpeg/libavutil/audio_fifo.c8
-rw-r--r--ffmpeg/libavutil/audio_fifo.h15
-rw-r--r--ffmpeg/libavutil/avconfig.h1
-rw-r--r--ffmpeg/libavutil/avstring.c66
-rw-r--r--ffmpeg/libavutil/avstring.h54
-rw-r--r--ffmpeg/libavutil/avutil.h72
-rw-r--r--ffmpeg/libavutil/base64.c5
-rw-r--r--ffmpeg/libavutil/blowfish.c3
-rw-r--r--ffmpeg/libavutil/bprint.c42
-rw-r--r--ffmpeg/libavutil/bprint.h24
-rw-r--r--ffmpeg/libavutil/buffer.c14
-rw-r--r--ffmpeg/libavutil/buffer.h11
-rw-r--r--ffmpeg/libavutil/channel_layout.c45
-rw-r--r--ffmpeg/libavutil/channel_layout.h7
-rw-r--r--ffmpeg/libavutil/common.h39
-rw-r--r--ffmpeg/libavutil/cpu.c64
-rw-r--r--ffmpeg/libavutil/cpu.h11
-rw-r--r--ffmpeg/libavutil/crc.c52
-rw-r--r--ffmpeg/libavutil/crc.h11
-rw-r--r--ffmpeg/libavutil/des.c4
-rw-r--r--ffmpeg/libavutil/dict.c8
-rw-r--r--ffmpeg/libavutil/dict.h25
-rw-r--r--ffmpeg/libavutil/eval.c32
-rw-r--r--ffmpeg/libavutil/eval.h4
-rw-r--r--ffmpeg/libavutil/fifo.c38
-rw-r--r--ffmpeg/libavutil/file.c3
-rw-r--r--ffmpeg/libavutil/file.h2
-rw-r--r--ffmpeg/libavutil/float_dsp.c4
-rw-r--r--ffmpeg/libavutil/frame.c113
-rw-r--r--ffmpeg/libavutil/frame.h84
-rw-r--r--ffmpeg/libavutil/hmac.c121
-rw-r--r--ffmpeg/libavutil/hmac.h4
-rw-r--r--ffmpeg/libavutil/imgutils.c26
-rw-r--r--ffmpeg/libavutil/internal.h41
-rw-r--r--ffmpeg/libavutil/intfloat.h8
-rw-r--r--ffmpeg/libavutil/intfloat_readwrite.c6
-rw-r--r--ffmpeg/libavutil/intfloat_readwrite.h4
-rw-r--r--ffmpeg/libavutil/libavutil.pc4
-rw-r--r--ffmpeg/libavutil/lls.c175
-rw-r--r--ffmpeg/libavutil/lls.h54
-rw-r--r--ffmpeg/libavutil/log.c117
-rw-r--r--ffmpeg/libavutil/log.h111
-rw-r--r--ffmpeg/libavutil/md5.c93
-rw-r--r--ffmpeg/libavutil/md5.h34
-rw-r--r--ffmpeg/libavutil/mem.c142
-rw-r--r--ffmpeg/libavutil/mem.h156
-rw-r--r--ffmpeg/libavutil/old_pix_fmts.h6
-rw-r--r--ffmpeg/libavutil/opt.c356
-rw-r--r--ffmpeg/libavutil/opt.h32
-rw-r--r--ffmpeg/libavutil/parseutils.c30
-rw-r--r--ffmpeg/libavutil/parseutils.h15
-rw-r--r--ffmpeg/libavutil/pca.c6
-rw-r--r--ffmpeg/libavutil/pixdesc.c533
-rw-r--r--ffmpeg/libavutil/pixdesc.h72
-rw-r--r--ffmpeg/libavutil/pixfmt.h66
-rw-r--r--ffmpeg/libavutil/ppc/cpu.c1
-rw-r--r--ffmpeg/libavutil/ppc/float_dsp_altivec.h20
-rw-r--r--ffmpeg/libavutil/ppc/float_dsp_init.c10
-rw-r--r--ffmpeg/libavutil/ppc/timer.h5
-rw-r--r--ffmpeg/libavutil/ppc/util_altivec.h4
-rw-r--r--ffmpeg/libavutil/random_seed.c3
-rw-r--r--ffmpeg/libavutil/rational.c8
-rw-r--r--ffmpeg/libavutil/rational.h2
-rw-r--r--ffmpeg/libavutil/samplefmt.c15
-rw-r--r--ffmpeg/libavutil/samplefmt.h13
-rw-r--r--ffmpeg/libavutil/sha.c123
-rw-r--r--ffmpeg/libavutil/softfloat.c1
-rw-r--r--ffmpeg/libavutil/time.c2
-rw-r--r--ffmpeg/libavutil/timestamp.h2
-rw-r--r--ffmpeg/libavutil/tree.c103
-rw-r--r--ffmpeg/libavutil/tree.h32
-rw-r--r--ffmpeg/libavutil/utils.c36
-rw-r--r--ffmpeg/libavutil/version.h46
-rw-r--r--ffmpeg/libavutil/x86/Makefile2
-rw-r--r--ffmpeg/libavutil/x86/cpu.c9
-rw-r--r--ffmpeg/libavutil/x86/cpu.h70
-rw-r--r--ffmpeg/libavutil/x86/float_dsp.asm25
-rw-r--r--ffmpeg/libavutil/x86/float_dsp_init.c44
-rw-r--r--ffmpeg/libavutil/x86/timer.h1
-rw-r--r--ffmpeg/libavutil/x86/w64xmmtest.h8
-rw-r--r--ffmpeg/libavutil/x86/x86inc.asm586
-rw-r--r--ffmpeg/libavutil/x86/x86util.asm13
-rw-r--r--ffmpeg/libavutil/xtea.c10
-rw-r--r--ffmpeg/libavutil/xtea.h2
98 files changed, 3217 insertions, 1213 deletions
diff --git a/ffmpeg/libavutil/Makefile b/ffmpeg/libavutil/Makefile
index 103ce5e..89708fc 100644
--- a/ffmpeg/libavutil/Makefile
+++ b/ffmpeg/libavutil/Makefile
@@ -34,6 +34,7 @@ HEADERS = adler32.h \
mathematics.h \
md5.h \
mem.h \
+ murmur3.h \
dict.h \
old_pix_fmts.h \
opt.h \
@@ -42,8 +43,11 @@ HEADERS = adler32.h \
pixfmt.h \
random_seed.h \
rational.h \
+ ripemd.h \
samplefmt.h \
sha.h \
+ sha512.h \
+ stereo3d.h \
time.h \
timecode.h \
timestamp.h \
@@ -52,12 +56,15 @@ HEADERS = adler32.h \
HEADERS-$(CONFIG_LZO) += lzo.h
+HEADERS-$(CONFIG_OPENCL) += opencl.h
+
ARCH_HEADERS = bswap.h \
intmath.h \
intreadwrite.h \
timer.h \
-BUILT_HEADERS = avconfig.h
+BUILT_HEADERS = avconfig.h \
+ ffversion.h
OBJS = adler32.o \
aes.o \
@@ -76,19 +83,23 @@ OBJS = adler32.o \
eval.o \
fifo.o \
file.o \
+ file_open.o \
float_dsp.o \
frame.o \
+ hash.o \
hmac.o \
imgutils.o \
intfloat_readwrite.o \
intmath.o \
lfg.o \
- lls.o \
+ lls1.o \
+ lls2.o \
log.o \
log2_tab.o \
mathematics.o \
md5.o \
mem.o \
+ murmur3.o \
dict.o \
opt.o \
parseutils.o \
@@ -96,8 +107,11 @@ OBJS = adler32.o \
random_seed.o \
rational.o \
rc4.o \
+ ripemd.o \
samplefmt.o \
sha.o \
+ sha512.o \
+ stereo3d.o \
time.o \
timecode.o \
tree.o \
@@ -106,14 +120,19 @@ OBJS = adler32.o \
xtea.o \
OBJS-$(CONFIG_LZO) += lzo.o
+OBJS-$(CONFIG_OPENCL) += opencl.o opencl_internal.o
OBJS += $(COMPAT_OBJS:%=../compat/%)
+# Windows resource file
+SLIBOBJS-$(HAVE_GNU_WINDRES) += avutilres.o
+
SKIPHEADERS = old_pix_fmts.h
-SKIPHEADERS-$(HAVE_MACHINE_RW_BARRIER) += atomic_suncc.h
-SKIPHEADERS-$(HAVE_MEMORYBARRIER) += atomic_win32.h
-SKIPHEADERS-$(HAVE_SYNC_VAL_COMPARE_AND_SWAP) += atomic_gcc.h
+SKIPHEADERS-$(HAVE_ATOMICS_GCC) += atomic_gcc.h
+SKIPHEADERS-$(HAVE_ATOMICS_SUNCC) += atomic_suncc.h
+SKIPHEADERS-$(HAVE_ATOMICS_WIN32) += atomic_win32.h
+SKIPHEADERS-$(CONFIG_OPENCL) += opencl.h
TESTPROGS = adler32 \
aes \
@@ -131,19 +150,27 @@ TESTPROGS = adler32 \
fifo \
hmac \
lfg \
- lls \
+ lls1 \
+ lls2 \
md5 \
+ murmur3 \
opt \
pca \
parseutils \
random_seed \
rational \
+ ripemd \
sha \
+ sha512 \
tree \
+ utf8 \
xtea \
TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
-TOOLS = ffeval ffescape
+TOOLS = crypto_bench ffhash ffeval ffescape
+
+tools/crypto_bench$(EXESUF): ELIBS += $(if $(VERSUS),$(subst +, -l,+$(VERSUS)),)
+tools/crypto_bench$(EXESUF): CFLAGS += -DUSE_EXT_LIBS=0$(if $(VERSUS),$(subst +,+USE_,+$(VERSUS)),)
$(SUBDIR)lzo-test$(EXESUF): ELIBS = -llzo2
diff --git a/ffmpeg/libavutil/adler32.c b/ffmpeg/libavutil/adler32.c
index bc9b9a7..579d022 100644
--- a/ffmpeg/libavutil/adler32.c
+++ b/ffmpeg/libavutil/adler32.c
@@ -21,6 +21,15 @@
* 3. This notice may not be removed or altered from any source distribution.
*/
+/**
+ * @file
+ * Computes the Adler-32 checksum of a data stream
+ *
+ * This is a modified version based on adler32.c from the zlib library.
+ * @author Mark Adler
+ * @ingroup lavu_adler32
+ */
+
#include "config.h"
#include "adler32.h"
#include "common.h"
diff --git a/ffmpeg/libavutil/adler32.h b/ffmpeg/libavutil/adler32.h
index e926ef6..0dc69ec 100644
--- a/ffmpeg/libavutil/adler32.h
+++ b/ffmpeg/libavutil/adler32.h
@@ -25,7 +25,15 @@
#include "attributes.h"
/**
+ * @file
+ * Public header for libavutil Adler32 hasher
+ *
+ * @defgroup lavu_adler32 Adler32
* @ingroup lavu_crypto
+ * @{
+ */
+
+/**
* Calculate the Adler32 checksum of a buffer.
*
* Passing the return value to a subsequent av_adler32_update() call
@@ -40,4 +48,8 @@
unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
unsigned int len) av_pure;
+/**
+ * @}
+ */
+
#endif /* AVUTIL_ADLER32_H */
diff --git a/ffmpeg/libavutil/arm/asm.S b/ffmpeg/libavutil/arm/asm.S
index 6061e47..9cdcce9 100644
--- a/ffmpeg/libavutil/arm/asm.S
+++ b/ffmpeg/libavutil/arm/asm.S
@@ -291,7 +291,7 @@ T sub \rn, \rn, \rm
.endm
#if HAVE_VFP_ARGS
- .eabi_attribute 28, 1
+ELF .eabi_attribute 28, 1
# define VFP
# define NOVFP @
#else
diff --git a/ffmpeg/libavutil/arm/cpu.c b/ffmpeg/libavutil/arm/cpu.c
index b4aabc3..3f7674b 100644
--- a/ffmpeg/libavutil/arm/cpu.c
+++ b/ffmpeg/libavutil/arm/cpu.c
@@ -1,22 +1,23 @@
/*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/cpu.h"
+#include "libavutil/cpu_internal.h"
#include "config.h"
#define CORE_FLAG(f) \
diff --git a/ffmpeg/libavutil/arm/cpu.h b/ffmpeg/libavutil/arm/cpu.h
index 91c959a..c545589 100644
--- a/ffmpeg/libavutil/arm/cpu.h
+++ b/ffmpeg/libavutil/arm/cpu.h
@@ -1,18 +1,18 @@
/*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -21,12 +21,13 @@
#include "config.h"
#include "libavutil/cpu.h"
+#include "libavutil/cpu_internal.h"
-#define have_armv5te(flags) (HAVE_ARMV5TE && ((flags) & AV_CPU_FLAG_ARMV5TE))
-#define have_armv6(flags) (HAVE_ARMV6 && ((flags) & AV_CPU_FLAG_ARMV6))
-#define have_armv6t2(flags) (HAVE_ARMV6T2 && ((flags) & AV_CPU_FLAG_ARMV6T2))
-#define have_vfp(flags) (HAVE_VFP && ((flags) & AV_CPU_FLAG_VFP))
-#define have_vfpv3(flags) (HAVE_VFPV3 && ((flags) & AV_CPU_FLAG_VFPV3))
-#define have_neon(flags) (HAVE_NEON && ((flags) & AV_CPU_FLAG_NEON))
+#define have_armv5te(flags) CPUEXT(flags, ARMV5TE)
+#define have_armv6(flags) CPUEXT(flags, ARMV6)
+#define have_armv6t2(flags) CPUEXT(flags, ARMV6T2)
+#define have_vfp(flags) CPUEXT(flags, VFP)
+#define have_vfpv3(flags) CPUEXT(flags, VFPV3)
+#define have_neon(flags) CPUEXT(flags, NEON)
-#endif
+#endif /* AVUTIL_ARM_CPU_H */
diff --git a/ffmpeg/libavutil/arm/float_dsp_arm.h b/ffmpeg/libavutil/arm/float_dsp_arm.h
index f3fafe3..fe311cc 100644
--- a/ffmpeg/libavutil/arm/float_dsp_arm.h
+++ b/ffmpeg/libavutil/arm/float_dsp_arm.h
@@ -23,7 +23,7 @@
#include "libavutil/float_dsp.h"
-void ff_float_dsp_init_vfp (AVFloatDSPContext *fdsp);
+void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp, int cpu_flags);
void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp);
#endif /* AVUTIL_ARM_FLOAT_DSP_ARM_H */
diff --git a/ffmpeg/libavutil/arm/float_dsp_init_arm.c b/ffmpeg/libavutil/arm/float_dsp_init_arm.c
index f721344..38148b3 100644
--- a/ffmpeg/libavutil/arm/float_dsp_init_arm.c
+++ b/ffmpeg/libavutil/arm/float_dsp_init_arm.c
@@ -18,16 +18,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "cpu.h"
#include "float_dsp_arm.h"
-void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp)
+av_cold void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp)
{
int cpu_flags = av_get_cpu_flags();
if (have_vfp(cpu_flags))
- ff_float_dsp_init_vfp(fdsp);
+ ff_float_dsp_init_vfp(fdsp, cpu_flags);
if (have_neon(cpu_flags))
ff_float_dsp_init_neon(fdsp);
}
diff --git a/ffmpeg/libavutil/arm/float_dsp_init_neon.c b/ffmpeg/libavutil/arm/float_dsp_init_neon.c
index a7245ad..689aa77 100644
--- a/ffmpeg/libavutil/arm/float_dsp_init_neon.c
+++ b/ffmpeg/libavutil/arm/float_dsp_init_neon.c
@@ -2,25 +2,26 @@
* ARM NEON optimised Float DSP functions
* Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdint.h>
+#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "float_dsp_arm.h"
@@ -45,7 +46,7 @@ void ff_butterflies_float_neon(float *v1, float *v2, int len);
float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len);
-void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp)
+av_cold void ff_float_dsp_init_neon(AVFloatDSPContext *fdsp)
{
fdsp->vector_fmul = ff_vector_fmul_neon;
fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_neon;
diff --git a/ffmpeg/libavutil/arm/float_dsp_init_vfp.c b/ffmpeg/libavutil/arm/float_dsp_init_vfp.c
index f7e2f54..1fe52ab 100644
--- a/ffmpeg/libavutil/arm/float_dsp_init_vfp.c
+++ b/ffmpeg/libavutil/arm/float_dsp_init_vfp.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "cpu.h"
#include "float_dsp_arm.h"
@@ -28,10 +29,8 @@ void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1,
void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
const float *src1, int len);
-void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp)
+av_cold void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp, int cpu_flags)
{
- int cpu_flags = av_get_cpu_flags();
-
if (!have_vfpv3(cpu_flags))
fdsp->vector_fmul = ff_vector_fmul_vfp;
fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_vfp;
diff --git a/ffmpeg/libavutil/arm/float_dsp_neon.S b/ffmpeg/libavutil/arm/float_dsp_neon.S
index 559b565..3823227 100644
--- a/ffmpeg/libavutil/arm/float_dsp_neon.S
+++ b/ffmpeg/libavutil/arm/float_dsp_neon.S
@@ -2,20 +2,20 @@
* ARM NEON optimised Float DSP functions
* Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
diff --git a/ffmpeg/libavutil/atomic.c b/ffmpeg/libavutil/atomic.c
index 0780d8a..b7b3872 100644
--- a/ffmpeg/libavutil/atomic.c
+++ b/ffmpeg/libavutil/atomic.c
@@ -18,9 +18,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "config.h"
#include "atomic.h"
-#if !HAVE_MEMORYBARRIER && !HAVE_SYNC_VAL_COMPARE_AND_SWAP && !HAVE_MACHINE_RW_BARRIER
+#if !HAVE_ATOMICS_NATIVE
#if HAVE_PTHREADS
@@ -102,7 +103,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval)
#endif /* HAVE_PTHREADS */
-#endif /* !HAVE_MEMORYBARRIER && !HAVE_SYNC_VAL_COMPARE_AND_SWAP && !HAVE_MACHINE_RW_BARRIER */
+#endif /* !HAVE_ATOMICS_NATIVE */
#ifdef TEST
#include "avassert.h"
diff --git a/ffmpeg/libavutil/atomic.h b/ffmpeg/libavutil/atomic.h
index 1d2a345..15906d2 100644
--- a/ffmpeg/libavutil/atomic.h
+++ b/ffmpeg/libavutil/atomic.h
@@ -23,12 +23,16 @@
#include "config.h"
-#if HAVE_SYNC_VAL_COMPARE_AND_SWAP
+#if HAVE_ATOMICS_NATIVE
+
+#if HAVE_ATOMICS_GCC
#include "atomic_gcc.h"
-#elif HAVE_MEMORYBARRIER
+#elif HAVE_ATOMICS_WIN32
#include "atomic_win32.h"
-#elif HAVE_MACHINE_RW_BARRIER
+#elif HAVE_ATOMICS_SUNCC
#include "atomic_suncc.h"
+#endif
+
#else
/**
@@ -70,5 +74,6 @@ int avpriv_atomic_int_add_and_fetch(volatile int *ptr, int inc);
*/
void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval);
-#endif /* HAVE_MEMORYBARRIER */
+#endif /* HAVE_ATOMICS_NATIVE */
+
#endif /* AVUTIL_ATOMIC_H */
diff --git a/ffmpeg/libavutil/attributes.h b/ffmpeg/libavutil/attributes.h
index 64b46f6..7d3f4a9 100644
--- a/ffmpeg/libavutil/attributes.h
+++ b/ffmpeg/libavutil/attributes.h
@@ -52,6 +52,8 @@
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_noinline __attribute__((noinline))
+#elif defined(_MSC_VER)
+# define av_noinline __declspec(noinline)
#else
# define av_noinline
#endif
@@ -62,10 +64,6 @@
# define av_pure
#endif
-#ifndef av_restrict
-#define av_restrict restrict
-#endif
-
#if AV_GCC_VERSION_AT_LEAST(2,6)
# define av_const __attribute__((const))
#else
@@ -78,7 +76,7 @@
# define av_cold
#endif
-#if AV_GCC_VERSION_AT_LEAST(4,1)
+#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__)
# define av_flatten __attribute__((flatten))
#else
# define av_flatten
@@ -86,6 +84,8 @@
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define attribute_deprecated __attribute__((deprecated))
+#elif defined(_MSC_VER)
+# define attribute_deprecated __declspec(deprecated)
#else
# define attribute_deprecated
#endif
@@ -102,6 +102,12 @@
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
code \
_Pragma("GCC diagnostic pop")
+#elif defined(_MSC_VER)
+# define AV_NOWARN_DEPRECATED(code) \
+ __pragma(warning(push)) \
+ __pragma(warning(disable : 4996)) \
+ code; \
+ __pragma(warning(pop))
#else
# define AV_NOWARN_DEPRECATED(code) code
#endif
diff --git a/ffmpeg/libavutil/audio_fifo.c b/ffmpeg/libavutil/audio_fifo.c
index b562537..cfbde89 100644
--- a/ffmpeg/libavutil/audio_fifo.c
+++ b/ffmpeg/libavutil/audio_fifo.c
@@ -2,20 +2,20 @@
* Audio FIFO
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
diff --git a/ffmpeg/libavutil/audio_fifo.h b/ffmpeg/libavutil/audio_fifo.h
index 8c76388..903b8f1 100644
--- a/ffmpeg/libavutil/audio_fifo.h
+++ b/ffmpeg/libavutil/audio_fifo.h
@@ -2,20 +2,20 @@
* Audio FIFO
* Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -85,7 +85,8 @@ int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples);
* @param data audio data plane pointers
* @param nb_samples number of samples to write
* @return number of samples actually written, or negative AVERROR
- * code on failure.
+ * code on failure. If successful, the number of samples
+ * actually written will always be nb_samples.
*/
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
@@ -99,7 +100,9 @@ int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples);
* @param data audio data plane pointers
* @param nb_samples number of samples to read
* @return number of samples actually read, or negative AVERROR code
- * on failure.
+ * on failure. The number of samples actually read will not
+ * be greater than nb_samples, and will only be less than
+ * nb_samples if av_audio_fifo_size is less than nb_samples.
*/
int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples);
diff --git a/ffmpeg/libavutil/avconfig.h b/ffmpeg/libavutil/avconfig.h
index 2ec333d..f6685b7 100644
--- a/ffmpeg/libavutil/avconfig.h
+++ b/ffmpeg/libavutil/avconfig.h
@@ -3,5 +3,6 @@
#define AVUTIL_AVCONFIG_H
#define AV_HAVE_BIGENDIAN 0
#define AV_HAVE_FAST_UNALIGNED 1
+#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0
#define AV_HAVE_INCOMPATIBLE_FORK_ABI 0
#endif /* AVUTIL_AVCONFIG_H */
diff --git a/ffmpeg/libavutil/avstring.c b/ffmpeg/libavutil/avstring.c
index cf9be2a..f4374fd 100644
--- a/ffmpeg/libavutil/avstring.c
+++ b/ffmpeg/libavutil/avstring.c
@@ -307,12 +307,76 @@ int av_isxdigit(int c)
return av_isdigit(c) || (c >= 'a' && c <= 'f');
}
+int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
+ unsigned int flags)
+{
+ const uint8_t *p = *bufp;
+ uint32_t top;
+ uint64_t code;
+ int ret = 0;
+
+ if (p >= buf_end)
+ return 0;
+
+ code = *p++;
+
+ /* first sequence byte starts with 10, or is 1111-1110 or 1111-1111,
+ which is not admitted */
+ if ((code & 0xc0) == 0x80 || code >= 0xFE) {
+ ret = AVERROR(EILSEQ);
+ goto end;
+ }
+ top = (code & 128) >> 1;
+
+ while (code & top) {
+ int tmp;
+ if (p >= buf_end) {
+ ret = AVERROR(EILSEQ); /* incomplete sequence */
+ goto end;
+ }
+
+ /* we assume the byte to be in the form 10xx-xxxx */
+ tmp = *p++ - 128; /* strip leading 1 */
+ if (tmp>>6) {
+ ret = AVERROR(EILSEQ);
+ goto end;
+ }
+ code = (code<<6) + tmp;
+ top <<= 5;
+ }
+ code &= (top << 1) - 1;
+
+ if (code >= 1<<31) {
+ ret = AVERROR(EILSEQ); /* out-of-range value */
+ goto end;
+ }
+
+ *codep = code;
+
+ if (code > 0x10FFFF &&
+ !(flags & AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES))
+ ret = AVERROR(EILSEQ);
+ if (code < 0x20 && code != 0x9 && code != 0xA && code != 0xD &&
+ flags & AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES)
+ ret = AVERROR(EILSEQ);
+ if (code >= 0xD800 && code <= 0xDFFF &&
+ !(flags & AV_UTF8_FLAG_ACCEPT_SURROGATES))
+ ret = AVERROR(EILSEQ);
+ if ((code == 0xFFFE || code == 0xFFFF) &&
+ !(flags & AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS))
+ ret = AVERROR(EILSEQ);
+
+end:
+ *bufp = p;
+ return ret;
+}
+
#ifdef TEST
int main(void)
{
int i;
- const char *strings[] = {
+ static const char * const strings[] = {
"''",
"",
":",
diff --git a/ffmpeg/libavutil/avstring.h b/ffmpeg/libavutil/avstring.h
index 438ef79..de2f71d 100644
--- a/ffmpeg/libavutil/avstring.h
+++ b/ffmpeg/libavutil/avstring.h
@@ -22,6 +22,7 @@
#define AVUTIL_AVSTRING_H
#include <stddef.h>
+#include <stdint.h>
#include "attributes.h"
/**
@@ -131,6 +132,20 @@ size_t av_strlcat(char *dst, const char *src, size_t size);
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
/**
+ * Get the count of continuous non zero chars starting from the beginning.
+ *
+ * @param len maximum number of characters to check in the string, that
+ * is the maximum value which is returned by the function
+ */
+static inline size_t av_strnlen(const char *s, size_t len)
+{
+ size_t i;
+ for (i = 0; i < len && s[i]; i++)
+ ;
+ return i;
+}
+
+/**
* Print arguments following specified format into a large enough auto
* allocated buffer. It is similar to GNU asprintf().
* @param fmt printf-compatible format string, specifying how the
@@ -295,6 +310,45 @@ enum AVEscapeMode {
int av_escape(char **dst, const char *src, const char *special_chars,
enum AVEscapeMode mode, int flags);
+#define AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES 1 ///< accept codepoints over 0x10FFFF
+#define AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS 2 ///< accept non-characters - 0xFFFE and 0xFFFF
+#define AV_UTF8_FLAG_ACCEPT_SURROGATES 4 ///< accept UTF-16 surrogates codes
+#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES 8 ///< exclude control codes not accepted by XML
+
+#define AV_UTF8_FLAG_ACCEPT_ALL \
+ AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES|AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS|AV_UTF8_FLAG_ACCEPT_SURROGATES
+
+/**
+ * Read and decode a single UTF-8 code point (character) from the
+ * buffer in *buf, and update *buf to point to the next byte to
+ * decode.
+ *
+ * In case of an invalid byte sequence, the pointer will be updated to
+ * the next byte after the invalid sequence and the function will
+ * return an error code.
+ *
+ * Depending on the specified flags, the function will also fail in
+ * case the decoded code point does not belong to a valid range.
+ *
+ * @note For speed-relevant code a carefully implemented use of
+ * GET_UTF8() may be preferred.
+ *
+ * @param codep pointer used to return the parsed code in case of success.
+ * The value in *codep is set even in case the range check fails.
+ * @param bufp pointer to the address the first byte of the sequence
+ * to decode, updated by the function to point to the
+ * byte next after the decoded sequence
+ * @param buf_end pointer to the end of the buffer, points to the next
+ * byte past the last in the buffer. This is used to
+ * avoid buffer overreads (in case of an unfinished
+ * UTF-8 sequence towards the end of the buffer).
+ * @param flags a collection of AV_UTF8_FLAG_* flags
+ * @return >= 0 in case a sequence was successfully read, a negative
+ * value in case of invalid sequence
+ */
+int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
+ unsigned int flags);
+
/**
* @}
*/
diff --git a/ffmpeg/libavutil/avutil.h b/ffmpeg/libavutil/avutil.h
index 78deff1..d8f4690 100644
--- a/ffmpeg/libavutil/avutil.h
+++ b/ffmpeg/libavutil/avutil.h
@@ -35,13 +35,46 @@
* provided by FFmpeg.
*
* @li @ref libavc "libavcodec" encoding/decoding library
- * @li @ref lavfi "libavfilter" graph based frame editing library
+ * @li @ref lavfi "libavfilter" graph-based frame editing library
* @li @ref libavf "libavformat" I/O and muxing/demuxing library
* @li @ref lavd "libavdevice" special devices muxing/demuxing library
* @li @ref lavu "libavutil" common utility library
* @li @ref lswr "libswresample" audio resampling, format conversion and mixing
* @li @ref lpp "libpostproc" post processing library
- * @li @ref lsws "libswscale" color conversion and scaling library
+ * @li @ref libsws "libswscale" color conversion and scaling library
+ *
+ * @section ffmpeg_versioning Versioning and compatibility
+ *
+ * Each of the FFmpeg libraries contains a version.h header, which defines a
+ * major, minor and micro version number with the
+ * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version
+ * number is incremented with backward incompatible changes - e.g. removing
+ * parts of the public API, reordering public struct members, etc. The minor
+ * version number is incremented for backward compatible API changes or major
+ * new features - e.g. adding a new public function or a new decoder. The micro
+ * version number is incremented for smaller changes that a calling program
+ * might still want to check for - e.g. changing behavior in a previously
+ * unspecified situation.
+ *
+ * FFmpeg guarantees backward API and ABI compatibility for each library as long
+ * as its major version number is unchanged. This means that no public symbols
+ * will be removed or renamed. Types and names of the public struct members and
+ * values of public macros and enums will remain the same (unless they were
+ * explicitly declared as not part of the public API). Documented behavior will
+ * not change.
+ *
+ * In other words, any correct program that works with a given FFmpeg snapshot
+ * should work just as well without any changes with any later snapshot with the
+ * same major versions. This applies to both rebuilding the program against new
+ * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program
+ * links against.
+ *
+ * However, new public symbols may be added and new members may be appended to
+ * public structs whose size is not part of public ABI (most public structs in
+ * FFmpeg). New macros and enum values may be added. Behavior in undocumented
+ * situations may change slightly (and be documented). All those are accompanied
+ * by an entry in doc/APIchanges and incrementing either the minor or micro
+ * version number.
*/
/**
@@ -95,6 +128,12 @@
*
* @}
*
+ * @defgroup lavu_log Logging Facility
+ *
+ * @{
+ *
+ * @}
+ *
* @defgroup lavu_misc Other
*
* @{
@@ -240,7 +279,6 @@ char av_get_picture_type_char(enum AVPictureType pict_type);
#include "version.h"
#include "mathematics.h"
#include "rational.h"
-#include "intfloat_readwrite.h"
#include "log.h"
#include "pixfmt.h"
@@ -253,6 +291,34 @@ static inline void *av_x_if_null(const void *p, const void *x)
}
/**
+ * Compute the length of an integer list.
+ *
+ * @param elsize size in bytes of each list element (only 1, 2, 4 or 8)
+ * @param term list terminator (usually 0 or -1)
+ * @param list pointer to the list
+ * @return length of the list, in elements, not counting the terminator
+ */
+unsigned av_int_list_length_for_size(unsigned elsize,
+ const void *list, uint64_t term) av_pure;
+
+/**
+ * Compute the length of an integer list.
+ *
+ * @param term list terminator (usually 0 or -1)
+ * @param list pointer to the list
+ * @return length of the list, in elements, not counting the terminator
+ */
+#define av_int_list_length(list, term) \
+ av_int_list_length_for_size(sizeof(*(list)), list, term)
+
+/**
+ * Open a file using a UTF-8 filename.
+ * The API of this function matches POSIX fopen(), errors are returned through
+ * errno.
+ */
+FILE *av_fopen_utf8(const char *path, const char *mode);
+
+/**
* @}
* @}
*/
diff --git a/ffmpeg/libavutil/base64.c b/ffmpeg/libavutil/base64.c
index 87e2dfd..348690d 100644
--- a/ffmpeg/libavutil/base64.c
+++ b/ffmpeg/libavutil/base64.c
@@ -270,7 +270,10 @@ int main(int argc, char ** argv)
}
}
- return error_count;
+ if (error_count)
+ printf("Error Count: %d.\n", error_count);
+
+ return !!error_count;
}
// LCOV_EXCL_STOP
diff --git a/ffmpeg/libavutil/blowfish.c b/ffmpeg/libavutil/blowfish.c
index 5ad74c1..3821427 100644
--- a/ffmpeg/libavutil/blowfish.c
+++ b/ffmpeg/libavutil/blowfish.c
@@ -21,10 +21,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/intreadwrite.h"
-
#include "avutil.h"
#include "common.h"
+#include "intreadwrite.h"
#include "blowfish.h"
static const uint32_t orig_p[AV_BF_ROUNDS + 2] = {
diff --git a/ffmpeg/libavutil/bprint.c b/ffmpeg/libavutil/bprint.c
index fd7611a..7786e3b 100644
--- a/ffmpeg/libavutil/bprint.c
+++ b/ffmpeg/libavutil/bprint.c
@@ -26,6 +26,7 @@
#include "avstring.h"
#include "bprint.h"
#include "common.h"
+#include "compat/va_copy.h"
#include "error.h"
#include "mem.h"
@@ -113,6 +114,29 @@ void av_bprintf(AVBPrint *buf, const char *fmt, ...)
av_bprint_grow(buf, extra_len);
}
+void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg)
+{
+ unsigned room;
+ char *dst;
+ int extra_len;
+ va_list vl;
+
+ while (1) {
+ room = av_bprint_room(buf);
+ dst = room ? buf->str + buf->len : NULL;
+ va_copy(vl, vl_arg);
+ extra_len = vsnprintf(dst, room, fmt, vl);
+ va_end(vl);
+ if (extra_len <= 0)
+ return;
+ if (extra_len < room)
+ break;
+ if (av_bprint_alloc(buf, extra_len))
+ break;
+ }
+ av_bprint_grow(buf, extra_len);
+}
+
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
{
unsigned room, real_n;
@@ -131,6 +155,24 @@ void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
av_bprint_grow(buf, n);
}
+void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
+{
+ unsigned room, real_n;
+
+ while (1) {
+ room = av_bprint_room(buf);
+ if (size < room)
+ break;
+ if (av_bprint_alloc(buf, size))
+ break;
+ }
+ if (room) {
+ real_n = FFMIN(size, room - 1);
+ memcpy(buf->str + buf->len, data, real_n);
+ }
+ av_bprint_grow(buf, size);
+}
+
void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm)
{
unsigned room;
diff --git a/ffmpeg/libavutil/bprint.h b/ffmpeg/libavutil/bprint.h
index df78916..839ec1e 100644
--- a/ffmpeg/libavutil/bprint.h
+++ b/ffmpeg/libavutil/bprint.h
@@ -21,6 +21,8 @@
#ifndef AVUTIL_BPRINT_H
#define AVUTIL_BPRINT_H
+#include <stdarg.h>
+
#include "attributes.h"
#include "avstring.h"
@@ -74,10 +76,10 @@
*/
typedef struct AVBPrint {
FF_PAD_STRUCTURE(1024,
- char *str; /** string so far */
- unsigned len; /** length so far */
- unsigned size; /** allocated memory */
- unsigned size_max; /** maximum allocated memory */
+ char *str; /**< string so far */
+ unsigned len; /**< length so far */
+ unsigned size; /**< allocated memory */
+ unsigned size_max; /**< maximum allocated memory */
char reserved_internal_buffer[1];
)
} AVBPrint;
@@ -122,10 +124,24 @@ void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size);
void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3);
/**
+ * Append a formatted string to a print buffer.
+ */
+void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg);
+
+/**
* Append char c n times to a print buffer.
*/
void av_bprint_chars(AVBPrint *buf, char c, unsigned n);
+/**
+ * Append data to a print buffer.
+ *
+ * param buf bprint buffer to use
+ * param data pointer to data
+ * param size size of data
+ */
+void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size);
+
struct tm;
/**
* Append a formatted date and time to a print buffer.
diff --git a/ffmpeg/libavutil/buffer.c b/ffmpeg/libavutil/buffer.c
index fc389a5..e9bf54b 100644
--- a/ffmpeg/libavutil/buffer.c
+++ b/ffmpeg/libavutil/buffer.c
@@ -125,6 +125,16 @@ int av_buffer_is_writable(const AVBufferRef *buf)
return avpriv_atomic_int_get(&buf->buffer->refcount) == 1;
}
+void *av_buffer_get_opaque(const AVBufferRef *buf)
+{
+ return buf->buffer->opaque;
+}
+
+int av_buffer_get_ref_count(const AVBufferRef *buf)
+{
+ return buf->buffer->refcount;
+}
+
int av_buffer_make_writable(AVBufferRef **pbuf)
{
AVBufferRef *newbuf, *buf = *pbuf;
@@ -276,6 +286,10 @@ static void pool_release_buffer(void *opaque, uint8_t *data)
{
BufferPoolEntry *buf = opaque;
AVBufferPool *pool = buf->pool;
+
+ if(CONFIG_MEMORY_POISONING)
+ memset(buf->data, FF_MEMORY_POISON, pool->size);
+
add_to_pool(buf);
if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))
buffer_pool_free(pool);
diff --git a/ffmpeg/libavutil/buffer.h b/ffmpeg/libavutil/buffer.h
index e33775a..b4399fd 100644
--- a/ffmpeg/libavutil/buffer.h
+++ b/ffmpeg/libavutil/buffer.h
@@ -121,8 +121,8 @@ AVBufferRef *av_buffer_allocz(int size);
* If this function fails, data is left untouched.
* @param data data array
* @param size size of data in bytes
- * @param free a callback for freeing data
- * @param opaque parameter to be passed to free
+ * @param free a callback for freeing this buffer's data
+ * @param opaque parameter to be got for processing or passed to free
* @param flags a combination of AV_BUFFER_FLAG_*
*
* @return an AVBufferRef referring to data on success, NULL on failure.
@@ -163,6 +163,13 @@ void av_buffer_unref(AVBufferRef **buf);
int av_buffer_is_writable(const AVBufferRef *buf);
/**
+ * @return the opaque parameter set by av_buffer_create.
+ */
+void *av_buffer_get_opaque(const AVBufferRef *buf);
+
+int av_buffer_get_ref_count(const AVBufferRef *buf);
+
+/**
* Create a writable reference from a given buffer reference, avoiding data copy
* if possible.
*
diff --git a/ffmpeg/libavutil/channel_layout.c b/ffmpeg/libavutil/channel_layout.c
index e582760..4c0677f 100644
--- a/ffmpeg/libavutil/channel_layout.c
+++ b/ffmpeg/libavutil/channel_layout.c
@@ -23,6 +23,8 @@
* audio channel layout utility functions
*/
+#include <stdint.h>
+
#include "avstring.h"
#include "avutil.h"
#include "channel_layout.h"
@@ -103,7 +105,11 @@ static const struct {
{ "downmix", 2, AV_CH_LAYOUT_STEREO_DOWNMIX, },
};
+#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
+static uint64_t get_channel_layout_single(const char *name, int name_len, int compat)
+#else
static uint64_t get_channel_layout_single(const char *name, int name_len)
+#endif
{
int i;
char *end;
@@ -120,16 +126,40 @@ static uint64_t get_channel_layout_single(const char *name, int name_len)
!memcmp(channel_names[i].name, name, name_len))
return (int64_t)1 << i;
i = strtol(name, &end, 10);
- if (end - name == name_len ||
- (end + 1 - name == name_len && *end == 'c'))
+
+#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
+ if (compat) {
+ if (end - name == name_len ||
+ (end + 1 - name == name_len && *end == 'c')) {
+ layout = av_get_default_channel_layout(i);
+ if (end - name == name_len) {
+ av_log(NULL, AV_LOG_WARNING,
+ "Single channel layout '%.*s' is interpreted as a number of channels, "
+ "switch to the syntax '%.*sc' otherwise it will be interpreted as a "
+ "channel layout number in a later version\n",
+ name_len, name, name_len, name);
+ return layout;
+ }
+ }
+ } else {
+#endif
+ if ((end + 1 - name == name_len && *end == 'c'))
return av_get_default_channel_layout(i);
+#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
+ }
+#endif
+
layout = strtoll(name, &end, 0);
if (end - name == name_len)
return FFMAX(layout, 0);
return 0;
}
+#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
+uint64_t ff_get_channel_layout(const char *name, int compat)
+#else
uint64_t av_get_channel_layout(const char *name)
+#endif
{
const char *n, *e;
const char *name_end = name + strlen(name);
@@ -137,7 +167,11 @@ uint64_t av_get_channel_layout(const char *name)
for (n = name; n < name_end; n = e + 1) {
for (e = n; e < name_end && *e != '+' && *e != '|'; e++);
+#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
+ layout_single = get_channel_layout_single(n, e - n, compat);
+#else
layout_single = get_channel_layout_single(n, e - n);
+#endif
if (!layout_single)
return 0;
layout |= layout_single;
@@ -145,6 +179,13 @@ uint64_t av_get_channel_layout(const char *name)
return layout;
}
+#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
+uint64_t av_get_channel_layout(const char *name)
+{
+ return ff_get_channel_layout(name, 1);
+}
+#endif
+
void av_bprint_channel_layout(struct AVBPrint *bp,
int nb_channels, uint64_t channel_layout)
{
diff --git a/ffmpeg/libavutil/channel_layout.h b/ffmpeg/libavutil/channel_layout.h
index 2906098..ba4f96d 100644
--- a/ffmpeg/libavutil/channel_layout.h
+++ b/ffmpeg/libavutil/channel_layout.h
@@ -136,7 +136,12 @@ enum AVMatrixEncoding {
* - a channel layout mask, in hexadecimal starting with "0x" (see the
* AV_CH_* macros).
*
- * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7"
+ * @warning Starting from the next major bump the trailing character
+ * 'c' to specify a number of channels will be required, while a
+ * channel layout mask could also be specified as a decimal number
+ * (if and only if not followed by "c").
+ *
+ * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
*/
uint64_t av_get_channel_layout(const char *name);
diff --git a/ffmpeg/libavutil/common.h b/ffmpeg/libavutil/common.h
index beaf9f7..c82a3a6 100644
--- a/ffmpeg/libavutil/common.h
+++ b/ffmpeg/libavutil/common.h
@@ -26,10 +26,15 @@
#ifndef AVUTIL_COMMON_H
#define AVUTIL_COMMON_H
+#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
+#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
+#endif
+
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -48,6 +53,9 @@
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
/* assume b>0 */
#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
+/* assume a>0 and b>0 */
+#define FF_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
+ : ((a) + (1<<(b)) - 1) >> (b))
#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
@@ -172,7 +180,7 @@ static av_always_inline av_const int16_t av_clip_int16_c(int a)
*/
static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
{
- if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
+ if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF);
else return (int32_t)a;
}
@@ -229,6 +237,23 @@ static av_always_inline av_const float av_clipf_c(float a, float amin, float ama
else return a;
}
+/**
+ * Clip a double value into the amin-amax range.
+ * @param a value to clip
+ * @param amin minimum value of the clip range
+ * @param amax maximum value of the clip range
+ * @return clipped value
+ */
+static av_always_inline av_const double av_clipd_c(double a, double amin, double amax)
+{
+#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2
+ if (amin > amax) abort();
+#endif
+ if (a < amin) return amin;
+ else if (a > amax) return amax;
+ else return a;
+}
+
/** Compute ceil(log2(x)).
* @param x value used to compute ceil(log2(x))
* @return computed ceiling of log2(x)
@@ -259,7 +284,7 @@ static av_always_inline av_const int av_popcount_c(uint32_t x)
*/
static av_always_inline av_const int av_popcount64_c(uint64_t x)
{
- return av_popcount((uint32_t)x) + av_popcount(x >> 32);
+ return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32));
}
#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
@@ -275,12 +300,17 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
* input, this could be *ptr++.
* @param ERROR Expression to be evaluated on invalid input,
* typically a goto statement.
+ *
+ * @warning ERROR should not contain a loop control statement which
+ * could interact with the internal while loop, and should force an
+ * exit from the macro code (e.g. through a goto or a return) in order
+ * to prevent undefined results.
*/
#define GET_UTF8(val, GET_BYTE, ERROR)\
val= GET_BYTE;\
{\
uint32_t top = (val & 128) >> 1;\
- if ((val & 0xc0) == 0x80)\
+ if ((val & 0xc0) == 0x80 || val >= 0xFE)\
ERROR\
while (val & top) {\
int tmp= GET_BYTE - 128;\
@@ -428,6 +458,9 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x)
#ifndef av_clipf
# define av_clipf av_clipf_c
#endif
+#ifndef av_clipd
+# define av_clipd av_clipd_c
+#endif
#ifndef av_popcount
# define av_popcount av_popcount_c
#endif
diff --git a/ffmpeg/libavutil/cpu.c b/ffmpeg/libavutil/cpu.c
index a1d1547..e0806b1 100644
--- a/ffmpeg/libavutil/cpu.c
+++ b/ffmpeg/libavutil/cpu.c
@@ -16,9 +16,33 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdint.h>
+
#include "cpu.h"
+#include "cpu_internal.h"
#include "config.h"
#include "opt.h"
+#include "common.h"
+
+#if HAVE_SCHED_GETAFFINITY
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#include <sched.h>
+#endif
+#if HAVE_GETPROCESSAFFINITYMASK
+#include <windows.h>
+#endif
+#if HAVE_SYSCTL
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
+#if HAVE_SYSCONF
+#include <unistd.h>
+#endif
static int flags, checked;
@@ -63,6 +87,7 @@ int av_parse_cpu_flags(const char *s)
#define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42)
#define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX)
#define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX)
+#define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX)
static const AVOption cpuflags_opts[] = {
{ "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
#if ARCH_PPC
@@ -82,6 +107,7 @@ int av_parse_cpu_flags(const char *s)
{ "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX }, .unit = "flags" },
{ "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP }, .unit = "flags" },
{ "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4 }, .unit = "flags" },
+ { "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX2 }, .unit = "flags" },
{ "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW }, .unit = "flags" },
{ "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT }, .unit = "flags" },
{ "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" },
@@ -173,6 +199,43 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
return av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, flags);
}
+
+int av_cpu_count(void)
+{
+ static volatile int printed;
+
+ int nb_cpus = 1;
+#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)
+ cpu_set_t cpuset;
+
+ CPU_ZERO(&cpuset);
+
+ if (!sched_getaffinity(0, sizeof(cpuset), &cpuset))
+ nb_cpus = CPU_COUNT(&cpuset);
+#elif HAVE_GETPROCESSAFFINITYMASK
+ DWORD_PTR proc_aff, sys_aff;
+ if (GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff))
+ nb_cpus = av_popcount64(proc_aff);
+#elif HAVE_SYSCTL && defined(HW_NCPU)
+ int mib[2] = { CTL_HW, HW_NCPU };
+ size_t len = sizeof(nb_cpus);
+
+ if (sysctl(mib, 2, &nb_cpus, &len, NULL, 0) == -1)
+ nb_cpus = 0;
+#elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN)
+ nb_cpus = sysconf(_SC_NPROC_ONLN);
+#elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)
+ nb_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+#endif
+
+ if (!printed) {
+ av_log(NULL, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);
+ printed = 1;
+ }
+
+ return nb_cpus;
+}
+
#ifdef TEST
#include <stdio.h>
@@ -208,6 +271,7 @@ static const struct {
{ AV_CPU_FLAG_3DNOW, "3dnow" },
{ AV_CPU_FLAG_3DNOWEXT, "3dnowext" },
{ AV_CPU_FLAG_CMOV, "cmov" },
+ { AV_CPU_FLAG_AVX2, "avx2" },
#endif
{ 0 }
};
diff --git a/ffmpeg/libavutil/cpu.h b/ffmpeg/libavutil/cpu.h
index c8f34e0..55c3ec9 100644
--- a/ffmpeg/libavutil/cpu.h
+++ b/ffmpeg/libavutil/cpu.h
@@ -33,9 +33,11 @@
#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
+ ///< than regular MMX/SSE (e.g. Core1)
#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
+ ///< than regular MMX/SSE (e.g. Core1)
#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
@@ -48,6 +50,7 @@
// #else
// #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction
// #endif
+#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used
#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
@@ -100,9 +103,9 @@ int av_parse_cpu_flags(const char *s);
*/
int av_parse_cpu_caps(unsigned *flags, const char *s);
-/* The following CPU-specific functions shall not be called directly. */
-int ff_get_cpu_flags_arm(void);
-int ff_get_cpu_flags_ppc(void);
-int ff_get_cpu_flags_x86(void);
+/**
+ * @return the number of logical CPU cores present.
+ */
+int av_cpu_count(void);
#endif /* AVUTIL_CPU_H */
diff --git a/ffmpeg/libavutil/crc.c b/ffmpeg/libavutil/crc.c
index 9ee5efe..b429fe1 100644
--- a/ffmpeg/libavutil/crc.c
+++ b/ffmpeg/libavutil/crc.c
@@ -119,6 +119,45 @@ static const AVCRC av_crc_table[AV_CRC_MAX][257] = {
0x176E, 0x367E, 0x554E, 0x745E, 0x932E, 0xB23E, 0xD10E, 0xF01E,
0x0001
},
+ [AV_CRC_24_IEEE] = {
+ 0x000000, 0xFB4C86, 0x0DD58A, 0xF6990C, 0xE1E693, 0x1AAA15, 0xEC3319,
+ 0x177F9F, 0x3981A1, 0xC2CD27, 0x34542B, 0xCF18AD, 0xD86732, 0x232BB4,
+ 0xD5B2B8, 0x2EFE3E, 0x894EC5, 0x720243, 0x849B4F, 0x7FD7C9, 0x68A856,
+ 0x93E4D0, 0x657DDC, 0x9E315A, 0xB0CF64, 0x4B83E2, 0xBD1AEE, 0x465668,
+ 0x5129F7, 0xAA6571, 0x5CFC7D, 0xA7B0FB, 0xE9D10C, 0x129D8A, 0xE40486,
+ 0x1F4800, 0x08379F, 0xF37B19, 0x05E215, 0xFEAE93, 0xD050AD, 0x2B1C2B,
+ 0xDD8527, 0x26C9A1, 0x31B63E, 0xCAFAB8, 0x3C63B4, 0xC72F32, 0x609FC9,
+ 0x9BD34F, 0x6D4A43, 0x9606C5, 0x81795A, 0x7A35DC, 0x8CACD0, 0x77E056,
+ 0x591E68, 0xA252EE, 0x54CBE2, 0xAF8764, 0xB8F8FB, 0x43B47D, 0xB52D71,
+ 0x4E61F7, 0xD2A319, 0x29EF9F, 0xDF7693, 0x243A15, 0x33458A, 0xC8090C,
+ 0x3E9000, 0xC5DC86, 0xEB22B8, 0x106E3E, 0xE6F732, 0x1DBBB4, 0x0AC42B,
+ 0xF188AD, 0x0711A1, 0xFC5D27, 0x5BEDDC, 0xA0A15A, 0x563856, 0xAD74D0,
+ 0xBA0B4F, 0x4147C9, 0xB7DEC5, 0x4C9243, 0x626C7D, 0x9920FB, 0x6FB9F7,
+ 0x94F571, 0x838AEE, 0x78C668, 0x8E5F64, 0x7513E2, 0x3B7215, 0xC03E93,
+ 0x36A79F, 0xCDEB19, 0xDA9486, 0x21D800, 0xD7410C, 0x2C0D8A, 0x02F3B4,
+ 0xF9BF32, 0x0F263E, 0xF46AB8, 0xE31527, 0x1859A1, 0xEEC0AD, 0x158C2B,
+ 0xB23CD0, 0x497056, 0xBFE95A, 0x44A5DC, 0x53DA43, 0xA896C5, 0x5E0FC9,
+ 0xA5434F, 0x8BBD71, 0x70F1F7, 0x8668FB, 0x7D247D, 0x6A5BE2, 0x911764,
+ 0x678E68, 0x9CC2EE, 0xA44733, 0x5F0BB5, 0xA992B9, 0x52DE3F, 0x45A1A0,
+ 0xBEED26, 0x48742A, 0xB338AC, 0x9DC692, 0x668A14, 0x901318, 0x6B5F9E,
+ 0x7C2001, 0x876C87, 0x71F58B, 0x8AB90D, 0x2D09F6, 0xD64570, 0x20DC7C,
+ 0xDB90FA, 0xCCEF65, 0x37A3E3, 0xC13AEF, 0x3A7669, 0x148857, 0xEFC4D1,
+ 0x195DDD, 0xE2115B, 0xF56EC4, 0x0E2242, 0xF8BB4E, 0x03F7C8, 0x4D963F,
+ 0xB6DAB9, 0x4043B5, 0xBB0F33, 0xAC70AC, 0x573C2A, 0xA1A526, 0x5AE9A0,
+ 0x74179E, 0x8F5B18, 0x79C214, 0x828E92, 0x95F10D, 0x6EBD8B, 0x982487,
+ 0x636801, 0xC4D8FA, 0x3F947C, 0xC90D70, 0x3241F6, 0x253E69, 0xDE72EF,
+ 0x28EBE3, 0xD3A765, 0xFD595B, 0x0615DD, 0xF08CD1, 0x0BC057, 0x1CBFC8,
+ 0xE7F34E, 0x116A42, 0xEA26C4, 0x76E42A, 0x8DA8AC, 0x7B31A0, 0x807D26,
+ 0x9702B9, 0x6C4E3F, 0x9AD733, 0x619BB5, 0x4F658B, 0xB4290D, 0x42B001,
+ 0xB9FC87, 0xAE8318, 0x55CF9E, 0xA35692, 0x581A14, 0xFFAAEF, 0x04E669,
+ 0xF27F65, 0x0933E3, 0x1E4C7C, 0xE500FA, 0x1399F6, 0xE8D570, 0xC62B4E,
+ 0x3D67C8, 0xCBFEC4, 0x30B242, 0x27CDDD, 0xDC815B, 0x2A1857, 0xD154D1,
+ 0x9F3526, 0x6479A0, 0x92E0AC, 0x69AC2A, 0x7ED3B5, 0x859F33, 0x73063F,
+ 0x884AB9, 0xA6B487, 0x5DF801, 0xAB610D, 0x502D8B, 0x475214, 0xBC1E92,
+ 0x4A879E, 0xB1CB18, 0x167BE3, 0xED3765, 0x1BAE69, 0xE0E2EF, 0xF79D70,
+ 0x0CD1F6, 0xFA48FA, 0x01047C, 0x2FFA42, 0xD4B6C4, 0x222FC8, 0xD9634E,
+ 0xCE1CD1, 0x355057, 0xC3C95B, 0x3885DD, 0x000001,
+ },
[AV_CRC_32_IEEE] = {
0x00000000, 0xB71DC104, 0x6E3B8209, 0xD926430D, 0xDC760413, 0x6B6BC517,
0xB24D861A, 0x0550471E, 0xB8ED0826, 0x0FF0C922, 0xD6D68A2F, 0x61CB4B2B,
@@ -211,6 +250,11 @@ static const AVCRC av_crc_table[AV_CRC_MAX][257] = {
},
};
#else
+#if CONFIG_SMALL
+#define CRC_TABLE_SIZE 257
+#else
+#define CRC_TABLE_SIZE 1024
+#endif
static struct {
uint8_t le;
uint8_t bits;
@@ -219,10 +263,11 @@ static struct {
[AV_CRC_8_ATM] = { 0, 8, 0x07 },
[AV_CRC_16_ANSI] = { 0, 16, 0x8005 },
[AV_CRC_16_CCITT] = { 0, 16, 0x1021 },
+ [AV_CRC_24_IEEE] = { 0, 24, 0x864CFB },
[AV_CRC_32_IEEE] = { 0, 32, 0x04C11DB7 },
[AV_CRC_32_IEEE_LE] = { 1, 32, 0xEDB88320 },
};
-static AVCRC av_crc_table[AV_CRC_MAX][257];
+static AVCRC av_crc_table[AV_CRC_MAX][CRC_TABLE_SIZE];
#endif
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)
@@ -302,8 +347,9 @@ int main(void)
{
uint8_t buf[1999];
int i;
- int p[4][3] = { { AV_CRC_32_IEEE_LE, 0xEDB88320, 0x3D5CDD04 },
+ int p[5][3] = { { AV_CRC_32_IEEE_LE, 0xEDB88320, 0x3D5CDD04 },
{ AV_CRC_32_IEEE , 0x04C11DB7, 0xC0F5BAE0 },
+ { AV_CRC_24_IEEE , 0x864CFB , 0xB704CE },
{ AV_CRC_16_ANSI , 0x8005 , 0x1FBB },
{ AV_CRC_8_ATM , 0x07 , 0xE3 }
};
@@ -312,7 +358,7 @@ int main(void)
for (i = 0; i < sizeof(buf); i++)
buf[i] = i + i * i;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 5; i++) {
ctx = av_crc_get_table(p[i][0]);
printf("crc %08X = %X\n", p[i][1], av_crc(ctx, 0, buf, sizeof(buf)));
}
diff --git a/ffmpeg/libavutil/crc.h b/ffmpeg/libavutil/crc.h
index 2bdfca8..f4219ca 100644
--- a/ffmpeg/libavutil/crc.h
+++ b/ffmpeg/libavutil/crc.h
@@ -25,6 +25,12 @@
#include <stddef.h>
#include "attributes.h"
+/**
+ * @defgroup lavu_crc32 CRC32
+ * @ingroup lavu_crypto
+ * @{
+ */
+
typedef uint32_t AVCRC;
typedef enum {
@@ -33,6 +39,7 @@ typedef enum {
AV_CRC_16_CCITT,
AV_CRC_32_IEEE,
AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */
+ AV_CRC_24_IEEE = 12,
AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
}AVCRCId;
@@ -71,4 +78,8 @@ const AVCRC *av_crc_get_table(AVCRCId crc_id);
uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
const uint8_t *buffer, size_t length) av_pure;
+/**
+ * @}
+ */
+
#endif /* AVUTIL_CRC_H */
diff --git a/ffmpeg/libavutil/des.c b/ffmpeg/libavutil/des.c
index a7a5074..57ad0a4 100644
--- a/ffmpeg/libavutil/des.c
+++ b/ffmpeg/libavutil/des.c
@@ -339,7 +339,9 @@ void av_des_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count) {
#ifdef TEST
#include <stdlib.h>
#include <stdio.h>
-#include "libavutil/time.h"
+
+#include "time.h"
+
static uint64_t rand64(void) {
uint64_t r = rand();
r = (r << 32) | rand();
diff --git a/ffmpeg/libavutil/dict.c b/ffmpeg/libavutil/dict.c
index 3cd7156..3a0e84c 100644
--- a/ffmpeg/libavutil/dict.c
+++ b/ffmpeg/libavutil/dict.c
@@ -48,8 +48,8 @@ av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int
for(; i<m->count; i++){
const char *s= m->elems[i].key;
- if(flags & AV_DICT_MATCH_CASE) for(j=0; s[j] == key[j] && key[j]; j++);
- else for(j=0; av_toupper(s[j]) == av_toupper(key[j]) && key[j]; j++);
+ if(flags & AV_DICT_MATCH_CASE) for(j=0; s[j] == key[j] && key[j]; j++);
+ else for(j=0; av_toupper(s[j]) == av_toupper(key[j]) && key[j]; j++);
if(key[j])
continue;
if(s[j] && !(flags & AV_DICT_IGNORE_SUFFIX))
@@ -86,9 +86,9 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags
}
if (value) {
if (flags & AV_DICT_DONT_STRDUP_KEY) {
- m->elems[m->count].key = (char*)(intptr_t)key;
+ m->elems[m->count].key = (char*)(intptr_t)key;
} else
- m->elems[m->count].key = av_strdup(key );
+ m->elems[m->count].key = av_strdup(key);
if (flags & AV_DICT_DONT_STRDUP_VAL) {
m->elems[m->count].value = (char*)(intptr_t)value;
} else if (oldval && flags & AV_DICT_APPEND) {
diff --git a/ffmpeg/libavutil/dict.h b/ffmpeg/libavutil/dict.h
index 38f03a4..63c830a 100644
--- a/ffmpeg/libavutil/dict.h
+++ b/ffmpeg/libavutil/dict.h
@@ -64,12 +64,13 @@
*
*/
-#define AV_DICT_MATCH_CASE 1
-#define AV_DICT_IGNORE_SUFFIX 2
+#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */
+#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key,
+ ignoring the suffix of the found key string. Only relevant in av_dict_get(). */
#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been
- allocated with av_malloc() and children. */
+ allocated with av_malloc() or another memory allocation function. */
#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
- allocated with av_malloc() and chilren. */
+ allocated with av_malloc() or another memory allocation function. */
#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
delimiter is added, the strings are simply concatenated. */
@@ -84,10 +85,17 @@ typedef struct AVDictionary AVDictionary;
/**
* Get a dictionary entry with matching key.
*
+ * The returned entry key or value must not be changed, or it will
+ * cause undefined behavior.
+ *
+ * To iterate through all the dictionary entries, you can set the matching key
+ * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag.
+ *
* @param prev Set to the previous matching element to find the next.
* If set to NULL the first matching element is returned.
- * @param flags Allows case as well as suffix-insensitive comparisons.
- * @return Found entry or NULL, changing key or value leads to undefined behavior.
+ * @param key matching key
+ * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved
+ * @return found entry or NULL in case no matching entry was found in the dictionary
*/
AVDictionaryEntry *
av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
@@ -113,7 +121,10 @@ int av_dict_count(const AVDictionary *m);
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags);
/**
- * Parse the key/value pairs list and add to a dictionary.
+ * Parse the key/value pairs list and add the parsed entries to a dictionary.
+ *
+ * In case of failure, all the successfully set entries are stored in
+ * *pm. You may need to manually free the created dictionary.
*
* @param key_val_sep a 0-terminated list of characters used to separate
* key from value
diff --git a/ffmpeg/libavutil/eval.c b/ffmpeg/libavutil/eval.c
index 9a688ae..635e538 100644
--- a/ffmpeg/libavutil/eval.c
+++ b/ffmpeg/libavutil/eval.c
@@ -27,6 +27,7 @@
*/
#include <float.h>
+#include "attributes.h"
#include "avutil.h"
#include "common.h"
#include "eval.h"
@@ -52,7 +53,7 @@ typedef struct Parser {
double *var;
} Parser;
-static const AVClass class = { "Eval", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(Parser,log_offset), offsetof(Parser,log_ctx) };
+static const AVClass eval_class = { "Eval", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(Parser,log_offset), offsetof(Parser,log_ctx) };
static const int8_t si_prefixes['z' - 'E' + 1] = {
['y'-'E']= -24,
@@ -145,7 +146,7 @@ struct AVExpr {
e_pow, e_mul, e_div, e_add,
e_last, e_st, e_while, e_taylor, e_root, e_floor, e_ceil, e_trunc,
e_sqrt, e_not, e_random, e_hypot, e_gcd,
- e_if, e_ifnot, e_print, e_bitand, e_bitor,
+ e_if, e_ifnot, e_print, e_bitand, e_bitor, e_between,
} type;
double value; // is sign in other types
union {
@@ -185,6 +186,11 @@ static double eval_expr(Parser *p, AVExpr *e)
e->param[2] ? eval_expr(p, e->param[2]) : 0);
case e_ifnot: return e->value * (!eval_expr(p, e->param[0]) ? eval_expr(p, e->param[1]) :
e->param[2] ? eval_expr(p, e->param[2]) : 0);
+ case e_between: {
+ double d = eval_expr(p, e->param[0]);
+ return e->value * (d >= eval_expr(p, e->param[1]) &&
+ d <= eval_expr(p, e->param[2]));
+ }
case e_print: {
double x = eval_expr(p, e->param[0]);
int level = e->param[1] ? av_clip(eval_expr(p, e->param[1]), INT_MIN, INT_MAX) : AV_LOG_INFO;
@@ -428,6 +434,7 @@ static int parse_primary(AVExpr **e, Parser *p)
else if (strmatch(next, "ifnot" )) d->type = e_ifnot;
else if (strmatch(next, "bitand")) d->type = e_bitand;
else if (strmatch(next, "bitor" )) d->type = e_bitor;
+ else if (strmatch(next, "between"))d->type = e_between;
else {
for (i=0; p->func1_names && p->func1_names[i]; i++) {
if (strmatch(next, p->func1_names[i])) {
@@ -456,7 +463,7 @@ static int parse_primary(AVExpr **e, Parser *p)
return 0;
}
-static AVExpr *new_eval_expr(int type, int value, AVExpr *p0, AVExpr *p1)
+static AVExpr *make_eval_expr(int type, int value, AVExpr *p0, AVExpr *p1)
{
AVExpr *e = av_mallocz(sizeof(AVExpr));
if (!e)
@@ -481,7 +488,7 @@ static int parse_dB(AVExpr **e, Parser *p, int *sign)
for example, -3dB is not the same as -(3dB) */
if (*p->s == '-') {
char *next;
- double av_unused v = strtod(p->s, &next);
+ double av_unused ignored = strtod(p->s, &next);
if (next != p->s && next[0] == 'd' && next[1] == 'B') {
*sign = 0;
return parse_primary(e, p);
@@ -503,7 +510,7 @@ static int parse_factor(AVExpr **e, Parser *p)
av_expr_free(e1);
return ret;
}
- e0 = new_eval_expr(e_pow, 1, e1, e2);
+ e0 = make_eval_expr(e_pow, 1, e1, e2);
if (!e0) {
av_expr_free(e1);
av_expr_free(e2);
@@ -530,7 +537,7 @@ static int parse_term(AVExpr **e, Parser *p)
av_expr_free(e1);
return ret;
}
- e0 = new_eval_expr(c == '*' ? e_mul : e_div, 1, e1, e2);
+ e0 = make_eval_expr(c == '*' ? e_mul : e_div, 1, e1, e2);
if (!e0) {
av_expr_free(e1);
av_expr_free(e2);
@@ -553,7 +560,7 @@ static int parse_subexpr(AVExpr **e, Parser *p)
av_expr_free(e1);
return ret;
}
- e0 = new_eval_expr(e_add, 1, e1, e2);
+ e0 = make_eval_expr(e_add, 1, e1, e2);
if (!e0) {
av_expr_free(e1);
av_expr_free(e2);
@@ -582,7 +589,7 @@ static int parse_expr(AVExpr **e, Parser *p)
av_expr_free(e1);
return ret;
}
- e0 = new_eval_expr(e_last, 1, e1, e2);
+ e0 = make_eval_expr(e_last, 1, e1, e2);
if (!e0) {
av_expr_free(e1);
av_expr_free(e2);
@@ -623,6 +630,10 @@ static int verify_expr(AVExpr *e)
case e_taylor:
return verify_expr(e->param[0]) && verify_expr(e->param[1])
&& (!e->param[2] || verify_expr(e->param[2]));
+ case e_between:
+ return verify_expr(e->param[0]) &&
+ verify_expr(e->param[1]) &&
+ verify_expr(e->param[2]);
default: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && !e->param[2];
}
}
@@ -647,7 +658,7 @@ int av_expr_parse(AVExpr **expr, const char *s,
if (!av_isspace(*s++)) *wp++ = s[-1];
*wp++ = 0;
- p.class = &class;
+ p.class = &eval_class;
p.stack_index=100;
p.s= w;
p.const_names = const_names;
@@ -816,6 +827,9 @@ int main(int argc, char **argv)
"bitor(42, 12)",
"bitand(42, 12)",
"bitand(NAN, 1)",
+ "between(10, -3, 10)",
+ "between(-4, -2, -1)",
+ "between(1,2)",
NULL
};
diff --git a/ffmpeg/libavutil/eval.h b/ffmpeg/libavutil/eval.h
index a1d1fe3..6159b0f 100644
--- a/ffmpeg/libavutil/eval.h
+++ b/ffmpeg/libavutil/eval.h
@@ -45,7 +45,7 @@ typedef struct AVExpr AVExpr;
* @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments
* @param opaque a pointer which will be passed to all functions from funcs1 and funcs2
* @param log_ctx parent logging context
- * @return 0 in case of success, a negative value corresponding to an
+ * @return >= 0 in case of success, a negative value corresponding to an
* AVERROR code otherwise
*/
int av_expr_parse_and_eval(double *res, const char *s,
@@ -68,7 +68,7 @@ int av_expr_parse_and_eval(double *res, const char *s,
* @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers
* @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments
* @param log_ctx parent logging context
- * @return 0 in case of success, a negative value corresponding to an
+ * @return >= 0 in case of success, a negative value corresponding to an
* AVERROR code otherwise
*/
int av_expr_parse(AVExpr **expr, const char *s,
diff --git a/ffmpeg/libavutil/fifo.c b/ffmpeg/libavutil/fifo.c
index bafa9e9..ca25bc5 100644
--- a/ffmpeg/libavutil/fifo.c
+++ b/ffmpeg/libavutil/fifo.c
@@ -19,16 +19,18 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#include "avassert.h"
#include "common.h"
#include "fifo.h"
AVFifoBuffer *av_fifo_alloc(unsigned int size)
{
- AVFifoBuffer *f= av_mallocz(sizeof(AVFifoBuffer));
+ AVFifoBuffer *f = av_mallocz(sizeof(AVFifoBuffer));
if (!f)
return NULL;
f->buffer = av_malloc(size);
- f->end = f->buffer + size;
+ f->end = f->buffer + size;
av_fifo_reset(f);
if (!f->buffer)
av_freep(&f);
@@ -64,7 +66,7 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
unsigned int old_size = f->end - f->buffer;
if (old_size < new_size) {
- int len = av_fifo_size(f);
+ int len = av_fifo_size(f);
AVFifoBuffer *f2 = av_fifo_alloc(new_size);
if (!f2)
@@ -92,8 +94,10 @@ int av_fifo_grow(AVFifoBuffer *f, unsigned int size)
return 0;
}
-// src must NOT be const as it can be a context for func that may need updating (like a pointer or byte counter)
-int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int))
+/* src must NOT be const as it can be a context for func that may need
+ * updating (like a pointer or byte counter) */
+int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size,
+ int (*func)(void *, void *, int))
{
int total = size;
uint32_t wndx= f->wndx;
@@ -106,30 +110,31 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
break;
} else {
memcpy(wptr, src, len);
- src = (uint8_t*)src + len;
+ src = (uint8_t *)src + len;
}
// Write memory barrier needed for SMP here in theory
wptr += len;
if (wptr >= f->end)
wptr = f->buffer;
- wndx += len;
- size -= len;
+ wndx += len;
+ size -= len;
} while (size > 0);
f->wndx= wndx;
f->wptr= wptr;
return total - size;
}
-
-int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int))
+int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size,
+ void (*func)(void *, void *, int))
{
// Read memory barrier needed for SMP here in theory
do {
int len = FFMIN(f->end - f->rptr, buf_size);
- if(func) func(dest, f->rptr, len);
- else{
+ if (func)
+ func(dest, f->rptr, len);
+ else {
memcpy(dest, f->rptr, len);
- dest = (uint8_t*)dest + len;
+ dest = (uint8_t *)dest + len;
}
// memory barrier needed for SMP here in theory
av_fifo_drain(f, len);
@@ -141,6 +146,7 @@ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)
/** Discard data from the FIFO. */
void av_fifo_drain(AVFifoBuffer *f, int size)
{
+ av_assert2(av_fifo_size(f) >= size);
f->rptr += size;
if (f->rptr >= f->end)
f->rptr -= f->end - f->buffer;
@@ -160,9 +166,9 @@ int main(void)
av_fifo_generic_write(fifo, &i, sizeof(int), NULL);
/* peek at FIFO */
- n = av_fifo_size(fifo)/sizeof(int);
- for (i = -n+1; i < n; i++) {
- int *v = (int *)av_fifo_peek2(fifo, i*sizeof(int));
+ n = av_fifo_size(fifo) / sizeof(int);
+ for (i = -n + 1; i < n; i++) {
+ int *v = (int *)av_fifo_peek2(fifo, i * sizeof(int));
printf("%d: %d\n", i, *v);
}
printf("\n");
diff --git a/ffmpeg/libavutil/file.c b/ffmpeg/libavutil/file.c
index 41850f8..45fe853 100644
--- a/ffmpeg/libavutil/file.c
+++ b/ffmpeg/libavutil/file.c
@@ -18,6 +18,7 @@
#include "config.h"
#include "file.h"
+#include "internal.h"
#include "log.h"
#include "mem.h"
#include <fcntl.h>
@@ -49,7 +50,7 @@ int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
int log_offset, void *log_ctx)
{
FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx };
- int err, fd = open(filename, O_RDONLY);
+ int err, fd = avpriv_open(filename, O_RDONLY);
struct stat st;
av_unused void *ptr;
off_t off_size;
diff --git a/ffmpeg/libavutil/file.h b/ffmpeg/libavutil/file.h
index b47ef80..a7364fe 100644
--- a/ffmpeg/libavutil/file.h
+++ b/ffmpeg/libavutil/file.h
@@ -58,7 +58,7 @@ void av_file_unmap(uint8_t *bufptr, size_t size);
* @return file descriptor of opened file (or -1 on error)
* and opened file name in **filename.
* @note On very old libcs it is necessary to set a secure umask before
- * calling this, av_tempfile() cant call umask itself as it is used in
+ * calling this, av_tempfile() can't call umask itself as it is used in
* libraries and could interfere with the calling application.
*/
int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
diff --git a/ffmpeg/libavutil/float_dsp.c b/ffmpeg/libavutil/float_dsp.c
index 7641313..efff47f 100644
--- a/ffmpeg/libavutil/float_dsp.c
+++ b/ffmpeg/libavutil/float_dsp.c
@@ -20,7 +20,7 @@
*/
#include "config.h"
-
+#include "attributes.h"
#include "float_dsp.h"
static void vector_fmul_c(float *dst, const float *src0, const float *src1,
@@ -115,7 +115,7 @@ float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len)
return p;
}
-void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
+av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
{
fdsp->vector_fmul = vector_fmul_c;
fdsp->vector_fmac_scalar = vector_fmac_scalar_c;
diff --git a/ffmpeg/libavutil/frame.c b/ffmpeg/libavutil/frame.c
index 2ec75e4..75a1c28 100644
--- a/ffmpeg/libavutil/frame.c
+++ b/ffmpeg/libavutil/frame.c
@@ -27,10 +27,6 @@
#include "mem.h"
#include "samplefmt.h"
-#define MAKE_ACCESSORS(str, name, type, field) \
- type av_##name##_get_##field(const str *s) { return s->field; } \
- void av_##name##_set_##field(str *s, type v) { s->field = v; }
-
MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
@@ -40,6 +36,8 @@ MAKE_ACCESSORS(AVFrame, frame, int, sample_rate)
MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata)
MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags)
MAKE_ACCESSORS(AVFrame, frame, int, pkt_size)
+MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace)
+MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
#define CHECK_CHANNELS_CONSISTENCY(frame) \
av_assert2(!(frame)->channel_layout || \
@@ -72,6 +70,22 @@ int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type)
return f->qp_table_buf->data;
}
+const char *av_get_colorspace_name(enum AVColorSpace val)
+{
+ static const char *name[] = {
+ [AVCOL_SPC_RGB] = "GBR",
+ [AVCOL_SPC_BT709] = "bt709",
+ [AVCOL_SPC_FCC] = "fcc",
+ [AVCOL_SPC_BT470BG] = "bt470bg",
+ [AVCOL_SPC_SMPTE170M] = "smpte170m",
+ [AVCOL_SPC_SMPTE240M] = "smpte240m",
+ [AVCOL_SPC_YCOCG] = "YCgCo",
+ };
+ if ((unsigned)val >= FF_ARRAY_ELEMS(name))
+ return NULL;
+ return name[val];
+}
+
static void get_frame_defaults(AVFrame *frame)
{
if (frame->extended_data != frame->data)
@@ -89,6 +103,7 @@ static void get_frame_defaults(AVFrame *frame)
frame->key_frame = 1;
frame->sample_aspect_ratio = (AVRational){ 0, 1 };
frame->format = -1; /* unknown */
+ frame->colorspace = AVCOL_SPC_UNSPECIFIED;
frame->extended_data = frame->data;
}
@@ -126,10 +141,14 @@ static int get_video_buffer(AVFrame *frame, int align)
return ret;
if (!frame->linesize[0]) {
- ret = av_image_fill_linesizes(frame->linesize, frame->format,
- frame->width);
- if (ret < 0)
- return ret;
+ for(i=1; i<=align; i+=i) {
+ ret = av_image_fill_linesizes(frame->linesize, frame->format,
+ FFALIGN(frame->width, i));
+ if (ret < 0)
+ return ret;
+ if (!(frame->linesize[0] & (align-1)))
+ break;
+ }
for (i = 0; i < 4 && frame->linesize[i]; i++)
frame->linesize[i] = FFALIGN(frame->linesize[i], align);
@@ -138,15 +157,15 @@ static int get_video_buffer(AVFrame *frame, int align)
for (i = 0; i < 4 && frame->linesize[i]; i++) {
int h = FFALIGN(frame->height, 32);
if (i == 1 || i == 2)
- h = -((-h) >> desc->log2_chroma_h);
+ h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
- frame->buf[i] = av_buffer_alloc(frame->linesize[i] * h + 16);
+ frame->buf[i] = av_buffer_alloc(frame->linesize[i] * h + 16 + 16/*STRIDE_ALIGN*/ - 1);
if (!frame->buf[i])
goto fail;
frame->data[i] = frame->buf[i]->data;
}
- if (desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL) {
+ if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
av_buffer_unref(&frame->buf[1]);
frame->buf[1] = av_buffer_alloc(1024);
if (!frame->buf[1])
@@ -164,11 +183,17 @@ fail:
static int get_audio_buffer(AVFrame *frame, int align)
{
- int channels = frame->channels;
+ int channels;
int planar = av_sample_fmt_is_planar(frame->format);
- int planes = planar ? channels : 1;
+ int planes;
int ret, i;
+ if (!frame->channels)
+ frame->channels = av_get_channel_layout_nb_channels(frame->channel_layout);
+
+ channels = frame->channels;
+ planes = planar ? channels : 1;
+
CHECK_CHANNELS_CONSISTENCY(frame);
if (!frame->linesize[0]) {
ret = av_samples_get_buffer_size(&frame->linesize[0], channels,
@@ -219,13 +244,13 @@ int av_frame_get_buffer(AVFrame *frame, int align)
if (frame->width > 0 && frame->height > 0)
return get_video_buffer(frame, align);
- else if (frame->nb_samples > 0 && frame->channel_layout)
+ else if (frame->nb_samples > 0 && (frame->channel_layout || frame->channels > 0))
return get_audio_buffer(frame, align);
return AVERROR(EINVAL);
}
-int av_frame_ref(AVFrame *dst, AVFrame *src)
+int av_frame_ref(AVFrame *dst, const AVFrame *src)
{
int i, ret = 0;
@@ -259,7 +284,9 @@ int av_frame_ref(AVFrame *dst, AVFrame *src)
}
/* ref the buffers */
- for (i = 0; i < FF_ARRAY_ELEMS(src->buf) && src->buf[i]; i++) {
+ for (i = 0; i < FF_ARRAY_ELEMS(src->buf); i++) {
+ if (!src->buf[i])
+ continue;
dst->buf[i] = av_buffer_ref(src->buf[i]);
if (!dst->buf[i]) {
ret = AVERROR(ENOMEM);
@@ -314,7 +341,7 @@ fail:
return ret;
}
-AVFrame *av_frame_clone(AVFrame *src)
+AVFrame *av_frame_clone(const AVFrame *src)
{
AVFrame *ret = av_frame_alloc();
@@ -366,8 +393,9 @@ int av_frame_is_writable(AVFrame *frame)
if (!frame->buf[0])
return 0;
- for (i = 0; i < FF_ARRAY_ELEMS(frame->buf) && frame->buf[i]; i++)
- ret &= !!av_buffer_is_writable(frame->buf[i]);
+ for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
+ if (frame->buf[i])
+ ret &= !!av_buffer_is_writable(frame->buf[i]);
for (i = 0; i < frame->nb_extended_buf; i++)
ret &= !!av_buffer_is_writable(frame->extended_buf[i]);
@@ -425,31 +453,38 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
{
int i;
- dst->key_frame = src->key_frame;
- dst->pict_type = src->pict_type;
- dst->sample_aspect_ratio = src->sample_aspect_ratio;
- dst->pts = src->pts;
- dst->interlaced_frame = src->interlaced_frame;
- dst->top_field_first = src->top_field_first;
- dst->sample_rate = src->sample_rate;
- dst->opaque = src->opaque;
+ dst->key_frame = src->key_frame;
+ dst->pict_type = src->pict_type;
+ dst->sample_aspect_ratio = src->sample_aspect_ratio;
+ dst->pts = src->pts;
+ dst->repeat_pict = src->repeat_pict;
+ dst->interlaced_frame = src->interlaced_frame;
+ dst->top_field_first = src->top_field_first;
+ dst->palette_has_changed = src->palette_has_changed;
+ dst->sample_rate = src->sample_rate;
+ dst->opaque = src->opaque;
#if FF_API_AVFRAME_LAVC
- dst->type = src->type;
+ dst->type = src->type;
#endif
- dst->pkt_pts = src->pkt_pts;
- dst->pkt_dts = src->pkt_dts;
- dst->pkt_pos = src->pkt_pos;
- dst->pkt_size = src->pkt_size;
- dst->pkt_duration = src->pkt_duration;
- dst->reordered_opaque = src->reordered_opaque;
- dst->quality = src->quality;
- dst->best_effort_timestamp = src->best_effort_timestamp;
- dst->coded_picture_number = src->coded_picture_number;
+ dst->pkt_pts = src->pkt_pts;
+ dst->pkt_dts = src->pkt_dts;
+ dst->pkt_pos = src->pkt_pos;
+ dst->pkt_size = src->pkt_size;
+ dst->pkt_duration = src->pkt_duration;
+ dst->reordered_opaque = src->reordered_opaque;
+ dst->quality = src->quality;
+ dst->best_effort_timestamp = src->best_effort_timestamp;
+ dst->coded_picture_number = src->coded_picture_number;
dst->display_picture_number = src->display_picture_number;
- dst->decode_error_flags = src->decode_error_flags;
+ dst->flags = src->flags;
+ dst->decode_error_flags = src->decode_error_flags;
+ dst->colorspace = src->colorspace;
+ dst->color_range = src->color_range;
av_dict_copy(&dst->metadata, src->metadata, 0);
+ memcpy(dst->error, src->error, sizeof(dst->error));
+
for (i = 0; i < src->nb_side_data; i++) {
const AVFrameSideData *sd_src = src->side_data[i];
AVFrameSideData *sd_dst = av_frame_new_side_data(dst, sd_src->type,
@@ -546,7 +581,7 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
return ret;
}
-AVFrameSideData *av_frame_get_side_data(AVFrame *frame,
+AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
enum AVFrameSideDataType type)
{
int i;
diff --git a/ffmpeg/libavutil/frame.h b/ffmpeg/libavutil/frame.h
index 39a664f..b31cc3e 100644
--- a/ffmpeg/libavutil/frame.h
+++ b/ffmpeg/libavutil/frame.h
@@ -30,11 +30,45 @@
#include "rational.h"
#include "samplefmt.h"
+enum AVColorSpace{
+ AVCOL_SPC_RGB = 0,
+ AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
+ AVCOL_SPC_UNSPECIFIED = 2,
+ AVCOL_SPC_FCC = 4,
+ AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
+ AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
+ AVCOL_SPC_SMPTE240M = 7,
+ AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
+ AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
+ AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
+ AVCOL_SPC_NB , ///< Not part of ABI
+};
+#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG
+
+enum AVColorRange{
+ AVCOL_RANGE_UNSPECIFIED = 0,
+ AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
+ AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges
+ AVCOL_RANGE_NB , ///< Not part of ABI
+};
+
+
enum AVFrameSideDataType {
/**
* The data is the AVPanScan struct defined in libavcodec.
*/
AV_FRAME_DATA_PANSCAN,
+ /**
+ * ATSC A53 Part 4 Closed Captions.
+ * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
+ * The number of bytes of CC data is AVFrameSideData.size.
+ */
+ AV_FRAME_DATA_A53_CC,
+ /**
+ * Stereoscopic 3d metadata.
+ * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
+ */
+ AV_FRAME_DATA_STEREO3D,
};
typedef struct AVFrameSideData {
@@ -97,6 +131,9 @@ typedef struct AVFrame {
* preference, this is 16 or 32 for modern desktop CPUs.
* Some code requires such alignment other code can be slower without
* correct alignment, for yet other it makes no difference.
+ *
+ * @note The linesize may be larger than the size of usable data -- there
+ * may be extra padding present for performance reasons.
*/
int linesize[AV_NUM_DATA_POINTERS];
@@ -363,6 +400,16 @@ typedef struct AVFrame {
AVFrameSideData **side_data;
int nb_side_data;
+/**
+ * The frame data may be corrupted, e.g. due to decoding errors.
+ */
+#define AV_FRAME_FLAG_CORRUPT (1 << 0)
+
+ /**
+ * Frame flags, a combination of AV_FRAME_FLAG_*
+ */
+ int flags;
+
/**
* frame timestamp estimated using various heuristics, in stream time base
* Code outside libavcodec should access this field using:
@@ -433,6 +480,25 @@ typedef struct AVFrame {
int pkt_size;
/**
+ * YUV colorspace type.
+ * It must be accessed using av_frame_get_colorspace() and
+ * av_frame_set_colorspace().
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorSpace colorspace;
+
+ /**
+ * MPEG vs JPEG YUV range.
+ * It must be accessed using av_frame_get_color_range() and
+ * av_frame_set_color_range().
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorRange color_range;
+
+
+ /**
* Not to be accessed directly from outside libavutil
*/
AVBufferRef *qp_table_buf;
@@ -464,6 +530,16 @@ void av_frame_set_pkt_size(AVFrame *frame, int val);
AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame);
int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
+enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
+void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
+enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
+void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
+
+/**
+ * Get the name of a colorspace.
+ * @return a static string identifying the colorspace; can be NULL.
+ */
+const char *av_get_colorspace_name(enum AVColorSpace val);
/**
* Allocate an AVFrame and set its fields to default values. The resulting
@@ -487,7 +563,7 @@ AVFrame *av_frame_alloc(void);
void av_frame_free(AVFrame **frame);
/**
- * Setup a new reference to the data described by an given frame.
+ * Setup a new reference to the data described by a given frame.
*
* Copy frame properties from src to dst and create a new reference for each
* AVBufferRef from src.
@@ -497,7 +573,7 @@ void av_frame_free(AVFrame **frame);
*
* @return 0 on success, a negative AVERROR on error
*/
-int av_frame_ref(AVFrame *dst, AVFrame *src);
+int av_frame_ref(AVFrame *dst, const AVFrame *src);
/**
* Create a new frame that references the same data as src.
@@ -506,7 +582,7 @@ int av_frame_ref(AVFrame *dst, AVFrame *src);
*
* @return newly created AVFrame on success, NULL on error.
*/
-AVFrame *av_frame_clone(AVFrame *src);
+AVFrame *av_frame_clone(const AVFrame *src);
/**
* Unreference all the buffers referenced by frame and reset the frame fields.
@@ -601,7 +677,7 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
* @return a pointer to the side data of a given type on success, NULL if there
* is no side data with such type in this frame.
*/
-AVFrameSideData *av_frame_get_side_data(AVFrame *frame,
+AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
enum AVFrameSideDataType type);
#endif /* AVUTIL_FRAME_H */
diff --git a/ffmpeg/libavutil/hmac.c b/ffmpeg/libavutil/hmac.c
index e5f1434..02bdc18 100644
--- a/ffmpeg/libavutil/hmac.c
+++ b/ffmpeg/libavutil/hmac.c
@@ -20,13 +20,15 @@
#include <string.h>
+#include "attributes.h"
#include "hmac.h"
#include "md5.h"
#include "sha.h"
+#include "sha512.h"
#include "mem.h"
-#define MAX_HASHLEN 20
-#define MAX_BLOCKLEN 64
+#define MAX_HASHLEN 64
+#define MAX_BLOCKLEN 128
struct AVHMAC {
void *hash;
@@ -38,11 +40,24 @@ struct AVHMAC {
int keylen;
};
-static void sha1_init(void *ctx)
-{
- av_sha_init(ctx, 160);
+#define DEFINE_SHA(bits) \
+static av_cold void sha ## bits ##_init(void *ctx) \
+{ \
+ av_sha_init(ctx, bits); \
+}
+
+#define DEFINE_SHA512(bits) \
+static av_cold void sha ## bits ##_init(void *ctx) \
+{ \
+ av_sha512_init(ctx, bits); \
}
+DEFINE_SHA(160)
+DEFINE_SHA(224)
+DEFINE_SHA(256)
+DEFINE_SHA512(384)
+DEFINE_SHA512(512)
+
AVHMAC *av_hmac_alloc(enum AVHMACType type)
{
AVHMAC *c = av_mallocz(sizeof(*c));
@@ -52,19 +67,51 @@ AVHMAC *av_hmac_alloc(enum AVHMACType type)
case AV_HMAC_MD5:
c->blocklen = 64;
c->hashlen = 16;
- c->init = av_md5_init;
- c->update = av_md5_update;
- c->final = av_md5_final;
+ c->init = (void*)av_md5_init;
+ c->update = (void*)av_md5_update;
+ c->final = (void*)av_md5_final;
c->hash = av_md5_alloc();
break;
case AV_HMAC_SHA1:
c->blocklen = 64;
c->hashlen = 20;
- c->init = sha1_init;
- c->update = av_sha_update;
- c->final = av_sha_final;
+ c->init = sha160_init;
+ c->update = (void*)av_sha_update;
+ c->final = (void*)av_sha_final;
+ c->hash = av_sha_alloc();
+ break;
+ case AV_HMAC_SHA224:
+ c->blocklen = 64;
+ c->hashlen = 28;
+ c->init = sha224_init;
+ c->update = (void*)av_sha_update;
+ c->final = (void*)av_sha_final;
+ c->hash = av_sha_alloc();
+ break;
+ case AV_HMAC_SHA256:
+ c->blocklen = 64;
+ c->hashlen = 32;
+ c->init = sha256_init;
+ c->update = (void*)av_sha_update;
+ c->final = (void*)av_sha_final;
c->hash = av_sha_alloc();
break;
+ case AV_HMAC_SHA384:
+ c->blocklen = 128;
+ c->hashlen = 48;
+ c->init = sha384_init;
+ c->update = (void*)av_sha512_update;
+ c->final = (void*)av_sha512_final;
+ c->hash = av_sha512_alloc();
+ break;
+ case AV_HMAC_SHA512:
+ c->blocklen = 128;
+ c->hashlen = 64;
+ c->init = sha512_init;
+ c->update = (void*)av_sha512_update;
+ c->final = (void*)av_sha512_final;
+ c->hash = av_sha512_alloc();
+ break;
default:
av_free(c);
return NULL;
@@ -159,28 +206,54 @@ static void test(AVHMAC *hmac, const uint8_t *key, int keylen,
int main(void)
{
- uint8_t key1[16], key3[16], data3[50], key4[63], key5[64], key6[65];
- const uint8_t key2[] = "Jefe";
- const uint8_t data1[] = "Hi There";
- const uint8_t data2[] = "what do ya want for nothing?";
+ uint8_t key1[20], key3[131], data3[50];
+ enum AVHMACType i = AV_HMAC_SHA224;
+ static const uint8_t key2[] = "Jefe";
+ static const uint8_t data1[] = "Hi There";
+ static const uint8_t data2[] = "what do ya want for nothing?";
+ static const uint8_t data4[] = "Test Using Larger Than Block-Size Key - Hash Key First";
+ static const uint8_t data5[] = "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data";
+ static const uint8_t data6[] = "This is a test using a larger than block-size key and a larger "
+ "than block-size data. The key needs to be hashed before being used"
+ " by the HMAC algorithm.";
AVHMAC *hmac = av_hmac_alloc(AV_HMAC_MD5);
if (!hmac)
return 1;
memset(key1, 0x0b, sizeof(key1));
memset(key3, 0xaa, sizeof(key3));
- memset(key4, 0x44, sizeof(key4));
- memset(key5, 0x55, sizeof(key5));
- memset(key6, 0x66, sizeof(key6));
memset(data3, 0xdd, sizeof(data3));
- // RFC 2104 test vectors
+ // RFC 2202 test vectors
+ test(hmac, key1, 16, data1, sizeof(data1));
+ test(hmac, key2, sizeof(key2), data2, sizeof(data2));
+ test(hmac, key3, 16, data3, sizeof(data3));
+ test(hmac, key3, 80, data4, sizeof(data4));
+ test(hmac, key3, 80, data5, sizeof(data5));
+ av_hmac_free(hmac);
+
+ /* SHA-1 */
+ hmac = av_hmac_alloc(AV_HMAC_SHA1);
+ if (!hmac)
+ return 1;
+ // RFC 2202 test vectors
test(hmac, key1, sizeof(key1), data1, sizeof(data1));
test(hmac, key2, sizeof(key2), data2, sizeof(data2));
- test(hmac, key3, sizeof(key3), data3, sizeof(data3));
- // Additional tests, to test cases where the key is too long
- test(hmac, key4, sizeof(key4), data1, sizeof(data1));
- test(hmac, key5, sizeof(key5), data2, sizeof(data2));
- test(hmac, key6, sizeof(key6), data3, sizeof(data3));
+ test(hmac, key3, 20, data3, sizeof(data3));
+ test(hmac, key3, 80, data4, sizeof(data4));
+ test(hmac, key3, 80, data5, sizeof(data5));
av_hmac_free(hmac);
+
+ /* SHA-2 */
+ while (i <= AV_HMAC_SHA512) {
+ hmac = av_hmac_alloc(i);
+ // RFC 4231 test vectors
+ test(hmac, key1, sizeof(key1), data1, sizeof(data1));
+ test(hmac, key2, sizeof(key2), data2, sizeof(data2));
+ test(hmac, key3, 20, data3, sizeof(data3));
+ test(hmac, key3, sizeof(key3), data4, sizeof(data4));
+ test(hmac, key3, sizeof(key3), data6, sizeof(data6));
+ av_hmac_free(hmac);
+ i++;
+ }
return 0;
}
#endif /* TEST */
diff --git a/ffmpeg/libavutil/hmac.h b/ffmpeg/libavutil/hmac.h
index aef84c6..d36d4de 100644
--- a/ffmpeg/libavutil/hmac.h
+++ b/ffmpeg/libavutil/hmac.h
@@ -32,6 +32,10 @@
enum AVHMACType {
AV_HMAC_MD5,
AV_HMAC_SHA1,
+ AV_HMAC_SHA224 = 10,
+ AV_HMAC_SHA256,
+ AV_HMAC_SHA384,
+ AV_HMAC_SHA512,
};
typedef struct AVHMAC AVHMAC;
diff --git a/ffmpeg/libavutil/imgutils.c b/ffmpeg/libavutil/imgutils.c
index 3060b07..d8a579f 100644
--- a/ffmpeg/libavutil/imgutils.c
+++ b/ffmpeg/libavutil/imgutils.c
@@ -65,7 +65,7 @@ int image_get_linesize(int width, int plane,
return AVERROR(EINVAL);
linesize = max_step * shifted_w;
- if (desc->flags & PIX_FMT_BITSTREAM)
+ if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
linesize = (linesize + 7) >> 3;
return linesize;
}
@@ -76,7 +76,7 @@ int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
int max_step [4]; /* max pixel step for each plane */
int max_step_comp[4]; /* the component for each plane which has the max pixel step */
- if ((unsigned)pix_fmt >= AV_PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL)
+ if ((unsigned)pix_fmt >= AV_PIX_FMT_NB || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
return AVERROR(EINVAL);
av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
@@ -92,7 +92,7 @@ int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int wi
memset(linesizes, 0, 4*sizeof(linesizes[0]));
- if (!desc || desc->flags & PIX_FMT_HWACCEL)
+ if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
return AVERROR(EINVAL);
av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
@@ -113,7 +113,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
memset(data , 0, sizeof(data[0])*4);
- if (!desc || desc->flags & PIX_FMT_HWACCEL)
+ if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
return AVERROR(EINVAL);
data[0] = ptr;
@@ -121,8 +121,8 @@ int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int hei
return AVERROR(EINVAL);
size[0] = linesizes[0] * height;
- if (desc->flags & PIX_FMT_PAL ||
- desc->flags & PIX_FMT_PSEUDOPAL) {
+ if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
+ desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
size[0] = (size[0] + 3) & ~3;
data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */
return size[0] + 256 * 4;
@@ -214,7 +214,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
av_free(buf);
return ret;
}
- if (desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL)
+ if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
return ret;
@@ -260,11 +260,11 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
- if (!desc || desc->flags & PIX_FMT_HWACCEL)
+ if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
return;
- if (desc->flags & PIX_FMT_PAL ||
- desc->flags & PIX_FMT_PSEUDOPAL) {
+ if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
+ desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
av_image_copy_plane(dst_data[0], dst_linesizes[0],
src_data[0], src_linesizes[0],
width, height);
@@ -284,7 +284,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
return;
}
if (i == 1 || i == 2) {
- h= -((-height)>>desc->log2_chroma_h);
+ h = FF_CEIL_RSHIFT(height, desc->log2_chroma_h);
}
av_image_copy_plane(dst_data[i], dst_linesizes[i],
src_data[i], src_linesizes[i],
@@ -324,7 +324,7 @@ int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height,
return AVERROR(EINVAL);
if (av_image_check_size(width, height, 0, NULL) < 0)
return AVERROR(EINVAL);
- if (desc->flags & PIX_FMT_PSEUDOPAL)
+ if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
// do not include palette for these pseudo-paletted formats
return width * height;
return av_image_fill_arrays(data, linesize, NULL, pix_fmt, width, height, align);
@@ -358,7 +358,7 @@ int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
}
}
- if (desc->flags & PIX_FMT_PAL) {
+ if (desc->flags & AV_PIX_FMT_FLAG_PAL) {
uint32_t *d32 = (uint32_t *)(((size_t)dst + 3) & ~3);
for (i = 0; i<256; i++)
AV_WL32(d32 + i, AV_RN32(src_data[1] + 4*i));
diff --git a/ffmpeg/libavutil/internal.h b/ffmpeg/libavutil/internal.h
index 6ff14fa..9c5546f 100644
--- a/ffmpeg/libavutil/internal.h
+++ b/ffmpeg/libavutil/internal.h
@@ -39,6 +39,7 @@
#include "timer.h"
#include "cpu.h"
#include "dict.h"
+#include "version.h"
#if ARCH_X86
# include "x86/emms.h"
@@ -62,10 +63,32 @@
# define av_export
#endif
+#if HAVE_PRAGMA_DEPRECATED
+# if defined(__ICL) || defined (__INTEL_COMPILER)
+# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478))
+# define FF_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop))
+# elif defined(_MSC_VER)
+# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996))
+# define FF_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop))
+# else
+# define FF_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+# define FF_ENABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
+# endif
+#else
+# define FF_DISABLE_DEPRECATION_WARNINGS
+# define FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
#ifndef INT_BIT
# define INT_BIT (CHAR_BIT * sizeof(int))
#endif
+#define FF_MEMORY_POISON 0x2a
+
+#define MAKE_ACCESSORS(str, name, type, field) \
+ type av_##name##_get_##field(const str *s) { return s->field; } \
+ void av_##name##_set_##field(str *s, type v) { s->field = v; }
+
// Some broken preprocessors need a second expansion
// to be forced to tokenize __VA_ARGS__
#define E1(x) x
@@ -112,6 +135,11 @@
#include "libm.h"
+#if defined(_MSC_VER)
+#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_strtod")
+#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_snprintf")
+#endif
+
/**
* Return NULL if CONFIG_SMALL is true, otherwise the argument
* without modification. Used to disable the definition of strings
@@ -183,4 +211,17 @@ void avpriv_report_missing_feature(void *avc,
void avpriv_request_sample(void *avc,
const char *msg, ...) av_printf_format(2, 3);
+#if HAVE_LIBC_MSVCRT
+#define avpriv_open ff_open
+#endif
+
+/**
+ * A wrapper for open() setting O_CLOEXEC.
+ */
+int avpriv_open(const char *filename, int flags, ...);
+
+#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
+uint64_t ff_get_channel_layout(const char *name, int compat);
+#endif
+
#endif /* AVUTIL_INTERNAL_H */
diff --git a/ffmpeg/libavutil/intfloat.h b/ffmpeg/libavutil/intfloat.h
index 38d26ad..fe3d7ec 100644
--- a/ffmpeg/libavutil/intfloat.h
+++ b/ffmpeg/libavutil/intfloat.h
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2011 Mans Rullgard
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
diff --git a/ffmpeg/libavutil/intfloat_readwrite.c b/ffmpeg/libavutil/intfloat_readwrite.c
index 2998229..af5da62 100644
--- a/ffmpeg/libavutil/intfloat_readwrite.c
+++ b/ffmpeg/libavutil/intfloat_readwrite.c
@@ -26,9 +26,12 @@
*/
#include <stdint.h>
+#include "common.h"
#include "mathematics.h"
#include "intfloat_readwrite.h"
+#include "version.h"
+#if FF_API_INTFLOAT
double av_int2dbl(int64_t v){
if((uint64_t)v+v > 0xFFEULL<<52)
return NAN;
@@ -88,10 +91,11 @@ AVExtFloat av_dbl2ext(double d){
ext.mantissa[i] = m>>(56-(i<<3));
} else if (f != 0.0) {
ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff;
- if (f != INFINITY)
+ if (!isinf(f))
ext.mantissa[0] = ~0;
}
if (d < 0)
ext.exponent[0] |= 0x80;
return ext;
}
+#endif /* FF_API_INTFLOAT */
diff --git a/ffmpeg/libavutil/intfloat_readwrite.h b/ffmpeg/libavutil/intfloat_readwrite.h
index 9709f4d..1d79e3e 100644
--- a/ffmpeg/libavutil/intfloat_readwrite.h
+++ b/ffmpeg/libavutil/intfloat_readwrite.h
@@ -22,8 +22,11 @@
#define AVUTIL_INTFLOAT_READWRITE_H
#include <stdint.h>
+
#include "attributes.h"
+#include "version.h"
+#if FF_API_INTFLOAT
/* IEEE 80 bits extended float */
typedef struct AVExtFloat {
uint8_t exponent[2];
@@ -36,5 +39,6 @@ attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const;
attribute_deprecated int64_t av_dbl2int(double d) av_const;
attribute_deprecated int32_t av_flt2int(float d) av_const;
attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const;
+#endif /* FF_API_INTFLOAT */
#endif /* AVUTIL_INTFLOAT_READWRITE_H */
diff --git a/ffmpeg/libavutil/libavutil.pc b/ffmpeg/libavutil/libavutil.pc
index fcdef89..c7467d9 100644
--- a/ffmpeg/libavutil/libavutil.pc
+++ b/ffmpeg/libavutil/libavutil.pc
@@ -5,10 +5,10 @@ includedir=${prefix}/include
Name: libavutil
Description: FFmpeg utility library
-Version: 52.22.100
+Version: 52.59.100
Requires:
Requires.private:
Conflicts:
-Libs: -L${libdir} -lavutil
+Libs: -L${libdir} -lavutil
Libs.private: -lm
Cflags: -I${includedir}
diff --git a/ffmpeg/libavutil/lls.c b/ffmpeg/libavutil/lls.c
deleted file mode 100644
index a27c7ae..0000000
--- a/ffmpeg/libavutil/lls.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * linear least squares model
- *
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * linear least squares model
- */
-
-#include <math.h>
-#include <string.h>
-
-#include "version.h"
-#include "lls.h"
-
-void avpriv_init_lls(LLSModel *m, int indep_count)
-{
- memset(m, 0, sizeof(LLSModel));
- m->indep_count = indep_count;
-}
-
-void avpriv_update_lls(LLSModel *m, double *var, double decay)
-{
- int i, j;
-
- for (i = 0; i <= m->indep_count; i++) {
- for (j = i; j <= m->indep_count; j++) {
- m->covariance[i][j] *= decay;
- m->covariance[i][j] += var[i] * var[j];
- }
- }
-}
-
-void avpriv_solve_lls(LLSModel *m, double threshold, unsigned short min_order)
-{
- int i, j, k;
- double (*factor)[MAX_VARS + 1] = (void *) &m->covariance[1][0];
- double (*covar) [MAX_VARS + 1] = (void *) &m->covariance[1][1];
- double *covar_y = m->covariance[0];
- int count = m->indep_count;
-
- for (i = 0; i < count; i++) {
- for (j = i; j < count; j++) {
- double sum = covar[i][j];
-
- for (k = i - 1; k >= 0; k--)
- sum -= factor[i][k] * factor[j][k];
-
- if (i == j) {
- if (sum < threshold)
- sum = 1.0;
- factor[i][i] = sqrt(sum);
- } else {
- factor[j][i] = sum / factor[i][i];
- }
- }
- }
-
- for (i = 0; i < count; i++) {
- double sum = covar_y[i + 1];
-
- for (k = i - 1; k >= 0; k--)
- sum -= factor[i][k] * m->coeff[0][k];
-
- m->coeff[0][i] = sum / factor[i][i];
- }
-
- for (j = count - 1; j >= min_order; j--) {
- for (i = j; i >= 0; i--) {
- double sum = m->coeff[0][i];
-
- for (k = i + 1; k <= j; k++)
- sum -= factor[k][i] * m->coeff[j][k];
-
- m->coeff[j][i] = sum / factor[i][i];
- }
-
- m->variance[j] = covar_y[0];
-
- for (i = 0; i <= j; i++) {
- double sum = m->coeff[j][i] * covar[i][i] - 2 * covar_y[i + 1];
-
- for (k = 0; k < i; k++)
- sum += 2 * m->coeff[j][k] * covar[k][i];
-
- m->variance[j] += m->coeff[j][i] * sum;
- }
- }
-}
-
-double avpriv_evaluate_lls(LLSModel *m, double *param, int order)
-{
- int i;
- double out = 0;
-
- for (i = 0; i <= order; i++)
- out += param[i] * m->coeff[order][i];
-
- return out;
-}
-
-#if FF_API_LLS_PRIVATE
-void av_init_lls(LLSModel *m, int indep_count)
-{
- avpriv_init_lls(m, indep_count);
-}
-void av_update_lls(LLSModel *m, double *param, double decay)
-{
- avpriv_update_lls(m, param, decay);
-}
-void av_solve_lls(LLSModel *m, double threshold, int min_order)
-{
- avpriv_solve_lls(m, threshold, min_order);
-}
-double av_evaluate_lls(LLSModel *m, double *param, int order)
-{
- return avpriv_evaluate_lls(m, param, order);
-}
-#endif /* FF_API_LLS_PRIVATE */
-
-#ifdef TEST
-
-#include <stdio.h>
-#include <limits.h>
-#include "lfg.h"
-
-int main(void)
-{
- LLSModel m;
- int i, order;
- AVLFG lfg;
-
- av_lfg_init(&lfg, 1);
- avpriv_init_lls(&m, 3);
-
- for (i = 0; i < 100; i++) {
- double var[4];
- double eval;
-
- var[0] = (av_lfg_get(&lfg) / (double) UINT_MAX - 0.5) * 2;
- var[1] = var[0] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
- var[2] = var[1] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
- var[3] = var[2] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
- avpriv_update_lls(&m, var, 0.99);
- avpriv_solve_lls(&m, 0.001, 0);
- for (order = 0; order < 3; order++) {
- eval = avpriv_evaluate_lls(&m, var + 1, order);
- printf("real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n",
- var[0], order, eval, sqrt(m.variance[order] / (i + 1)),
- m.coeff[order][0], m.coeff[order][1],
- m.coeff[order][2]);
- }
- }
- return 0;
-}
-
-#endif
diff --git a/ffmpeg/libavutil/lls.h b/ffmpeg/libavutil/lls.h
deleted file mode 100644
index c785d44..0000000
--- a/ffmpeg/libavutil/lls.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * linear least squares model
- *
- * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_LLS_H
-#define AVUTIL_LLS_H
-
-#include "version.h"
-
-#define MAX_VARS 32
-
-//FIXME avoid direct access to LLSModel from outside
-
-/**
- * Linear least squares model.
- */
-typedef struct LLSModel {
- double covariance[MAX_VARS + 1][MAX_VARS + 1];
- double coeff[MAX_VARS][MAX_VARS];
- double variance[MAX_VARS];
- int indep_count;
-} LLSModel;
-
-void avpriv_init_lls(LLSModel *m, int indep_count);
-void avpriv_update_lls(LLSModel *m, double *param, double decay);
-void avpriv_solve_lls(LLSModel *m, double threshold, unsigned short min_order);
-double avpriv_evaluate_lls(LLSModel *m, double *param, int order);
-
-#if FF_API_LLS_PRIVATE
-void av_init_lls(LLSModel *m, int indep_count);
-void av_update_lls(LLSModel *m, double *param, double decay);
-void av_solve_lls(LLSModel *m, double threshold, int min_order);
-double av_evaluate_lls(LLSModel *m, double *param, int order);
-#endif /* FF_API_LLS_PRIVATE */
-
-#endif /* AVUTIL_LLS_H */
diff --git a/ffmpeg/libavutil/log.c b/ffmpeg/libavutil/log.c
index a274134..a7eb34c 100644
--- a/ffmpeg/libavutil/log.c
+++ b/ffmpeg/libavutil/log.c
@@ -35,10 +35,16 @@
#include <stdarg.h>
#include <stdlib.h>
#include "avutil.h"
+#include "bprint.h"
#include "common.h"
#include "internal.h"
#include "log.h"
+#if HAVE_PTHREADS
+#include <pthread.h>
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
#define LINE_SZ 1024
static int av_log_level = AV_LOG_INFO;
@@ -69,9 +75,6 @@ static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
static int16_t background, attr_orig;
static HANDLE con;
-#define set_color(x) SetConsoleTextAttribute(con, background | color[x])
-#define set_256color set_color
-#define reset_color() SetConsoleTextAttribute(con, attr_orig)
#else
static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = {
@@ -95,14 +98,14 @@ static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = {
[16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 147 << 8 | 0x14,
};
-#define set_color(x) fprintf(stderr, "\033[%d;3%dm", (color[x] >> 4) & 15, color[x] & 15)
-#define set_256color(x) fprintf(stderr, "\033[48;5;%dm\033[38;5;%dm", (color[x] >> 16) & 0xff, (color[x] >> 8) & 0xff)
-#define reset_color() fprintf(stderr, "\033[0m")
#endif
static int use_color = -1;
static void colored_fputs(int level, const char *str)
{
+ if (!*str)
+ return;
+
if (use_color < 0) {
#if HAVE_SETCONSOLETEXTATTRIBUTE
CONSOLE_SCREEN_BUFFER_INFO con_info;
@@ -126,14 +129,29 @@ static void colored_fputs(int level, const char *str)
#endif
}
- if (use_color == 1) {
- set_color(level);
- } else if (use_color == 256)
- set_256color(level);
+#if HAVE_SETCONSOLETEXTATTRIBUTE
+ if (use_color && level != AV_LOG_INFO/8)
+ SetConsoleTextAttribute(con, background | color[level]);
fputs(str, stderr);
- if (use_color) {
- reset_color();
- }
+ if (use_color && level != AV_LOG_INFO/8)
+ SetConsoleTextAttribute(con, attr_orig);
+#else
+ if (use_color == 1 && level != AV_LOG_INFO/8) {
+ fprintf(stderr,
+ "\033[%d;3%dm%s\033[0m",
+ (color[level] >> 4) & 15,
+ color[level] & 15,
+ str);
+ } else if (use_color == 256 && level != AV_LOG_INFO/8) {
+ fprintf(stderr,
+ "\033[48;5;%dm\033[38;5;%dm%s\033[0m",
+ (color[level] >> 16) & 0xff,
+ (color[level] >> 8) & 0xff,
+ str);
+ } else
+ fputs(str, stderr);
+#endif
+
}
const char *av_default_item_name(void *ptr)
@@ -168,37 +186,44 @@ static int get_category(void *ptr){
}
static void format_line(void *ptr, int level, const char *fmt, va_list vl,
- char part[3][LINE_SZ], int part_size, int *print_prefix, int type[2])
+ AVBPrint part[3], int *print_prefix, int type[2])
{
AVClass* avc = ptr ? *(AVClass **) ptr : NULL;
- part[0][0] = part[1][0] = part[2][0] = 0;
+ av_bprint_init(part+0, 0, 1);
+ av_bprint_init(part+1, 0, 1);
+ av_bprint_init(part+2, 0, 65536);
+
if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16;
if (*print_prefix && avc) {
if (avc->parent_log_context_offset) {
AVClass** parent = *(AVClass ***) (((uint8_t *) ptr) +
avc->parent_log_context_offset);
if (parent && *parent) {
- snprintf(part[0], part_size, "[%s @ %p] ",
+ av_bprintf(part+0, "[%s @ %p] ",
(*parent)->item_name(parent), parent);
- if(type) type[0] = get_category(((uint8_t *) ptr) + avc->parent_log_context_offset);
+ if(type) type[0] = get_category(parent);
}
}
- snprintf(part[1], part_size, "[%s @ %p] ",
+ av_bprintf(part+1, "[%s @ %p] ",
avc->item_name(ptr), ptr);
if(type) type[1] = get_category(ptr);
}
- vsnprintf(part[2], part_size, fmt, vl);
+ av_vbprintf(part+2, fmt, vl);
- *print_prefix = strlen(part[2]) && part[2][strlen(part[2]) - 1] == '\n';
+ if(*part[0].str || *part[1].str || *part[2].str) {
+ char lastc = part[2].len && part[2].len <= part[2].size ? part[2].str[part[2].len - 1] : 0;
+ *print_prefix = lastc == '\n' || lastc == '\r';
+ }
}
void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
char *line, int line_size, int *print_prefix)
{
- char part[3][LINE_SZ];
- format_line(ptr, level, fmt, vl, part, sizeof(part[0]), print_prefix, NULL);
- snprintf(line, line_size, "%s%s%s", part[0], part[1], part[2]);
+ AVBPrint part[3];
+ format_line(ptr, level, fmt, vl, part, print_prefix, NULL);
+ snprintf(line, line_size, "%s%s%s", part[0].str, part[1].str, part[2].str);
+ av_bprint_finalize(part+2, NULL);
}
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
@@ -206,38 +231,48 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
static int print_prefix = 1;
static int count;
static char prev[LINE_SZ];
- char part[3][LINE_SZ];
+ AVBPrint part[3];
char line[LINE_SZ];
static int is_atty;
int type[2];
if (level > av_log_level)
return;
- format_line(ptr, level, fmt, vl, part, sizeof(part[0]), &print_prefix, type);
- snprintf(line, sizeof(line), "%s%s%s", part[0], part[1], part[2]);
+#if HAVE_PTHREADS
+ pthread_mutex_lock(&mutex);
+#endif
+
+ format_line(ptr, level, fmt, vl, part, &print_prefix, type);
+ snprintf(line, sizeof(line), "%s%s%s", part[0].str, part[1].str, part[2].str);
#if HAVE_ISATTY
if (!is_atty)
is_atty = isatty(2) ? 1 : -1;
#endif
- if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev)){
+ if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev) &&
+ *line && line[strlen(line) - 1] != '\r'){
count++;
if (is_atty == 1)
fprintf(stderr, " Last message repeated %d times\r", count);
- return;
+ goto end;
}
if (count > 0) {
fprintf(stderr, " Last message repeated %d times\n", count);
count = 0;
}
strcpy(prev, line);
- sanitize(part[0]);
- colored_fputs(type[0], part[0]);
- sanitize(part[1]);
- colored_fputs(type[1], part[1]);
- sanitize(part[2]);
- colored_fputs(av_clip(level >> 3, 0, 6), part[2]);
+ sanitize(part[0].str);
+ colored_fputs(type[0], part[0].str);
+ sanitize(part[1].str);
+ colored_fputs(type[1], part[1].str);
+ sanitize(part[2].str);
+ colored_fputs(av_clip(level >> 3, 0, 6), part[2].str);
+end:
+ av_bprint_finalize(part+2, NULL);
+#if HAVE_PTHREADS
+ pthread_mutex_unlock(&mutex);
+#endif
}
static void (*av_log_callback)(void*, int, const char*, va_list) =
@@ -257,8 +292,9 @@ void av_log(void* avcl, int level, const char *fmt, ...)
void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
{
- if(av_log_callback)
- av_log_callback(avcl, level, fmt, vl);
+ void (*log_callback)(void*, int, const char*, va_list) = av_log_callback;
+ if (log_callback)
+ log_callback(avcl, level, fmt, vl);
}
int av_log_get_level(void)
@@ -281,12 +317,9 @@ void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
av_log_callback = callback;
}
-static void missing_feature_sample(int sample, void *avc, const char *msg, ...)
+static void missing_feature_sample(int sample, void *avc, const char *msg,
+ va_list argument_list)
{
- va_list argument_list;
-
- va_start(argument_list, msg);
-
av_vlog(avc, AV_LOG_WARNING, msg, argument_list);
av_log(avc, AV_LOG_WARNING, " is not implemented. Update your FFmpeg "
"version to the newest one from Git. If the problem still "
@@ -296,8 +329,6 @@ static void missing_feature_sample(int sample, void *avc, const char *msg, ...)
av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample "
"of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
"and contact the ffmpeg-devel mailing list.\n");
-
- va_end(argument_list);
}
void avpriv_request_sample(void *avc, const char *msg, ...)
diff --git a/ffmpeg/libavutil/log.h b/ffmpeg/libavutil/log.h
index 7ea95fa..55459e8 100644
--- a/ffmpeg/libavutil/log.h
+++ b/ffmpeg/libavutil/log.h
@@ -125,8 +125,19 @@ typedef struct AVClass {
int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags);
} AVClass;
-/* av_log API */
+/**
+ * @addtogroup lavu_log
+ *
+ * @{
+ *
+ * @defgroup lavu_log_constants Logging Constants
+ *
+ * @{
+ */
+/**
+ * Print no output.
+ */
#define AV_LOG_QUIET -8
/**
@@ -153,7 +164,14 @@ typedef struct AVClass {
*/
#define AV_LOG_WARNING 24
+/**
+ * Standard information.
+ */
#define AV_LOG_INFO 32
+
+/**
+ * Detailed information.
+ */
#define AV_LOG_VERBOSE 40
/**
@@ -164,26 +182,95 @@ typedef struct AVClass {
#define AV_LOG_MAX_OFFSET (AV_LOG_DEBUG - AV_LOG_QUIET)
/**
+ * @}
+ */
+
+/**
* Send the specified message to the log if the level is less than or equal
* to the current av_log_level. By default, all logging messages are sent to
- * stderr. This behavior can be altered by setting a different av_vlog callback
+ * stderr. This behavior can be altered by setting a different logging callback
* function.
+ * @see av_log_set_callback
*
* @param avcl A pointer to an arbitrary struct of which the first field is a
- * pointer to an AVClass struct.
- * @param level The importance level of the message, lower values signifying
- * higher importance.
+ * pointer to an AVClass struct.
+ * @param level The importance level of the message expressed using a @ref
+ * lavu_log_constants "Logging Constant".
* @param fmt The format string (printf-compatible) that specifies how
- * subsequent arguments are converted to output.
- * @see av_vlog
+ * subsequent arguments are converted to output.
*/
void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
-void av_vlog(void *avcl, int level, const char *fmt, va_list);
+
+/**
+ * Send the specified message to the log if the level is less than or equal
+ * to the current av_log_level. By default, all logging messages are sent to
+ * stderr. This behavior can be altered by setting a different logging callback
+ * function.
+ * @see av_log_set_callback
+ *
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
+ * pointer to an AVClass struct.
+ * @param level The importance level of the message expressed using a @ref
+ * lavu_log_constants "Logging Constant".
+ * @param fmt The format string (printf-compatible) that specifies how
+ * subsequent arguments are converted to output.
+ * @param vl The arguments referenced by the format string.
+ */
+void av_vlog(void *avcl, int level, const char *fmt, va_list vl);
+
+/**
+ * Get the current log level
+ *
+ * @see lavu_log_constants
+ *
+ * @return Current log level
+ */
int av_log_get_level(void);
-void av_log_set_level(int);
-void av_log_set_callback(void (*)(void*, int, const char*, va_list));
+
+/**
+ * Set the log level
+ *
+ * @see lavu_log_constants
+ *
+ * @param level Logging level
+ */
+void av_log_set_level(int level);
+
+/**
+ * Set the logging callback
+ *
+ * @note The callback must be thread safe, even if the application does not use
+ * threads itself as some codecs are multithreaded.
+ *
+ * @see av_log_default_callback
+ *
+ * @param callback A logging function with a compatible signature.
+ */
+void av_log_set_callback(void (*callback)(void*, int, const char*, va_list));
+
+/**
+ * Default logging callback
+ *
+ * It prints the message to stderr, optionally colorizing it.
+ *
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
+ * pointer to an AVClass struct.
+ * @param level The importance level of the message expressed using a @ref
+ * lavu_log_constants "Logging Constant".
+ * @param fmt The format string (printf-compatible) that specifies how
+ * subsequent arguments are converted to output.
+ * @param ap The arguments referenced by the format string.
+ */
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
+
+/**
+ * Return the context name
+ *
+ * @param ctx The AVClass context
+ *
+ * @return The AVClass class_name
+ */
const char* av_default_item_name(void* ctx);
AVClassCategory av_default_get_category(void *ptr);
@@ -219,4 +306,8 @@ void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
#define AV_LOG_SKIP_REPEATED 1
void av_log_set_flags(int arg);
+/**
+ * @}
+ */
+
#endif /* AVUTIL_LOG_H */
diff --git a/ffmpeg/libavutil/md5.c b/ffmpeg/libavutil/md5.c
index f8f08f1..63fc37d 100644
--- a/ffmpeg/libavutil/md5.c
+++ b/ffmpeg/libavutil/md5.c
@@ -83,50 +83,56 @@ static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)
a += T[i]; \
\
if (i < 32) { \
- if (i < 16) a += (d ^ (b & (c ^ d))) + X[ i & 15]; \
- else a += (c ^ (d & (c ^ b))) + X[(1 + 5*i) & 15]; \
+ if (i < 16) a += (d ^ (b & (c ^ d))) + X[ i & 15]; \
+ else a += ((d & b) | (~d & c)) + X[(1 + 5*i) & 15]; \
} else { \
- if (i < 48) a += (b ^ c ^ d) + X[(5 + 3*i) & 15]; \
- else a += (c ^ (b | ~d)) + X[( 7*i) & 15]; \
+ if (i < 48) a += (b ^ c ^ d) + X[(5 + 3*i) & 15]; \
+ else a += (c ^ (b | ~d)) + X[( 7*i) & 15]; \
} \
a = b + (a << t | a >> (32 - t)); \
} while (0)
-static void body(uint32_t ABCD[4], uint32_t X[16])
+static void body(uint32_t ABCD[4], uint32_t *src, int nblocks)
{
int i av_unused;
- uint32_t t;
- uint32_t a = ABCD[3];
- uint32_t b = ABCD[2];
- uint32_t c = ABCD[1];
- uint32_t d = ABCD[0];
+ int n;
+ uint32_t a, b, c, d, t, *X;
+
+ for (n = 0; n < nblocks; n++) {
+ a = ABCD[3];
+ b = ABCD[2];
+ c = ABCD[1];
+ d = ABCD[0];
+
+ X = src + n * 16;
#if HAVE_BIGENDIAN
- for (i = 0; i < 16; i++)
- X[i] = av_bswap32(X[i]);
+ for (i = 0; i < 16; i++)
+ X[i] = av_bswap32(X[i]);
#endif
#if CONFIG_SMALL
- for (i = 0; i < 64; i++) {
- CORE(i, a, b, c, d);
- t = d;
- d = c;
- c = b;
- b = a;
- a = t;
- }
+ for (i = 0; i < 64; i++) {
+ CORE(i, a, b, c, d);
+ t = d;
+ d = c;
+ c = b;
+ b = a;
+ a = t;
+ }
#else
#define CORE2(i) \
- CORE( i, a,b,c,d); CORE((i+1),d,a,b,c); \
- CORE((i+2),c,d,a,b); CORE((i+3),b,c,d,a)
+ CORE( i, a,b,c,d); CORE((i+1),d,a,b,c); \
+ CORE((i+2),c,d,a,b); CORE((i+3),b,c,d,a)
#define CORE4(i) CORE2(i); CORE2((i+4)); CORE2((i+8)); CORE2((i+12))
- CORE4(0); CORE4(16); CORE4(32); CORE4(48);
+ CORE4(0); CORE4(16); CORE4(32); CORE4(48);
#endif
- ABCD[0] += d;
- ABCD[1] += c;
- ABCD[2] += b;
- ABCD[3] += a;
+ ABCD[0] += d;
+ ABCD[1] += c;
+ ABCD[2] += b;
+ ABCD[3] += a;
+ }
}
void av_md5_init(AVMD5 *ctx)
@@ -139,20 +145,39 @@ void av_md5_init(AVMD5 *ctx)
ctx->ABCD[3] = 0x67452301;
}
-void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len)
+void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len)
{
- int i, j;
+ const uint8_t *end;
+ int j;
j = ctx->len & 63;
ctx->len += len;
- for (i = 0; i < len; i++) {
- ctx->block[j++] = src[i];
- if (j == 64) {
- body(ctx->ABCD, (uint32_t *) ctx->block);
- j = 0;
+ if (j) {
+ int cnt = FFMIN(len, 64 - j);
+ memcpy(ctx->block + j, src, cnt);
+ src += cnt;
+ len -= cnt;
+ if (j + cnt < 64)
+ return;
+ body(ctx->ABCD, (uint32_t *)ctx->block, 1);
+ }
+
+ end = src + (len & ~63);
+ if (HAVE_BIGENDIAN || (!HAVE_FAST_UNALIGNED && ((intptr_t)src & 3))) {
+ while (src < end) {
+ memcpy(ctx->block, src, 64);
+ body(ctx->ABCD, (uint32_t *) ctx->block, 1);
+ src += 64;
}
+ } else {
+ int nblocks = len / 64;
+ body(ctx->ABCD, (uint32_t *)src, nblocks);
+ src = end;
}
+ len &= 63;
+ if (len > 0)
+ memcpy(ctx->block, src, len);
}
void av_md5_final(AVMD5 *ctx, uint8_t *dst)
diff --git a/ffmpeg/libavutil/md5.h b/ffmpeg/libavutil/md5.h
index 1d7be9f..79702c8 100644
--- a/ffmpeg/libavutil/md5.h
+++ b/ffmpeg/libavutil/md5.h
@@ -36,10 +36,42 @@ extern const int av_md5_size;
struct AVMD5;
+/**
+ * Allocate an AVMD5 context.
+ */
struct AVMD5 *av_md5_alloc(void);
+
+/**
+ * Initialize MD5 hashing.
+ *
+ * @param ctx pointer to the function context (of size av_md5_size)
+ */
void av_md5_init(struct AVMD5 *ctx);
-void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len);
+
+/**
+ * Update hash value.
+ *
+ * @param ctx hash function context
+ * @param src input data to update hash with
+ * @param len input data length
+ */
+void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len);
+
+/**
+ * Finish hashing and output digest value.
+ *
+ * @param ctx hash function context
+ * @param dst buffer where output digest value is stored
+ */
void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
+
+/**
+ * Hash an array of data.
+ *
+ * @param dst The output buffer to write the digest into
+ * @param src The data to hash
+ * @param len The length of the data, in bytes
+ */
void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
/**
diff --git a/ffmpeg/libavutil/mem.c b/ffmpeg/libavutil/mem.c
index 860c011..10b0137 100644
--- a/ffmpeg/libavutil/mem.c
+++ b/ffmpeg/libavutil/mem.c
@@ -38,6 +38,7 @@
#include "avassert.h"
#include "avutil.h"
+#include "common.h"
#include "intreadwrite.h"
#include "mem.h"
@@ -77,7 +78,7 @@ void *av_malloc(size_t size)
long diff;
#endif
- /* let's disallow possible ambiguous cases */
+ /* let's disallow possibly ambiguous cases */
if (size > (max_alloc_size - 32))
return NULL;
@@ -133,7 +134,7 @@ void *av_malloc(size_t size)
}
#if CONFIG_MEMORY_POISONING
if (ptr)
- memset(ptr, 0x2a, size);
+ memset(ptr, FF_MEMORY_POISON, size);
#endif
return ptr;
}
@@ -144,7 +145,7 @@ void *av_realloc(void *ptr, size_t size)
int diff;
#endif
- /* let's disallow possible ambiguous cases */
+ /* let's disallow possibly ambiguous cases */
if (size > (max_alloc_size - 32))
return NULL;
@@ -180,6 +181,42 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize)
return r;
}
+int av_reallocp(void *ptr, size_t size)
+{
+ void **ptrptr = ptr;
+ void *ret;
+
+ if (!size) {
+ av_freep(ptr);
+ return 0;
+ }
+ ret = av_realloc(*ptrptr, size);
+
+ if (!ret) {
+ av_freep(ptr);
+ return AVERROR(ENOMEM);
+ }
+
+ *ptrptr = ret;
+ return 0;
+}
+
+void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
+{
+ if (!size || nmemb >= INT_MAX / size)
+ return NULL;
+ return av_realloc(ptr, nmemb * size);
+}
+
+int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
+{
+ void **ptrptr = ptr;
+ *ptrptr = av_realloc_f(*ptrptr, nmemb, size);
+ if (!*ptrptr && nmemb && size)
+ return AVERROR(ENOMEM);
+ return 0;
+}
+
void av_free(void *ptr)
{
#if CONFIG_MEMALIGN_HACK
@@ -222,14 +259,24 @@ char *av_strdup(const char *s)
char *ptr = NULL;
if (s) {
int len = strlen(s) + 1;
- ptr = av_malloc(len);
+ ptr = av_realloc(NULL, len);
if (ptr)
memcpy(ptr, s, len);
}
return ptr;
}
-/* add one element to a dynamic array */
+void *av_memdup(const void *p, size_t size)
+{
+ void *ptr = NULL;
+ if (p) {
+ ptr = av_malloc(size);
+ if (ptr)
+ memcpy(ptr, p, size);
+ }
+ return ptr;
+}
+
void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem)
{
/* see similar ffmpeg.c:grow_array() */
@@ -239,15 +286,58 @@ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem)
nb = *nb_ptr;
tab = *(intptr_t**)tab_ptr;
if ((nb & (nb - 1)) == 0) {
- if (nb == 0)
+ if (nb == 0) {
nb_alloc = 1;
- else
+ } else {
+ if (nb > INT_MAX / (2 * sizeof(intptr_t)))
+ goto fail;
nb_alloc = nb * 2;
+ }
tab = av_realloc(tab, nb_alloc * sizeof(intptr_t));
+ if (!tab)
+ goto fail;
*(intptr_t**)tab_ptr = tab;
}
tab[nb++] = (intptr_t)elem;
*nb_ptr = nb;
+ return;
+
+fail:
+ av_freep(tab_ptr);
+ *nb_ptr = 0;
+}
+
+void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
+ const uint8_t *elem_data)
+{
+ int nb = *nb_ptr, nb_alloc;
+ uint8_t *tab = *tab_ptr, *tab_elem_data;
+
+ if ((nb & (nb - 1)) == 0) {
+ if (nb == 0) {
+ nb_alloc = 1;
+ } else {
+ if (nb > INT_MAX / (2 * elem_size))
+ goto fail;
+ nb_alloc = nb * 2;
+ }
+ tab = av_realloc(tab, nb_alloc * elem_size);
+ if (!tab)
+ goto fail;
+ *tab_ptr = tab;
+ }
+ *nb_ptr = nb + 1;
+ tab_elem_data = tab + nb*elem_size;
+ if (elem_data)
+ memcpy(tab_elem_data, elem_data, elem_size);
+ else if (CONFIG_MEMORY_POISONING)
+ memset(tab_elem_data, FF_MEMORY_POISON, elem_size);
+ return tab_elem_data;
+
+fail:
+ av_freep(tab_ptr);
+ *nb_ptr = 0;
+ return NULL;
}
static void fill16(uint8_t *dst, int len)
@@ -374,3 +464,41 @@ void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
}
}
+void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
+{
+ if (min_size < *size)
+ return ptr;
+
+ min_size = FFMAX(17 * min_size / 16 + 32, min_size);
+
+ ptr = av_realloc(ptr, min_size);
+ /* we could set this to the unmodified min_size but this is safer
+ * if the user lost the ptr and uses NULL now
+ */
+ if (!ptr)
+ min_size = 0;
+
+ *size = min_size;
+
+ return ptr;
+}
+
+static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc)
+{
+ void **p = ptr;
+ if (min_size < *size)
+ return 0;
+ min_size = FFMAX(17 * min_size / 16 + 32, min_size);
+ av_free(*p);
+ *p = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size);
+ if (!*p)
+ min_size = 0;
+ *size = min_size;
+ return 1;
+}
+
+void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
+{
+ ff_fast_malloc(ptr, size, min_size, 0);
+}
+
diff --git a/ffmpeg/libavutil/mem.h b/ffmpeg/libavutil/mem.h
index ced9453..703ce81 100644
--- a/ffmpeg/libavutil/mem.h
+++ b/ffmpeg/libavutil/mem.h
@@ -83,8 +83,7 @@
void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
/**
- * Helper function to allocate a block of size * nmemb bytes with
- * using av_malloc()
+ * Allocate a block of size * nmemb bytes with av_malloc().
* @param nmemb Number of elements
* @param size Size of the single element
* @return Pointer to the allocated block, NULL if the block cannot
@@ -93,7 +92,7 @@ void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
*/
av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
{
- if (size <= 0 || nmemb >= INT_MAX / size)
+ if (!size || nmemb >= INT_MAX / size)
return NULL;
return av_malloc(nmemb * size);
}
@@ -103,11 +102,17 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
* If ptr is NULL and size > 0, allocate a new block. If
* size is zero, free the memory block pointed to by ptr.
* @param ptr Pointer to a memory block already allocated with
- * av_malloc(z)() or av_realloc() or NULL.
- * @param size Size in bytes for the memory block to be allocated or
+ * av_realloc() or NULL.
+ * @param size Size in bytes of the memory block to be allocated or
* reallocated.
- * @return Pointer to a newly reallocated block or NULL if the block
+ * @return Pointer to a newly-reallocated block or NULL if the block
* cannot be reallocated or the function is used to free the memory block.
+ * @warning Pointers originating from the av_malloc() family of functions must
+ * not be passed to av_realloc(). The former can be implemented using
+ * memalign() (or other functions), and there is no guarantee that
+ * pointers from such functions can be passed to realloc() at all.
+ * The situation is undefined according to POSIX and may crash with
+ * some libc implementations.
* @see av_fast_realloc()
*/
void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
@@ -123,6 +128,63 @@ void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
/**
+ * Allocate or reallocate a block of memory.
+ * If *ptr is NULL and size > 0, allocate a new block. If
+ * size is zero, free the memory block pointed to by ptr.
+ * @param ptr Pointer to a pointer to a memory block already allocated
+ * with av_realloc(), or pointer to a pointer to NULL.
+ * The pointer is updated on success, or freed on failure.
+ * @param size Size in bytes for the memory block to be allocated or
+ * reallocated
+ * @return Zero on success, an AVERROR error code on failure.
+ * @warning Pointers originating from the av_malloc() family of functions must
+ * not be passed to av_reallocp(). The former can be implemented using
+ * memalign() (or other functions), and there is no guarantee that
+ * pointers from such functions can be passed to realloc() at all.
+ * The situation is undefined according to POSIX and may crash with
+ * some libc implementations.
+ */
+int av_reallocp(void *ptr, size_t size);
+
+/**
+ * Allocate or reallocate an array.
+ * If ptr is NULL and nmemb > 0, allocate a new block. If
+ * nmemb is zero, free the memory block pointed to by ptr.
+ * @param ptr Pointer to a memory block already allocated with
+ * av_realloc() or NULL.
+ * @param nmemb Number of elements
+ * @param size Size of the single element
+ * @return Pointer to a newly-reallocated block or NULL if the block
+ * cannot be reallocated or the function is used to free the memory block.
+ * @warning Pointers originating from the av_malloc() family of functions must
+ * not be passed to av_realloc(). The former can be implemented using
+ * memalign() (or other functions), and there is no guarantee that
+ * pointers from such functions can be passed to realloc() at all.
+ * The situation is undefined according to POSIX and may crash with
+ * some libc implementations.
+ */
+av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
+
+/**
+ * Allocate or reallocate an array through a pointer to a pointer.
+ * If *ptr is NULL and nmemb > 0, allocate a new block. If
+ * nmemb is zero, free the memory block pointed to by ptr.
+ * @param ptr Pointer to a pointer to a memory block already allocated
+ * with av_realloc(), or pointer to a pointer to NULL.
+ * The pointer is updated on success, or freed on failure.
+ * @param nmemb Number of elements
+ * @param size Size of the single element
+ * @return Zero on success, an AVERROR error code on failure.
+ * @warning Pointers originating from the av_malloc() family of functions must
+ * not be passed to av_realloc(). The former can be implemented using
+ * memalign() (or other functions), and there is no guarantee that
+ * pointers from such functions can be passed to realloc() at all.
+ * The situation is undefined according to POSIX and may crash with
+ * some libc implementations.
+ */
+av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
+
+/**
* Free a memory block which has been allocated with av_malloc(z)() or
* av_realloc().
* @param ptr Pointer to the memory block which should be freed.
@@ -155,8 +217,7 @@ void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
/**
- * Helper function to allocate a block of size * nmemb bytes with
- * using av_mallocz()
+ * Allocate a block of size * nmemb bytes with av_mallocz().
* @param nmemb Number of elements
* @param size Size of the single element
* @return Pointer to the allocated block, NULL if the block cannot
@@ -166,7 +227,7 @@ void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
*/
av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size)
{
- if (size <= 0 || nmemb >= INT_MAX / size)
+ if (!size || nmemb >= INT_MAX / size)
return NULL;
return av_mallocz(nmemb * size);
}
@@ -174,12 +235,20 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
/**
* Duplicate the string s.
* @param s string to be duplicated
- * @return Pointer to a newly allocated string containing a
+ * @return Pointer to a newly-allocated string containing a
* copy of s or NULL if the string cannot be allocated.
*/
char *av_strdup(const char *s) av_malloc_attrib;
/**
+ * Duplicate the buffer p.
+ * @param p buffer to be duplicated
+ * @return Pointer to a newly allocated buffer containing a
+ * copy of p or NULL if the buffer cannot be allocated.
+ */
+void *av_memdup(const void *p, size_t size);
+
+/**
* Free a memory block which has been allocated with av_malloc(z)() or
* av_realloc() and set the pointer pointing to it to NULL.
* @param ptr Pointer to the pointer to the memory block which should
@@ -191,13 +260,51 @@ void av_freep(void *ptr);
/**
* Add an element to a dynamic array.
*
- * @param tab_ptr Pointer to the array.
- * @param nb_ptr Pointer to the number of elements in the array.
- * @param elem Element to be added.
+ * The array to grow is supposed to be an array of pointers to
+ * structures, and the element to add must be a pointer to an already
+ * allocated structure.
+ *
+ * The array is reallocated when its size reaches powers of 2.
+ * Therefore, the amortized cost of adding an element is constant.
+ *
+ * In case of success, the pointer to the array is updated in order to
+ * point to the new grown array, and the number pointed to by nb_ptr
+ * is incremented.
+ * In case of failure, the array is freed, *tab_ptr is set to NULL and
+ * *nb_ptr is set to 0.
+ *
+ * @param tab_ptr pointer to the array to grow
+ * @param nb_ptr pointer to the number of elements in the array
+ * @param elem element to add
+ * @see av_dynarray2_add()
*/
void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
/**
+ * Add an element of size elem_size to a dynamic array.
+ *
+ * The array is reallocated when its number of elements reaches powers of 2.
+ * Therefore, the amortized cost of adding an element is constant.
+ *
+ * In case of success, the pointer to the array is updated in order to
+ * point to the new grown array, and the number pointed to by nb_ptr
+ * is incremented.
+ * In case of failure, the array is freed, *tab_ptr is set to NULL and
+ * *nb_ptr is set to 0.
+ *
+ * @param tab_ptr pointer to the array to grow
+ * @param nb_ptr pointer to the number of elements in the array
+ * @param elem_size size in bytes of the elements in the array
+ * @param elem_data pointer to the data of the element to add. If NULL, the space of
+ * the new added element is not filled.
+ * @return pointer to the data of the element to copy in the new allocated space.
+ * If NULL, the new allocated space is left uninitialized."
+ * @see av_dynarray_add()
+ */
+void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size,
+ const uint8_t *elem_data);
+
+/**
* Multiply two size_t values checking for overflow.
* @return 0 if success, AVERROR(EINVAL) if overflow.
*/
@@ -218,7 +325,7 @@ static inline int av_size_mult(size_t a, size_t b, size_t *r)
void av_max_alloc(size_t max);
/**
- * @brief deliberately overlapping memcpy implementation
+ * deliberately overlapping memcpy implementation
* @param dst destination buffer
* @param back how many bytes back we start (the initial size of the overlapping window), must be > 0
* @param cnt number of bytes to copy, must be >= 0
@@ -229,6 +336,27 @@ void av_max_alloc(size_t max);
void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
/**
+ * Reallocate the given block if it is not large enough, otherwise do nothing.
+ *
+ * @see av_realloc
+ */
+void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
+
+/**
+ * Allocate a buffer, reusing the given one if large enough.
+ *
+ * Contrary to av_fast_realloc the current buffer contents might not be
+ * preserved and on error the old buffer is freed, thus no special
+ * handling to avoid memleaks is necessary.
+ *
+ * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
+ * @param size size of the buffer *ptr points to
+ * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
+ * *size 0 if an error occurred.
+ */
+void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
+
+/**
* @}
*/
diff --git a/ffmpeg/libavutil/old_pix_fmts.h b/ffmpeg/libavutil/old_pix_fmts.h
index 57b6992..cd1ed7c 100644
--- a/ffmpeg/libavutil/old_pix_fmts.h
+++ b/ffmpeg/libavutil/old_pix_fmts.h
@@ -44,8 +44,10 @@
PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
+#if FF_API_XVMC
PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
PIX_FMT_XVMC_MPEG2_IDCT,
+#endif /* FF_API_XVMC */
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
@@ -67,11 +69,13 @@
PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
+#if FF_API_VDPAU
PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+#endif
PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
@@ -95,7 +99,9 @@
PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+#if FF_API_VDPAU
PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+#endif
PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
diff --git a/ffmpeg/libavutil/opt.c b/ffmpeg/libavutil/opt.c
index a2cdcb4..07864f2 100644
--- a/ffmpeg/libavutil/opt.c
+++ b/ffmpeg/libavutil/opt.c
@@ -27,6 +27,7 @@
#include "avutil.h"
#include "avstring.h"
+#include "channel_layout.h"
#include "common.h"
#include "opt.h"
#include "eval.h"
@@ -63,7 +64,7 @@ const AVOption *av_next_option(void *obj, const AVOption *last)
const AVOption *av_opt_next(void *obj, const AVOption *last)
{
AVClass *class = *(AVClass**)obj;
- if (!last && class->option && class->option[0].name)
+ if (!last && class && class->option && class->option[0].name)
return class->option;
if (last && last[1].name)
return ++last;
@@ -77,6 +78,7 @@ static int read_number(const AVOption *o, void *dst, double *num, int *den, int6
case AV_OPT_TYPE_PIXEL_FMT:
case AV_OPT_TYPE_SAMPLE_FMT:
case AV_OPT_TYPE_INT: *intnum = *(int *)dst;return 0;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
case AV_OPT_TYPE_DURATION:
case AV_OPT_TYPE_INT64: *intnum = *(int64_t *)dst;return 0;
case AV_OPT_TYPE_FLOAT: *num = *(float *)dst;return 0;
@@ -91,11 +93,21 @@ static int read_number(const AVOption *o, void *dst, double *num, int *den, int6
static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)
{
- if (o->max*den < num*intnum || o->min*den > num*intnum) {
+ if (o->type != AV_OPT_TYPE_FLAGS &&
+ (o->max * den < num * intnum || o->min * den > num * intnum)) {
av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range [%g - %g]\n",
num*intnum/den, o->name, o->min, o->max);
return AVERROR(ERANGE);
}
+ if (o->type == AV_OPT_TYPE_FLAGS) {
+ double d = num*intnum/den;
+ if (d < -1.5 || d > 0xFFFFFFFF+0.5 || (llrint(d*256) & 255)) {
+ av_log(obj, AV_LOG_ERROR,
+ "Value %f for parameter '%s' is not a valid set of 32bit integer flags\n",
+ num*intnum/den, o->name);
+ return AVERROR(ERANGE);
+ }
+ }
switch (o->type) {
case AV_OPT_TYPE_FLAGS:
@@ -103,6 +115,7 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int
case AV_OPT_TYPE_SAMPLE_FMT:
case AV_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break;
case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
case AV_OPT_TYPE_INT64: *(int64_t *)dst= llrint(num/den)*intnum; break;
case AV_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break;
case AV_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break;
@@ -239,6 +252,95 @@ static int set_string_number(void *obj, void *target_obj, const AVOption *o, con
return 0;
}
+static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
+{
+ int ret;
+
+ if (!val || !strcmp(val, "none")) {
+ dst[0] =
+ dst[1] = 0;
+ return 0;
+ }
+ ret = av_parse_video_size(dst, dst + 1, val);
+ if (ret < 0)
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val);
+ return ret;
+}
+
+static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
+{
+ int ret;
+ if (!val) {
+ ret = AVERROR(EINVAL);
+ } else {
+ ret = av_parse_video_rate(dst, val);
+ }
+ if (ret < 0)
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val);
+ return ret;
+}
+
+static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
+{
+ int ret;
+
+ if (!val) {
+ return 0;
+ } else {
+ ret = av_parse_color(dst, val, -1, obj);
+ if (ret < 0)
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val);
+ return ret;
+ }
+ return 0;
+}
+
+static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst,
+ int fmt_nb, int ((*get_fmt)(const char *)), const char *desc)
+{
+ int fmt, min, max;
+
+ if (!val || !strcmp(val, "none")) {
+ fmt = -1;
+ } else {
+ fmt = get_fmt(val);
+ if (fmt == -1) {
+ char *tail;
+ fmt = strtol(val, &tail, 0);
+ if (*tail || (unsigned)fmt >= fmt_nb) {
+ av_log(obj, AV_LOG_ERROR,
+ "Unable to parse option value \"%s\" as %s\n", val, desc);
+ return AVERROR(EINVAL);
+ }
+ }
+ }
+
+ min = FFMAX(o->min, -1);
+ max = FFMIN(o->max, fmt_nb-1);
+
+ if (fmt < min || fmt > max) {
+ av_log(obj, AV_LOG_ERROR,
+ "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
+ fmt, o->name, desc, min, max);
+ return AVERROR(ERANGE);
+ }
+
+ *(int *)dst = fmt;
+ return 0;
+}
+
+static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
+{
+ return set_string_fmt(obj, o, val, dst,
+ AV_PIX_FMT_NB, av_get_pix_fmt, "pixel format");
+}
+
+static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
+{
+ return set_string_fmt(obj, o, val, dst,
+ AV_SAMPLE_FMT_NB, av_get_sample_fmt, "sample format");
+}
+
#if FF_API_OLD_AVOPTIONS
int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)
{
@@ -251,7 +353,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
{
- int ret;
+ int ret = 0;
void *dst, *target_obj;
const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
if (!o || !target_obj)
@@ -259,7 +361,8 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
if (!val && (o->type != AV_OPT_TYPE_STRING &&
o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != AV_OPT_TYPE_SAMPLE_FMT &&
o->type != AV_OPT_TYPE_IMAGE_SIZE && o->type != AV_OPT_TYPE_VIDEO_RATE &&
- o->type != AV_OPT_TYPE_DURATION))
+ o->type != AV_OPT_TYPE_DURATION && o->type != AV_OPT_TYPE_COLOR &&
+ o->type != AV_OPT_TYPE_CHANNEL_LAYOUT))
return AVERROR(EINVAL);
dst = ((uint8_t*)target_obj) + o->offset;
@@ -272,56 +375,10 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
case AV_OPT_TYPE_FLOAT:
case AV_OPT_TYPE_DOUBLE:
case AV_OPT_TYPE_RATIONAL: return set_string_number(obj, target_obj, o, val, dst);
- case AV_OPT_TYPE_IMAGE_SIZE:
- if (!val || !strcmp(val, "none")) {
- *(int *)dst = *((int *)dst + 1) = 0;
- return 0;
- }
- ret = av_parse_video_size(dst, ((int *)dst) + 1, val);
- if (ret < 0)
- av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val);
- return ret;
- case AV_OPT_TYPE_VIDEO_RATE:
- if (!val) {
- ret = AVERROR(EINVAL);
- } else {
- ret = av_parse_video_rate(dst, val);
- }
- if (ret < 0)
- av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val);
- return ret;
- case AV_OPT_TYPE_PIXEL_FMT:
- if (!val || !strcmp(val, "none")) {
- ret = AV_PIX_FMT_NONE;
- } else {
- ret = av_get_pix_fmt(val);
- if (ret == AV_PIX_FMT_NONE) {
- char *tail;
- ret = strtol(val, &tail, 0);
- if (*tail || (unsigned)ret >= AV_PIX_FMT_NB) {
- av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as pixel format\n", val);
- return AVERROR(EINVAL);
- }
- }
- }
- *(enum AVPixelFormat *)dst = ret;
- return 0;
- case AV_OPT_TYPE_SAMPLE_FMT:
- if (!val || !strcmp(val, "none")) {
- ret = AV_SAMPLE_FMT_NONE;
- } else {
- ret = av_get_sample_fmt(val);
- if (ret == AV_SAMPLE_FMT_NONE) {
- char *tail;
- ret = strtol(val, &tail, 0);
- if (*tail || (unsigned)ret >= AV_SAMPLE_FMT_NB) {
- av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as sample format\n", val);
- return AVERROR(EINVAL);
- }
- }
- }
- *(enum AVSampleFormat *)dst = ret;
- return 0;
+ case AV_OPT_TYPE_IMAGE_SIZE: return set_string_image_size(obj, o, val, dst);
+ case AV_OPT_TYPE_VIDEO_RATE: return set_string_video_rate(obj, o, val, dst);
+ case AV_OPT_TYPE_PIXEL_FMT: return set_string_pixel_fmt(obj, o, val, dst);
+ case AV_OPT_TYPE_SAMPLE_FMT: return set_string_sample_fmt(obj, o, val, dst);
case AV_OPT_TYPE_DURATION:
if (!val) {
*(int64_t *)dst = 0;
@@ -331,6 +388,25 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as duration\n", val);
return ret;
}
+ break;
+ case AV_OPT_TYPE_COLOR: return set_string_color(obj, o, val, dst);
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ if (!val || !strcmp(val, "none")) {
+ *(int64_t *)dst = 0;
+ } else {
+#if FF_API_GET_CHANNEL_LAYOUT_COMPAT
+ int64_t cl = ff_get_channel_layout(val, 0);
+#else
+ int64_t cl = av_get_channel_layout(val);
+#endif
+ if (!cl) {
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val);
+ ret = AVERROR(EINVAL);
+ }
+ *(int64_t *)dst = cl;
+ return ret;
+ }
+ break;
}
av_log(obj, AV_LOG_ERROR, "Invalid option type.\n");
@@ -420,8 +496,8 @@ int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int
if (o->type != AV_OPT_TYPE_BINARY)
return AVERROR(EINVAL);
- ptr = av_malloc(len);
- if (!ptr)
+ ptr = len ? av_malloc(len) : NULL;
+ if (len && !ptr)
return AVERROR(ENOMEM);
dst = (uint8_t **)(((uint8_t *)target_obj) + o->offset);
@@ -430,7 +506,8 @@ int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int
av_free(*dst);
*dst = ptr;
*lendst = len;
- memcpy(ptr, val, len);
+ if (len)
+ memcpy(ptr, val, len);
return 0;
}
@@ -491,15 +568,15 @@ static int set_format(void *obj, const char *name, int fmt, int search_flags,
return AVERROR(EINVAL);
}
-#if LIBAVUTIL_VERSION_MAJOR < 53
+#if LIBAVUTIL_VERSION_MAJOR < 54
if (class->version && class->version < AV_VERSION_INT(52, 11, 100)) {
min = -1;
max = nb_fmts-1;
} else
#endif
{
- min = FFMIN(o->min, -1);
- max = FFMAX(o->max, nb_fmts-1);
+ min = FFMAX(o->min, -1);
+ max = FFMIN(o->max, nb_fmts-1);
}
if (fmt < min || fmt > max) {
av_log(obj, AV_LOG_ERROR,
@@ -521,6 +598,22 @@ int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt,
return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_SAMPLE_FMT, "sample", AV_SAMPLE_FMT_NB);
}
+int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags)
+{
+ void *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != AV_OPT_TYPE_CHANNEL_LAYOUT) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value set by option '%s' is not a channel layout.\n", o->name);
+ return AVERROR(EINVAL);
+ }
+ *(int *)(((int64_t *)target_obj) + o->offset) = cl;
+ return 0;
+}
+
#if FF_API_OLD_AVOPTIONS
/**
*
@@ -616,6 +709,13 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
i64 / 3600000000, (int)((i64 / 60000000) % 60),
(int)((i64 / 1000000) % 60), (int)(i64 % 1000000));
break;
+ case AV_OPT_TYPE_COLOR:
+ ret = snprintf(buf, sizeof(buf), "0x%02x%02x%02x%02x", ((int *)dst)[0], ((int *)dst)[1], ((int *)dst)[2], ((int *)dst)[3]);
+ break;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ i64 = *(int64_t *)dst;
+ ret = snprintf(buf, sizeof(buf), "0x%"PRIx64, i64);
+ break;
default:
return AVERROR(EINVAL);
}
@@ -785,6 +885,23 @@ int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AV
return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_SAMPLE_FMT, "sample");
}
+int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *cl)
+{
+ void *dst, *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != AV_OPT_TYPE_CHANNEL_LAYOUT) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value for option '%s' is not a channel layout.\n", name);
+ return AVERROR(EINVAL);
+ }
+
+ dst = ((uint8_t*)target_obj) + o->offset;
+ *cl = *(int64_t *)dst;
+ return 0;
+}
+
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
{
const AVOption *field = av_opt_find(obj, field_name, NULL, 0, 0);
@@ -839,9 +956,11 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
else if (unit && opt->type==AV_OPT_TYPE_CONST && strcmp(unit, opt->unit))
continue;
else if (unit && opt->type == AV_OPT_TYPE_CONST)
- av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name);
+ av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name);
else
- av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
+ av_log(av_log_obj, AV_LOG_INFO, " %s%-17s ",
+ (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? "" : "-",
+ opt->name);
switch (opt->type) {
case AV_OPT_TYPE_FLAGS:
@@ -883,6 +1002,12 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
case AV_OPT_TYPE_DURATION:
av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<duration>");
break;
+ case AV_OPT_TYPE_COLOR:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<color>");
+ break;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<channel_layout>");
+ break;
case AV_OPT_TYPE_CONST:
default:
av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "");
@@ -917,6 +1042,50 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
av_opt_freep_ranges(&r);
}
+ if (opt->type != AV_OPT_TYPE_CONST &&
+ opt->type != AV_OPT_TYPE_BINARY &&
+ !((opt->type == AV_OPT_TYPE_COLOR ||
+ opt->type == AV_OPT_TYPE_IMAGE_SIZE ||
+ opt->type == AV_OPT_TYPE_STRING ||
+ opt->type == AV_OPT_TYPE_VIDEO_RATE) &&
+ !opt->default_val.str)) {
+ av_log(av_log_obj, AV_LOG_INFO, " (default ");
+ switch (opt->type) {
+ case AV_OPT_TYPE_FLAGS:
+ av_log(av_log_obj, AV_LOG_INFO, "%"PRIX64, opt->default_val.i64);
+ break;
+ case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_INT64:
+ log_value(av_log_obj, AV_LOG_INFO, opt->default_val.i64);
+ break;
+ case AV_OPT_TYPE_DOUBLE:
+ case AV_OPT_TYPE_FLOAT:
+ log_value(av_log_obj, AV_LOG_INFO, opt->default_val.dbl);
+ break;
+ case AV_OPT_TYPE_RATIONAL: {
+ AVRational q = av_d2q(opt->default_val.dbl, INT_MAX);
+ av_log(av_log_obj, AV_LOG_INFO, "%d/%d", q.num, q.den); }
+ break;
+ case AV_OPT_TYPE_PIXEL_FMT:
+ av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(av_get_pix_fmt_name(opt->default_val.i64), "none"));
+ break;
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(av_get_sample_fmt_name(opt->default_val.i64), "none"));
+ break;
+ case AV_OPT_TYPE_COLOR:
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ case AV_OPT_TYPE_STRING:
+ case AV_OPT_TYPE_VIDEO_RATE:
+ av_log(av_log_obj, AV_LOG_INFO, "\"%s\"", opt->default_val.str);
+ break;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ av_log(av_log_obj, AV_LOG_INFO, "0x%"PRIx64, opt->default_val.i64);
+ break;
+ }
+ av_log(av_log_obj, AV_LOG_INFO, ")");
+ }
+
av_log(av_log_obj, AV_LOG_INFO, "\n");
if (opt->unit && opt->type != AV_OPT_TYPE_CONST) {
opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags);
@@ -948,6 +1117,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
const AVClass *class = *(AVClass **)s;
const AVOption *opt = NULL;
while ((opt = av_opt_next(s, opt)) != NULL) {
+ void *dst = ((uint8_t*)s) + opt->offset;
#if FF_API_OLD_AVOPTIONS
if ((opt->flags & mask) != flags)
continue;
@@ -960,41 +1130,49 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
case AV_OPT_TYPE_INT:
case AV_OPT_TYPE_INT64:
case AV_OPT_TYPE_DURATION:
- av_opt_set_int(s, opt->name, opt->default_val.i64, 0);
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ write_number(s, opt, dst, 1, 1, opt->default_val.i64);
break;
case AV_OPT_TYPE_DOUBLE:
case AV_OPT_TYPE_FLOAT: {
double val;
val = opt->default_val.dbl;
- av_opt_set_double(s, opt->name, val, 0);
+ write_number(s, opt, dst, val, 1, 1);
}
break;
case AV_OPT_TYPE_RATIONAL: {
AVRational val;
val = av_d2q(opt->default_val.dbl, INT_MAX);
- av_opt_set_q(s, opt->name, val, 0);
+ write_number(s, opt, dst, 1, val.den, val.num);
}
break;
+ case AV_OPT_TYPE_COLOR:
+ set_string_color(s, opt, opt->default_val.str, dst);
+ break;
case AV_OPT_TYPE_STRING:
+ set_string(s, opt, opt->default_val.str, dst);
+ break;
case AV_OPT_TYPE_IMAGE_SIZE:
+ set_string_image_size(s, opt, opt->default_val.str, dst);
+ break;
case AV_OPT_TYPE_VIDEO_RATE:
- av_opt_set(s, opt->name, opt->default_val.str, 0);
+ set_string_video_rate(s, opt, opt->default_val.str, dst);
break;
case AV_OPT_TYPE_PIXEL_FMT:
-#if LIBAVUTIL_VERSION_MAJOR < 53
+#if LIBAVUTIL_VERSION_MAJOR < 54
if (class->version && class->version < AV_VERSION_INT(52, 10, 100))
av_opt_set(s, opt->name, opt->default_val.str, 0);
else
#endif
- av_opt_set_pixel_fmt(s, opt->name, opt->default_val.i64, 0);
+ write_number(s, opt, dst, 1, 1, opt->default_val.i64);
break;
case AV_OPT_TYPE_SAMPLE_FMT:
-#if LIBAVUTIL_VERSION_MAJOR < 53
+#if LIBAVUTIL_VERSION_MAJOR < 54
if (class->version && class->version < AV_VERSION_INT(52, 10, 100))
av_opt_set(s, opt->name, opt->default_val.str, 0);
else
#endif
- av_opt_set_sample_fmt(s, opt->name, opt->default_val.i64, 0);
+ write_number(s, opt, dst, 1, 1, opt->default_val.i64);
break;
case AV_OPT_TYPE_BINARY:
/* Cannot set default for binary */
@@ -1029,9 +1207,16 @@ static int parse_key_value_pair(void *ctx, const char **buf,
char *val;
int ret;
+ if (!key)
+ return AVERROR(ENOMEM);
+
if (*key && strspn(*buf, key_val_sep)) {
(*buf)++;
val = av_get_token(buf, pairs_sep);
+ if (!val) {
+ av_freep(&key);
+ return AVERROR(ENOMEM);
+ }
} else {
av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key);
av_free(key);
@@ -1040,7 +1225,7 @@ static int parse_key_value_pair(void *ctx, const char **buf,
av_log(ctx, AV_LOG_DEBUG, "Setting entry with key '%s' to value '%s'\n", key, val);
- ret = av_opt_set(ctx, key, val, 0);
+ ret = av_opt_set(ctx, key, val, AV_OPT_SEARCH_CHILDREN);
if (ret == AVERROR_OPTION_NOT_FOUND)
av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key);
@@ -1227,6 +1412,9 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
c= *(AVClass**)obj;
+ if (!c)
+ return NULL;
+
if (search_flags & AV_OPT_SEARCH_CHILDREN) {
if (search_flags & AV_OPT_SEARCH_FAKE_OBJ) {
const AVClass *child = NULL;
@@ -1324,6 +1512,8 @@ int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const ch
case AV_OPT_TYPE_FLOAT:
case AV_OPT_TYPE_DOUBLE:
case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_COLOR:
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
break;
case AV_OPT_TYPE_STRING:
range->component_min = 0;
@@ -1390,6 +1580,8 @@ typedef struct TestContext
enum AVPixelFormat pix_fmt;
enum AVSampleFormat sample_fmt;
int64_t duration;
+ uint8_t color[4];
+ int64_t channel_layout;
} TestContext;
#define OFFSET(x) offsetof(TestContext, x)
@@ -1408,10 +1600,12 @@ static const AVOption test_options[]= {
{"lame", "set lame flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_LAME}, INT_MIN, INT_MAX, 0, "flags" },
{"mu", "set mu flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_MU}, INT_MIN, INT_MAX, 0, "flags" },
{"size", "set size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE,{0}, 0, 0 },
-{"pix_fmt", "set pixfmt", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, -1, AV_PIX_FMT_NB-1},
-{"sample_fmt", "set samplefmt", OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, {.i64 = AV_SAMPLE_FMT_NONE}, -1, AV_SAMPLE_FMT_NB-1},
+{"pix_fmt", "set pixfmt", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, -1, INT_MAX},
+{"sample_fmt", "set samplefmt", OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, {.i64 = AV_SAMPLE_FMT_NONE}, -1, INT_MAX},
{"video_rate", "set videorate", OFFSET(video_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0 },
{"duration", "set duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX},
+{"color", "set color", OFFSET(color), AV_OPT_TYPE_COLOR, {.str = "pink"}, 0, 0},
+{"cl", "set channel layout", OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64 = AV_CH_LAYOUT_HEXAGONAL}, 0, INT64_MAX},
{NULL},
};
@@ -1433,7 +1627,7 @@ int main(void)
printf("\nTesting av_set_options_string()\n");
{
TestContext test_ctx = { 0 };
- const char *options[] = {
+ static const char * const options[] = {
"",
":",
"=",
@@ -1470,6 +1664,11 @@ int main(void)
"duration=bogus",
"duration=123.45",
"duration=1\\:23\\:45.67",
+ "color=blue",
+ "color=0x223300",
+ "color=0x42FF07AA",
+ "cl=stereo+downmix",
+ "cl=foo",
};
test_ctx.class = &test_class;
@@ -1483,13 +1682,13 @@ int main(void)
av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
printf("\n");
}
- av_freep(&test_ctx.string);
+ av_opt_free(&test_ctx);
}
printf("\nTesting av_opt_set_from_string()\n");
{
TestContext test_ctx = { 0 };
- const char *options[] = {
+ static const char * const options[] = {
"",
"5",
"5:hello",
@@ -1500,11 +1699,10 @@ int main(void)
" 5 : hello : size = pal ",
"a_very_long_option_name_that_will_need_to_be_ellipsized_around_here=42"
};
- const char *shorthand[] = { "num", "string", NULL };
+ static const char * const shorthand[] = { "num", "string", NULL };
test_ctx.class = &test_class;
av_opt_set_defaults(&test_ctx);
- test_ctx.string = av_strdup("default");
av_log_set_level(AV_LOG_DEBUG);
@@ -1514,7 +1712,7 @@ int main(void)
av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
printf("\n");
}
- av_freep(&test_ctx.string);
+ av_opt_free(&test_ctx);
}
return 0;
diff --git a/ffmpeg/libavutil/opt.h b/ffmpeg/libavutil/opt.h
index 30f729e..14faa6e 100644
--- a/ffmpeg/libavutil/opt.h
+++ b/ffmpeg/libavutil/opt.h
@@ -64,7 +64,7 @@
* int bin_len;
* } test_struct;
*
- * static const AVOption options[] = {
+ * static const AVOption test_options[] = {
* { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt),
* AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX },
* { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt),
@@ -77,7 +77,7 @@
* static const AVClass test_class = {
* .class_name = "test class",
* .item_name = av_default_item_name,
- * .option = options,
+ * .option = test_options,
* .version = LIBAVUTIL_VERSION_INT,
* };
* @endcode
@@ -163,7 +163,7 @@
*
* @subsection avoptions_implement_named_constants Named constants
* It is possible to create named constants for options. Simply set the unit
- * field of the option the constants should apply to to a string and
+ * field of the option the constants should apply to a string and
* create the constants themselves as options of type AV_OPT_TYPE_CONST
* with their unit field set to the same string.
* Their default_val field should contain the value of the named
@@ -232,6 +232,8 @@ enum AVOptionType{
AV_OPT_TYPE_SAMPLE_FMT = MKBETAG('S','F','M','T'),
AV_OPT_TYPE_VIDEO_RATE = MKBETAG('V','R','A','T'), ///< offset must point to AVRational
AV_OPT_TYPE_DURATION = MKBETAG('D','U','R',' '),
+ AV_OPT_TYPE_COLOR = MKBETAG('C','O','L','R'),
+ AV_OPT_TYPE_CHANNEL_LAYOUT = MKBETAG('C','H','L','A'),
#if FF_API_OLD_AVOPTIONS
FF_OPT_TYPE_FLAGS = 0,
FF_OPT_TYPE_INT,
@@ -318,7 +320,7 @@ typedef struct AVOptionRanges {
/**
* Look for an option in obj. Look only for the options which
* have the flags set as specified in mask and flags (that is,
- * for which it is the case that opt->flags & mask == flags).
+ * for which it is the case that (opt->flags & mask) == flags).
*
* @param[in] obj a pointer to a struct whose first element is a
* pointer to an AVClass
@@ -656,6 +658,23 @@ int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_
int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags);
int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags);
int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags);
+int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags);
+
+/**
+ * Set a binary option to an integer list.
+ *
+ * @param obj AVClass object to set options on
+ * @param name name of the binary option
+ * @param val pointer to an integer list (must have the correct type with
+ * regard to the contents of the list)
+ * @param term list terminator (usually 0 or -1)
+ * @param flags search flags
+ */
+#define av_opt_set_int_list(obj, name, val, term, flags) \
+ (av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \
+ AVERROR(EINVAL) : \
+ av_opt_set_bin(obj, name, (const uint8_t *)(val), \
+ av_int_list_length(val, term) * sizeof(*(val)), flags))
/**
* @}
*/
@@ -670,10 +689,10 @@ int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int searc
* @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN
* is passed here, then the option may be found in a child of obj.
* @param[out] out_val value of the option will be written here
- * @return 0 on success, a negative error code otherwise
+ * @return >=0 on success, a negative error code otherwise
*/
/**
- * @note the returned string will av_malloc()ed and must be av_free()ed by the caller
+ * @note the returned string will be av_malloc()ed and must be av_free()ed by the caller
*/
int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val);
int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val);
@@ -683,6 +702,7 @@ int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_
int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt);
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt);
int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val);
+int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout);
/**
* @}
*/
diff --git a/ffmpeg/libavutil/parseutils.c b/ffmpeg/libavutil/parseutils.c
index f2f8f18..ba4b4e1 100644
--- a/ffmpeg/libavutil/parseutils.c
+++ b/ffmpeg/libavutil/parseutils.c
@@ -115,6 +115,12 @@ static const VideoSizeAbbr video_size_abbrs[] = {
{ "4k", 4096,2160 }, /* Digital Cinema System Specification */
{ "4kflat", 3996,2160 },
{ "4kscope", 4096,1716 },
+ { "nhd", 640,360 },
+ { "hqvga", 240,160 },
+ { "wqvga", 400,240 },
+ { "fwqvga", 432,240 },
+ { "hvga", 480,320 },
+ { "qhd", 960,540 },
};
static const VideoRateAbbr video_rate_abbrs[]= {
@@ -414,6 +420,20 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
return 0;
}
+const char *av_get_known_color_name(int color_idx, const uint8_t **rgbp)
+{
+ const ColorEntry *color;
+
+ if ((unsigned)color_idx >= FF_ARRAY_ELEMS(color_table))
+ return NULL;
+
+ color = &color_table[color_idx];
+ if (rgbp)
+ *rgbp = color->rgb_color;
+
+ return color->name;
+}
+
/* get a positive number between n_min and n_max, for a maximum length
of len_max. Return -1 if error. */
static int date_get_num(const char **pp,
@@ -593,12 +613,14 @@ int av_parse_time(int64_t *timeval, const char *timestr, int duration)
dt.tm_hour = 0;
}
if (!q) {
+ char *o;
/* parse timestr as S+ */
- dt.tm_sec = strtol(p, (void *)&q, 10);
- if (q == p) /* the parsing didn't succeed */
+ dt.tm_sec = strtol(p, &o, 10);
+ if (o == p) /* the parsing didn't succeed */
return AVERROR(EINVAL);
dt.tm_min = 0;
dt.tm_hour = 0;
+ q = o;
}
}
@@ -824,13 +846,13 @@ int main(void)
time_t tvi;
struct tm *tm;
static char tzstr[] = "TZ=CET-1";
- const char *time_string[] = {
+ static const char * const time_string[] = {
"now",
"12:35:46",
"2000-12-20 0:02:47.5z",
"2000-12-20T010247.6",
};
- const char *duration_string[] = {
+ static const char * const duration_string[] = {
"2:34:56.79",
"-1:23:45.67",
"42.1729",
diff --git a/ffmpeg/libavutil/parseutils.h b/ffmpeg/libavutil/parseutils.h
index 3eb35fc..c80f0de 100644
--- a/ffmpeg/libavutil/parseutils.h
+++ b/ffmpeg/libavutil/parseutils.h
@@ -99,6 +99,19 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
void *log_ctx);
/**
+ * Get the name of a color from the internal table of hard-coded named
+ * colors.
+ *
+ * This function is meant to enumerate the color names recognized by
+ * av_parse_color().
+ *
+ * @param color_idx index of the requested color, starting from 0
+ * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB
+ * @return the color name string or NULL if color_idx is not in the array
+ */
+const char *av_get_known_color_name(int color_idx, const uint8_t **rgb);
+
+/**
* Parse timestr and return in *time a corresponding number of
* microseconds.
*
@@ -127,7 +140,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
* @endcode
* @param duration flag which tells how to interpret timestr, if not
* zero timestr is interpreted as a duration, otherwise as a date
- * @return 0 in case of success, a negative value corresponding to an
+ * @return >= 0 in case of success, a negative value corresponding to an
* AVERROR code otherwise
*/
int av_parse_time(int64_t *timeval, const char *timestr, int duration);
diff --git a/ffmpeg/libavutil/pca.c b/ffmpeg/libavutil/pca.c
index 54927a2..311b6bc 100644
--- a/ffmpeg/libavutil/pca.c
+++ b/ffmpeg/libavutil/pca.c
@@ -40,12 +40,12 @@ PCA *ff_pca_init(int n){
if(n<=0)
return NULL;
- pca= av_mallocz(sizeof(PCA));
+ pca= av_mallocz(sizeof(*pca));
pca->n= n;
pca->z = av_malloc(sizeof(*pca->z) * n);
pca->count=0;
- pca->covariance= av_mallocz(sizeof(double)*n*n);
- pca->mean= av_mallocz(sizeof(double)*n);
+ pca->covariance= av_calloc(n*n, sizeof(double));
+ pca->mean= av_calloc(n, sizeof(double));
return pca;
}
diff --git a/ffmpeg/libavutil/pixdesc.c b/ffmpeg/libavutil/pixdesc.c
index 31363cf..166190e 100644
--- a/ffmpeg/libavutil/pixdesc.c
+++ b/ffmpeg/libavutil/pixdesc.c
@@ -22,11 +22,14 @@
#include <stdio.h>
#include <string.h>
+#include "avassert.h"
#include "common.h"
#include "pixfmt.h"
#include "pixdesc.h"
-
+#include "internal.h"
#include "intreadwrite.h"
+#include "avstring.h"
+#include "version.h"
void av_read_image_line(uint16_t *dst,
const uint8_t *data[4], const int linesize[4],
@@ -42,7 +45,7 @@ void av_read_image_line(uint16_t *dst,
int step = comp.step_minus1 + 1;
int flags = desc->flags;
- if (flags & PIX_FMT_BITSTREAM) {
+ if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
int skip = x * step + comp.offset_plus1 - 1;
const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
int shift = 8 - depth - (skip & 7);
@@ -62,11 +65,11 @@ void av_read_image_line(uint16_t *dst,
int is_8bit = shift + depth <= 8;
if (is_8bit)
- p += !!(flags & PIX_FMT_BE);
+ p += !!(flags & AV_PIX_FMT_FLAG_BE);
while (w--) {
int val = is_8bit ? *p :
- flags & PIX_FMT_BE ? AV_RB16(p) : AV_RL16(p);
+ flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p);
val = (val >> shift) & mask;
if (read_pal_component)
val = data[1][4 * val + c];
@@ -87,7 +90,7 @@ void av_write_image_line(const uint16_t *src,
int step = comp.step_minus1 + 1;
int flags = desc->flags;
- if (flags & PIX_FMT_BITSTREAM) {
+ if (flags & AV_PIX_FMT_FLAG_BITSTREAM) {
int skip = x * step + comp.offset_plus1 - 1;
uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3);
int shift = 8 - depth - (skip & 7);
@@ -104,14 +107,14 @@ void av_write_image_line(const uint16_t *src,
x * step + comp.offset_plus1 - 1;
if (shift + depth <= 8) {
- p += !!(flags & PIX_FMT_BE);
+ p += !!(flags & AV_PIX_FMT_FLAG_BE);
while (w--) {
*p |= (*src++ << shift);
p += step;
}
} else {
while (w--) {
- if (flags & PIX_FMT_BE) {
+ if (flags & AV_PIX_FMT_FLAG_BE) {
uint16_t val = AV_RB16(p) | (*src++ << shift);
AV_WB16(p, val);
} else {
@@ -138,7 +141,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUYV422] = {
.name = "yuyv422",
@@ -161,7 +164,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 2, 2, 0, 7 }, /* G */
{ 0, 2, 3, 0, 7 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR24] = {
.name = "bgr24",
@@ -173,7 +176,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 2, 2, 0, 7 }, /* G */
{ 0, 2, 1, 0, 7 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_YUV422P] = {
.name = "yuv422p",
@@ -185,7 +188,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P] = {
.name = "yuv444p",
@@ -197,7 +200,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV410P] = {
.name = "yuv410p",
@@ -209,7 +212,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV411P] = {
.name = "yuv411p",
@@ -221,7 +224,19 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
+ },
+ [AV_PIX_FMT_YUVJ411P] = {
+ .name = "yuvj411p",
+ .nb_components = 3,
+ .log2_chroma_w = 2,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 0, 1, 0, 7 }, /* Y */
+ { 1, 0, 1, 0, 7 }, /* U */
+ { 2, 0, 1, 0, 7 }, /* V */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_GRAY8] = {
.name = "gray",
@@ -231,7 +246,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.comp = {
{ 0, 0, 1, 0, 7 }, /* Y */
},
- .flags = PIX_FMT_PSEUDOPAL,
+ .flags = AV_PIX_FMT_FLAG_PSEUDOPAL,
},
[AV_PIX_FMT_MONOWHITE] = {
.name = "monow",
@@ -241,7 +256,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.comp = {
{ 0, 0, 1, 0, 0 }, /* Y */
},
- .flags = PIX_FMT_BITSTREAM,
+ .flags = AV_PIX_FMT_FLAG_BITSTREAM,
},
[AV_PIX_FMT_MONOBLACK] = {
.name = "monob",
@@ -251,7 +266,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.comp = {
{ 0, 0, 1, 7, 0 }, /* Y */
},
- .flags = PIX_FMT_BITSTREAM,
+ .flags = AV_PIX_FMT_FLAG_BITSTREAM,
},
[AV_PIX_FMT_PAL8] = {
.name = "pal8",
@@ -261,7 +276,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.comp = {
{ 0, 0, 1, 0, 7 },
},
- .flags = PIX_FMT_PAL,
+ .flags = AV_PIX_FMT_FLAG_PAL,
},
[AV_PIX_FMT_YUVJ420P] = {
.name = "yuvj420p",
@@ -273,7 +288,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUVJ422P] = {
.name = "yuvj422p",
@@ -285,7 +300,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUVJ444P] = {
.name = "yuvj444p",
@@ -297,16 +312,24 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
+#if FF_API_XVMC
[AV_PIX_FMT_XVMC_MPEG2_MC] = {
.name = "xvmcmc",
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_XVMC_MPEG2_IDCT] = {
.name = "xvmcidct",
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
+ },
+#endif /* FF_API_XVMC */
+#if !FF_API_XVMC
+ [AV_PIX_FMT_XVMC] = {
+ .name = "xvmc",
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
+#endif /* !FF_API_XVMC */
[AV_PIX_FMT_UYVY422] = {
.name = "uyvy422",
.nb_components = 3,
@@ -339,7 +362,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 0, 1, 3, 2 }, /* G */
{ 0, 0, 1, 6, 1 }, /* B */
},
- .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
},
[AV_PIX_FMT_BGR4] = {
.name = "bgr4",
@@ -351,7 +374,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 2, 0, 1 }, /* G */
{ 0, 3, 1, 0, 0 }, /* B */
},
- .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR4_BYTE] = {
.name = "bgr4_byte",
@@ -363,7 +386,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 0, 1, 1, 1 }, /* G */
{ 0, 0, 1, 3, 0 }, /* B */
},
- .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
},
[AV_PIX_FMT_RGB8] = {
.name = "rgb8",
@@ -375,7 +398,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 0, 1, 3, 2 }, /* G */
{ 0, 0, 1, 0, 2 }, /* B */
},
- .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
},
[AV_PIX_FMT_RGB4] = {
.name = "rgb4",
@@ -387,7 +410,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 2, 0, 1 }, /* G */
{ 0, 3, 4, 0, 0 }, /* B */
},
- .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_RGB4_BYTE] = {
.name = "rgb4_byte",
@@ -399,7 +422,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 0, 1, 1, 1 }, /* G */
{ 0, 0, 1, 0, 0 }, /* B */
},
- .flags = PIX_FMT_RGB | PIX_FMT_PSEUDOPAL,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL,
},
[AV_PIX_FMT_NV12] = {
.name = "nv12",
@@ -411,7 +434,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 7 }, /* U */
{ 1, 1, 2, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_NV21] = {
.name = "nv21",
@@ -423,7 +446,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 2, 0, 7 }, /* U */
{ 1, 1, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_ARGB] = {
.name = "argb",
@@ -436,7 +459,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 4, 0, 7 }, /* B */
{ 0, 3, 1, 0, 7 }, /* A */
},
- .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_RGBA] = {
.name = "rgba",
@@ -449,7 +472,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* B */
{ 0, 3, 4, 0, 7 }, /* A */
},
- .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_ABGR] = {
.name = "abgr",
@@ -462,7 +485,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 2, 0, 7 }, /* B */
{ 0, 3, 1, 0, 7 }, /* A */
},
- .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_BGRA] = {
.name = "bgra",
@@ -475,7 +498,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 1, 0, 7 }, /* B */
{ 0, 3, 4, 0, 7 }, /* A */
},
- .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_0RGB] = {
.name = "0rgb",
@@ -487,7 +510,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* G */
{ 0, 3, 4, 0, 7 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_RGB0] = {
.name = "rgb0",
@@ -498,9 +521,8 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 1, 0, 7 }, /* R */
{ 0, 3, 2, 0, 7 }, /* G */
{ 0, 3, 3, 0, 7 }, /* B */
- { 0, 3, 4, 0, 7 }, /* A */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_0BGR] = {
.name = "0bgr",
@@ -512,7 +534,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* G */
{ 0, 3, 2, 0, 7 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR0] = {
.name = "bgr0",
@@ -523,9 +545,8 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 3, 3, 0, 7 }, /* R */
{ 0, 3, 2, 0, 7 }, /* G */
{ 0, 3, 1, 0, 7 }, /* B */
- { 0, 3, 4, 0, 7 }, /* A */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GRAY16BE] = {
.name = "gray16be",
@@ -535,7 +556,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.comp = {
{ 0, 1, 1, 0, 15 }, /* Y */
},
- .flags = PIX_FMT_BE,
+ .flags = AV_PIX_FMT_FLAG_BE,
},
[AV_PIX_FMT_GRAY16LE] = {
.name = "gray16le",
@@ -556,7 +577,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUVJ440P] = {
.name = "yuvj440p",
@@ -568,7 +589,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 0, 1, 0, 7 }, /* U */
{ 2, 0, 1, 0, 7 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUVA420P] = {
.name = "yuva420p",
@@ -581,7 +602,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 0, 1, 0, 7 }, /* V */
{ 3, 0, 1, 0, 7 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA422P] = {
.name = "yuva422p",
@@ -594,7 +615,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 0, 1, 0, 7 }, /* V */
{ 3, 0, 1, 0, 7 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P] = {
.name = "yuva444p",
@@ -607,7 +628,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 0, 1, 0, 7 }, /* V */
{ 3, 0, 1, 0, 7 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA420P9BE] = {
.name = "yuva420p9be",
@@ -620,7 +641,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 8 }, /* V */
{ 3, 1, 1, 0, 8 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA420P9LE] = {
.name = "yuva420p9le",
@@ -633,7 +654,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 8 }, /* V */
{ 3, 1, 1, 0, 8 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA422P9BE] = {
.name = "yuva422p9be",
@@ -646,7 +667,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 8 }, /* V */
{ 3, 1, 1, 0, 8 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA422P9LE] = {
.name = "yuva422p9le",
@@ -659,7 +680,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 8 }, /* V */
{ 3, 1, 1, 0, 8 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P9BE] = {
.name = "yuva444p9be",
@@ -672,7 +693,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 8 }, /* V */
{ 3, 1, 1, 0, 8 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P9LE] = {
.name = "yuva444p9le",
@@ -685,7 +706,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 8 }, /* V */
{ 3, 1, 1, 0, 8 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA420P10BE] = {
.name = "yuva420p10be",
@@ -698,7 +719,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 9 }, /* V */
{ 3, 1, 1, 0, 9 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA420P10LE] = {
.name = "yuva420p10le",
@@ -711,7 +732,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 9 }, /* V */
{ 3, 1, 1, 0, 9 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA422P10BE] = {
.name = "yuva422p10be",
@@ -724,7 +745,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 9 }, /* V */
{ 3, 1, 1, 0, 9 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA422P10LE] = {
.name = "yuva422p10le",
@@ -737,7 +758,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 9 }, /* V */
{ 3, 1, 1, 0, 9 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P10BE] = {
.name = "yuva444p10be",
@@ -750,7 +771,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 9 }, /* V */
{ 3, 1, 1, 0, 9 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P10LE] = {
.name = "yuva444p10le",
@@ -763,7 +784,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 9 }, /* V */
{ 3, 1, 1, 0, 9 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA420P16BE] = {
.name = "yuva420p16be",
@@ -776,7 +797,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 15 }, /* V */
{ 3, 1, 1, 0, 15 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA420P16LE] = {
.name = "yuva420p16le",
@@ -789,7 +810,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 15 }, /* V */
{ 3, 1, 1, 0, 15 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA422P16BE] = {
.name = "yuva422p16be",
@@ -802,7 +823,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 15 }, /* V */
{ 3, 1, 1, 0, 15 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA422P16LE] = {
.name = "yuva422p16le",
@@ -815,7 +836,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 15 }, /* V */
{ 3, 1, 1, 0, 15 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P16BE] = {
.name = "yuva444p16be",
@@ -828,7 +849,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 15 }, /* V */
{ 3, 1, 1, 0, 15 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P16LE] = {
.name = "yuva444p16le",
@@ -841,44 +862,46 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 2, 1, 1, 0, 15 }, /* V */
{ 3, 1, 1, 0, 15 }, /* A */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
+#if FF_API_VDPAU
[AV_PIX_FMT_VDPAU_H264] = {
.name = "vdpau_h264",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_VDPAU_MPEG1] = {
.name = "vdpau_mpeg1",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_VDPAU_MPEG2] = {
.name = "vdpau_mpeg2",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_VDPAU_WMV3] = {
.name = "vdpau_wmv3",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_VDPAU_VC1] = {
.name = "vdpau_vc1",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_VDPAU_MPEG4] = {
.name = "vdpau_mpeg4",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
+#endif
[AV_PIX_FMT_RGB48BE] = {
.name = "rgb48be",
.nb_components = 3,
@@ -889,7 +912,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 5, 3, 0, 15 }, /* G */
{ 0, 5, 5, 0, 15 }, /* B */
},
- .flags = PIX_FMT_RGB | PIX_FMT_BE,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
},
[AV_PIX_FMT_RGB48LE] = {
.name = "rgb48le",
@@ -901,7 +924,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 5, 3, 0, 15 }, /* G */
{ 0, 5, 5, 0, 15 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_RGBA64BE] = {
.name = "rgba64be",
@@ -914,7 +937,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 7, 5, 0, 15 }, /* B */
{ 0, 7, 7, 0, 15 }, /* A */
},
- .flags = PIX_FMT_RGB | PIX_FMT_BE | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_RGBA64LE] = {
.name = "rgba64le",
@@ -927,7 +950,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 7, 5, 0, 15 }, /* B */
{ 0, 7, 7, 0, 15 }, /* A */
},
- .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_RGB565BE] = {
.name = "rgb565be",
@@ -939,7 +962,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 5, 5 }, /* G */
{ 0, 1, 1, 0, 4 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_RGB565LE] = {
.name = "rgb565le",
@@ -951,7 +974,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 5, 5 }, /* G */
{ 0, 1, 1, 0, 4 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_RGB555BE] = {
.name = "rgb555be",
@@ -963,7 +986,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 5, 4 }, /* G */
{ 0, 1, 1, 0, 4 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_RGB555LE] = {
.name = "rgb555le",
@@ -975,7 +998,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 5, 4 }, /* G */
{ 0, 1, 1, 0, 4 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_RGB444BE] = {
.name = "rgb444be",
@@ -987,7 +1010,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 4, 3 }, /* G */
{ 0, 1, 1, 0, 3 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_RGB444LE] = {
.name = "rgb444le",
@@ -999,7 +1022,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 4, 3 }, /* G */
{ 0, 1, 1, 0, 3 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR48BE] = {
.name = "bgr48be",
@@ -1011,7 +1034,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 5, 3, 0, 15 }, /* G */
{ 0, 5, 1, 0, 15 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR48LE] = {
.name = "bgr48le",
@@ -1023,7 +1046,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 5, 3, 0, 15 }, /* G */
{ 0, 5, 1, 0, 15 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGRA64BE] = {
.name = "bgra64be",
@@ -1036,7 +1059,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 7, 1, 0, 15 }, /* B */
{ 0, 7, 7, 0, 15 }, /* A */
},
- .flags = PIX_FMT_BE | PIX_FMT_RGB | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_BGRA64LE] = {
.name = "bgra64le",
@@ -1049,7 +1072,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 7, 1, 0, 15 }, /* B */
{ 0, 7, 7, 0, 15 }, /* A */
},
- .flags = PIX_FMT_RGB | PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_BGR565BE] = {
.name = "bgr565be",
@@ -1061,7 +1084,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 5, 5 }, /* G */
{ 0, 1, 0, 3, 4 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR565LE] = {
.name = "bgr565le",
@@ -1073,7 +1096,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 5, 5 }, /* G */
{ 0, 1, 2, 3, 4 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR555BE] = {
.name = "bgr555be",
@@ -1085,7 +1108,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 5, 4 }, /* G */
{ 0, 1, 0, 2, 4 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR555LE] = {
.name = "bgr555le",
@@ -1097,7 +1120,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 5, 4 }, /* G */
{ 0, 1, 2, 2, 4 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR444BE] = {
.name = "bgr444be",
@@ -1109,7 +1132,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 4, 3 }, /* G */
{ 0, 1, 0, 0, 3 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_BGR444LE] = {
.name = "bgr444le",
@@ -1121,25 +1144,25 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 4, 3 }, /* G */
{ 0, 1, 2, 0, 3 }, /* B */
},
- .flags = PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_VAAPI_MOCO] = {
.name = "vaapi_moco",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_VAAPI_IDCT] = {
.name = "vaapi_idct",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_VAAPI_VLD] = {
.name = "vaapi_vld",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_YUV420P9LE] = {
.name = "yuv420p9le",
@@ -1151,7 +1174,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 8 }, /* U */
{ 2, 1, 1, 0, 8 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P9BE] = {
.name = "yuv420p9be",
@@ -1163,7 +1186,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 8 }, /* U */
{ 2, 1, 1, 0, 8 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P10LE] = {
.name = "yuv420p10le",
@@ -1175,7 +1198,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 9 }, /* U */
{ 2, 1, 1, 0, 9 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P10BE] = {
.name = "yuv420p10be",
@@ -1187,7 +1210,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 9 }, /* U */
{ 2, 1, 1, 0, 9 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P12LE] = {
.name = "yuv420p12le",
@@ -1199,7 +1222,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 11 }, /* U */
{ 2, 1, 1, 0, 11 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P12BE] = {
.name = "yuv420p12be",
@@ -1211,7 +1234,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 11 }, /* U */
{ 2, 1, 1, 0, 11 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P14LE] = {
.name = "yuv420p14le",
@@ -1223,7 +1246,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 13 }, /* U */
{ 2, 1, 1, 0, 13 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P14BE] = {
.name = "yuv420p14be",
@@ -1235,7 +1258,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 13 }, /* U */
{ 2, 1, 1, 0, 13 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P16LE] = {
.name = "yuv420p16le",
@@ -1247,7 +1270,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 15 }, /* U */
{ 2, 1, 1, 0, 15 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV420P16BE] = {
.name = "yuv420p16be",
@@ -1259,7 +1282,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 15 }, /* U */
{ 2, 1, 1, 0, 15 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P9LE] = {
.name = "yuv422p9le",
@@ -1271,7 +1294,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 8 }, /* U */
{ 2, 1, 1, 0, 8 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P9BE] = {
.name = "yuv422p9be",
@@ -1283,7 +1306,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 8 }, /* U */
{ 2, 1, 1, 0, 8 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P10LE] = {
.name = "yuv422p10le",
@@ -1295,7 +1318,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 9 }, /* U */
{ 2, 1, 1, 0, 9 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P10BE] = {
.name = "yuv422p10be",
@@ -1307,7 +1330,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 9 }, /* U */
{ 2, 1, 1, 0, 9 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P12LE] = {
.name = "yuv422p12le",
@@ -1319,7 +1342,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 11 }, /* U */
{ 2, 1, 1, 0, 11 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P12BE] = {
.name = "yuv422p12be",
@@ -1331,7 +1354,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 11 }, /* U */
{ 2, 1, 1, 0, 11 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P14LE] = {
.name = "yuv422p14le",
@@ -1343,7 +1366,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 13 }, /* U */
{ 2, 1, 1, 0, 13 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P14BE] = {
.name = "yuv422p14be",
@@ -1355,7 +1378,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 13 }, /* U */
{ 2, 1, 1, 0, 13 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P16LE] = {
.name = "yuv422p16le",
@@ -1367,7 +1390,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 15 }, /* U */
{ 2, 1, 1, 0, 15 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV422P16BE] = {
.name = "yuv422p16be",
@@ -1379,7 +1402,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 15 }, /* U */
{ 2, 1, 1, 0, 15 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P16LE] = {
.name = "yuv444p16le",
@@ -1391,7 +1414,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 15 }, /* U */
{ 2, 1, 1, 0, 15 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P16BE] = {
.name = "yuv444p16be",
@@ -1403,7 +1426,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 15 }, /* U */
{ 2, 1, 1, 0, 15 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P10LE] = {
.name = "yuv444p10le",
@@ -1415,7 +1438,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 9 }, /* U */
{ 2, 1, 1, 0, 9 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P10BE] = {
.name = "yuv444p10be",
@@ -1427,7 +1450,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 9 }, /* U */
{ 2, 1, 1, 0, 9 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P9LE] = {
.name = "yuv444p9le",
@@ -1439,7 +1462,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 8 }, /* U */
{ 2, 1, 1, 0, 8 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P9BE] = {
.name = "yuv444p9be",
@@ -1451,7 +1474,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 8 }, /* U */
{ 2, 1, 1, 0, 8 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P12LE] = {
.name = "yuv444p12le",
@@ -1463,7 +1486,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 11 }, /* U */
{ 2, 1, 1, 0, 11 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P12BE] = {
.name = "yuv444p12be",
@@ -1475,7 +1498,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 11 }, /* U */
{ 2, 1, 1, 0, 11 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P14LE] = {
.name = "yuv444p14le",
@@ -1487,7 +1510,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 13 }, /* U */
{ 2, 1, 1, 0, 13 }, /* V */
},
- .flags = PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_YUV444P14BE] = {
.name = "yuv444p14be",
@@ -1499,19 +1522,19 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 1, 1, 1, 0, 13 }, /* U */
{ 2, 1, 1, 0, 13 }, /* V */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_DXVA2_VLD] = {
.name = "dxva2_vld",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_VDA_VLD] = {
.name = "vda_vld",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
},
[AV_PIX_FMT_GRAY8A] = {
.name = "gray8a",
@@ -1520,7 +1543,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 7 }, /* Y */
{ 0, 1, 2, 0, 7 }, /* A */
},
- .flags = PIX_FMT_ALPHA,
+ .flags = AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_GBRP] = {
.name = "gbrp",
@@ -1532,7 +1555,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 0, 1, 0, 7 }, /* G */
{ 1, 0, 1, 0, 7 }, /* B */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP9LE] = {
.name = "gbrp9le",
@@ -1544,7 +1567,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 8 }, /* G */
{ 1, 1, 1, 0, 8 }, /* B */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP9BE] = {
.name = "gbrp9be",
@@ -1556,7 +1579,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 8 }, /* G */
{ 1, 1, 1, 0, 8 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP10LE] = {
.name = "gbrp10le",
@@ -1568,7 +1591,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 9 }, /* G */
{ 1, 1, 1, 0, 9 }, /* B */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP10BE] = {
.name = "gbrp10be",
@@ -1580,7 +1603,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 9 }, /* G */
{ 1, 1, 1, 0, 9 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP12LE] = {
.name = "gbrp12le",
@@ -1592,7 +1615,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 11 }, /* G */
{ 1, 1, 1, 0, 11 }, /* B */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP12BE] = {
.name = "gbrp12be",
@@ -1604,7 +1627,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 11 }, /* G */
{ 1, 1, 1, 0, 11 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP14LE] = {
.name = "gbrp14le",
@@ -1616,7 +1639,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 13 }, /* G */
{ 1, 1, 1, 0, 13 }, /* B */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP14BE] = {
.name = "gbrp14be",
@@ -1628,7 +1651,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 13 }, /* G */
{ 1, 1, 1, 0, 13 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP16LE] = {
.name = "gbrp16le",
@@ -1640,7 +1663,7 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 15 }, /* G */
{ 1, 1, 1, 0, 15 }, /* B */
},
- .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
},
[AV_PIX_FMT_GBRP16BE] = {
.name = "gbrp16be",
@@ -1652,16 +1675,185 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
{ 0, 1, 1, 0, 15 }, /* G */
{ 1, 1, 1, 0, 15 }, /* B */
},
- .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB,
+ },
+ [AV_PIX_FMT_GBRAP] = {
+ .name = "gbrap",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 2, 0, 1, 0, 7 }, /* R */
+ { 0, 0, 1, 0, 7 }, /* G */
+ { 1, 0, 1, 0, 7 }, /* B */
+ { 3, 0, 1, 0, 7 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
+ },
+ [AV_PIX_FMT_GBRAP16LE] = {
+ .name = "gbrap16le",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 2, 1, 1, 0, 15 }, /* R */
+ { 0, 1, 1, 0, 15 }, /* G */
+ { 1, 1, 1, 0, 15 }, /* B */
+ { 3, 1, 1, 0, 15 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
+ },
+ [AV_PIX_FMT_GBRAP16BE] = {
+ .name = "gbrap16be",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 2, 1, 1, 0, 15 }, /* R */
+ { 0, 1, 1, 0, 15 }, /* G */
+ { 1, 1, 1, 0, 15 }, /* B */
+ { 3, 1, 1, 0, 15 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_VDPAU] = {
.name = "vdpau",
.log2_chroma_w = 1,
.log2_chroma_h = 1,
- .flags = PIX_FMT_HWACCEL,
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
+ },
+ [AV_PIX_FMT_XYZ12LE] = {
+ .name = "xyz12le",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 5, 1, 4, 11 }, /* X */
+ { 0, 5, 3, 4, 11 }, /* Y */
+ { 0, 5, 5, 4, 11 }, /* Z */
+ },
+ /*.flags = -- not used*/
+ },
+ [AV_PIX_FMT_XYZ12BE] = {
+ .name = "xyz12be",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 5, 1, 4, 11 }, /* X */
+ { 0, 5, 3, 4, 11 }, /* Y */
+ { 0, 5, 5, 4, 11 }, /* Z */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE,
+ },
+
+#define BAYER8_DESC_COMMON \
+ .nb_components= 3, \
+ .log2_chroma_w= 0, \
+ .log2_chroma_h= 0, \
+ .comp = { \
+ {0,0,0,0,1}, \
+ {0,0,0,0,3}, \
+ {0,0,0,0,1}, \
+ }, \
+
+#define BAYER16_DESC_COMMON \
+ .nb_components= 3, \
+ .log2_chroma_w= 0, \
+ .log2_chroma_h= 0, \
+ .comp = { \
+ {0,1,0,0, 3}, \
+ {0,1,0,0, 7}, \
+ {0,1,0,0, 3}, \
+ }, \
+
+ [AV_PIX_FMT_BAYER_BGGR8] = {
+ .name = "bayer_bggr8",
+ BAYER8_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_BGGR16LE] = {
+ .name = "bayer_bggr16le",
+ BAYER16_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_BGGR16BE] = {
+ .name = "bayer_bggr16be",
+ BAYER16_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_RGGB8] = {
+ .name = "bayer_rggb8",
+ BAYER8_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_RGGB16LE] = {
+ .name = "bayer_rggb16le",
+ BAYER16_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_RGGB16BE] = {
+ .name = "bayer_rggb16be",
+ BAYER16_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_GBRG8] = {
+ .name = "bayer_gbrg8",
+ BAYER8_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_GBRG16LE] = {
+ .name = "bayer_gbrg16le",
+ BAYER16_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_GBRG16BE] = {
+ .name = "bayer_gbrg16be",
+ BAYER16_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_GRBG8] = {
+ .name = "bayer_grbg8",
+ BAYER8_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_GRBG16LE] = {
+ .name = "bayer_grbg16le",
+ BAYER16_DESC_COMMON
+ },
+ [AV_PIX_FMT_BAYER_GRBG16BE] = {
+ .name = "bayer_grbg16be",
+ BAYER16_DESC_COMMON
+ },
+ [AV_PIX_FMT_NV16] = {
+ .name = "nv16",
+ .nb_components = 3,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 0, 1, 0, 7 }, /* Y */
+ { 1, 1, 1, 0, 7 }, /* U */
+ { 1, 1, 2, 0, 7 }, /* V */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
+ },
+ [AV_PIX_FMT_NV20LE] = {
+ .name = "nv20le",
+ .nb_components = 3,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 9 }, /* Y */
+ { 1, 3, 1, 0, 9 }, /* U */
+ { 1, 3, 3, 0, 9 }, /* V */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
+ },
+ [AV_PIX_FMT_NV20BE] = {
+ .name = "nv20be",
+ .nb_components = 3,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 1, 1, 0, 9 }, /* Y */
+ { 1, 3, 1, 0, 9 }, /* U */
+ { 1, 3, 3, 0, 9 }, /* V */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
},
};
+FF_DISABLE_DEPRECATION_WARNINGS
static enum AVPixelFormat get_pix_fmt_internal(const char *name)
{
enum AVPixelFormat pix_fmt;
@@ -1732,7 +1924,7 @@ int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
for (c = 0; c < 4; c++)
bits += steps[c];
- if(!(pixdesc->flags & PIX_FMT_BITSTREAM))
+ if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM))
bits *= 8;
return bits >> log2_pixels;
@@ -1779,6 +1971,7 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
return desc - av_pix_fmt_descriptors;
}
+FF_ENABLE_DEPRECATION_WARNINGS
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
int *h_shift, int *v_shift)
@@ -1806,3 +1999,63 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
ret += planes[i];
return ret;
}
+
+void ff_check_pixfmt_descriptors(void){
+ int i, j;
+
+ for (i=0; i<FF_ARRAY_ELEMS(av_pix_fmt_descriptors); i++) {
+ const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];
+ uint8_t fill[4][8+6+3] = {{0}};
+ uint8_t *data[4] = {fill[0], fill[1], fill[2], fill[3]};
+ int linesize[4] = {0,0,0,0};
+ uint16_t tmp[2];
+
+ if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)
+ continue;
+// av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);
+ av_assert0(d->log2_chroma_w <= 3);
+ av_assert0(d->log2_chroma_h <= 3);
+ av_assert0(d->nb_components <= 4);
+ av_assert0(d->name && d->name[0]);
+ av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA));
+ av_assert2(av_get_pix_fmt(d->name) == i);
+
+ for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {
+ const AVComponentDescriptor *c = &d->comp[j];
+ if(j>=d->nb_components) {
+ av_assert0(!c->plane && !c->step_minus1 && !c->offset_plus1 && !c->shift && !c->depth_minus1);
+ continue;
+ }
+ if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
+ av_assert0(c->step_minus1 >= c->depth_minus1);
+ } else {
+ av_assert0(8*(c->step_minus1+1) >= c->depth_minus1+1);
+ }
+ if (!strncmp(d->name, "bayer_", 6))
+ continue;
+ av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
+ av_assert0(tmp[0] == 0 && tmp[1] == 0);
+ tmp[0] = tmp[1] = (1<<(c->depth_minus1 + 1)) - 1;
+ av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2);
+ }
+ }
+}
+
+
+enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ char name[16];
+ int i;
+
+ if (!desc || strlen(desc->name) < 2)
+ return AV_PIX_FMT_NONE;
+ av_strlcpy(name, desc->name, sizeof(name));
+ i = strlen(name) - 2;
+ if (strcmp(name + i, "be") && strcmp(name + i, "le"))
+ return AV_PIX_FMT_NONE;
+
+ name[i] ^= 'b' ^ 'l';
+
+ return get_pix_fmt_internal(name);
+}
diff --git a/ffmpeg/libavutil/pixdesc.h b/ffmpeg/libavutil/pixdesc.h
index 0947fd1..e88bf9b 100644
--- a/ffmpeg/libavutil/pixdesc.h
+++ b/ffmpeg/libavutil/pixdesc.h
@@ -23,6 +23,8 @@
#define AVUTIL_PIXDESC_H
#include <inttypes.h>
+
+#include "attributes.h"
#include "pixfmt.h"
typedef struct AVComponentDescriptor{
@@ -86,27 +88,60 @@ typedef struct AVPixFmtDescriptor{
AVComponentDescriptor comp[4];
}AVPixFmtDescriptor;
-#define PIX_FMT_BE 1 ///< Pixel format is big-endian.
-#define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette.
-#define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end.
-#define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format.
-#define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane
-#define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale)
+/**
+ * Pixel format is big-endian.
+ */
+#define AV_PIX_FMT_FLAG_BE (1 << 0)
+/**
+ * Pixel format has a palette in data[1], values are indexes in this palette.
+ */
+#define AV_PIX_FMT_FLAG_PAL (1 << 1)
+/**
+ * All values of a component are bit-wise packed end to end.
+ */
+#define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2)
+/**
+ * Pixel format is an HW accelerated format.
+ */
+#define AV_PIX_FMT_FLAG_HWACCEL (1 << 3)
+/**
+ * At least one pixel component is not in the first data plane.
+ */
+#define AV_PIX_FMT_FLAG_PLANAR (1 << 4)
+/**
+ * The pixel format contains RGB-like data (as opposed to YUV/grayscale).
+ */
+#define AV_PIX_FMT_FLAG_RGB (1 << 5)
/**
* The pixel format is "pseudo-paletted". This means that FFmpeg treats it as
* paletted internally, but the palette is generated by the decoder and is not
* stored in the file.
*/
-#define PIX_FMT_PSEUDOPAL 64
-
-#define PIX_FMT_ALPHA 128 ///< The pixel format has an alpha channel
+#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
+/**
+ * The pixel format has an alpha channel.
+ */
+#define AV_PIX_FMT_FLAG_ALPHA (1 << 7)
+#if FF_API_PIX_FMT
+/**
+ * @deprecated use the AV_PIX_FMT_FLAG_* flags
+ */
+#define PIX_FMT_BE AV_PIX_FMT_FLAG_BE
+#define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL
+#define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM
+#define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL
+#define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR
+#define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB
+#define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL
+#define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA
+#endif
#if FF_API_PIX_FMT_DESC
/**
* The array of all the pixel format descriptors.
*/
-extern const AVPixFmtDescriptor av_pix_fmt_descriptors[];
+extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[];
#endif
/**
@@ -168,7 +203,7 @@ const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt);
/**
* Print in buf the string corresponding to the pixel format with
- * number pix_fmt, or an header if pix_fmt is negative.
+ * number pix_fmt, or a header if pix_fmt is negative.
*
* @param buf the buffer where to write the string
* @param buf_size the size of buf
@@ -180,7 +215,8 @@ char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt
/**
* Return the number of bits per pixel used by the pixel format
- * described by pixdesc.
+ * described by pixdesc. Note that this is not the same as the number
+ * of bits per sample.
*
* The returned number of bits refers to the number of bits actually
* used for storing the pixel information, that is padding bits are
@@ -239,5 +275,17 @@ int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
*/
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
+void ff_check_pixfmt_descriptors(void);
+
+/**
+ * Utility function to swap the endianness of a pixel format.
+ *
+ * @param[in] pix_fmt the pixel format
+ *
+ * @return pixel format with swapped endianness if it exists,
+ * otherwise AV_PIX_FMT_NONE
+ */
+enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt);
+
#endif /* AVUTIL_PIXDESC_H */
diff --git a/ffmpeg/libavutil/pixfmt.h b/ffmpeg/libavutil/pixfmt.h
index 1c00ac4..9418c4a 100644
--- a/ffmpeg/libavutil/pixfmt.h
+++ b/ffmpeg/libavutil/pixfmt.h
@@ -28,7 +28,7 @@
*/
#include "libavutil/avconfig.h"
-#include "libavutil/version.h"
+#include "version.h"
#define AVPALETTE_SIZE 1024
#define AVPALETTE_COUNT 256
@@ -37,17 +37,17 @@
* Pixel format.
*
* @note
- * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
+ * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
* color is put together as:
* (A << 24) | (R << 16) | (G << 8) | B
* This is stored as BGRA on little-endian CPU architectures and ARGB on
* big-endian CPUs.
*
* @par
- * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
+ * When the pixel format is palettized RGB (AV_PIX_FMT_PAL8), the palettized
* image data is stored in AVFrame.data[0]. The palette is transported in
* AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
- * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is
+ * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is
* also endian-specific). Note also that the individual RGB palette
* components stored in AVFrame.data[1] should be in the range 0..255.
* This is important as many custom PAL8 video codecs that were designed
@@ -59,8 +59,8 @@
* allocating the picture.
*
* @note
- * Make sure that all newly added big-endian formats have pix_fmt & 1 == 1
- * and that all newly added little-endian formats have pix_fmt & 1 == 0.
+ * Make sure that all newly added big-endian formats have (pix_fmt & 1) == 1
+ * and that all newly added little-endian formats have (pix_fmt & 1) == 0.
* This allows simpler detection of big vs little-endian.
*/
enum AVPixelFormat {
@@ -80,8 +80,11 @@ enum AVPixelFormat {
AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range
AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range
AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range
+#if FF_API_XVMC
AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
AV_PIX_FMT_XVMC_MPEG2_IDCT,
+#define AV_PIX_FMT_XVMC AV_PIX_FMT_XVMC_MPEG2_IDCT
+#endif /* FF_API_XVMC */
AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
@@ -103,11 +106,13 @@ enum AVPixelFormat {
AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range
AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
+#if FF_API_VDPAU
AV_PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
AV_PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
AV_PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
AV_PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
AV_PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+#endif
AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
@@ -131,7 +136,9 @@ enum AVPixelFormat {
AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+#if FF_API_VDPAU
AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+#endif
AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
@@ -142,9 +149,11 @@ enum AVPixelFormat {
AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
- //the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus
- //If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately
- //is better
+ /**
+ * The following 12 formats have the disadvantage of needing 1 format for each bit depth.
+ * Notice that each 9/10 bits sample is stored in 16 bits with extra padding.
+ * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better.
+ */
AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
@@ -202,6 +211,12 @@ enum AVPixelFormat {
AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface
+ AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0
+ AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0
+ AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
+ AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+
#ifndef AV_PIX_FMT_ABI_GIT_MASTER
AV_PIX_FMT_RGBA64BE=0x123, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian
AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian
@@ -231,6 +246,27 @@ enum AVPixelFormat {
AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian
AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian
AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian
+ AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp
+ AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian
+ AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian
+ AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of PIX_FMT_YUV411P and setting color_range
+
+ AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */
+ AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */
+ AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */
+ AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */
+ AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */
+ AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */
+ AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
+ AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */
+ AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */
+ AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */
+ AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */
+ AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */
+#if !FF_API_XVMC
+ AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing
+#endif /* !FF_API_XVMC */
+
AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
#if FF_API_PIX_FMT
@@ -238,7 +274,7 @@ enum AVPixelFormat {
#endif
};
-#if AV_HAVE_INCOMPATIBLE_FORK_ABI
+#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
#define AV_PIX_FMT_YUVA422P AV_PIX_FMT_YUVA422P_LIBAV
#define AV_PIX_FMT_YUVA444P AV_PIX_FMT_YUVA444P_LIBAV
#endif
@@ -293,6 +329,13 @@ enum AVPixelFormat {
#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE)
#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE)
#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE)
+#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE)
+
+#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE)
+#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE)
+#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
+#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
+
#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
@@ -304,6 +347,9 @@ enum AVPixelFormat {
#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)
+#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE)
+#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
+
#if FF_API_PIX_FMT
#define PixelFormat AVPixelFormat
diff --git a/ffmpeg/libavutil/ppc/cpu.c b/ffmpeg/libavutil/ppc/cpu.c
index 20837da..d51e3fa 100644
--- a/ffmpeg/libavutil/ppc/cpu.c
+++ b/ffmpeg/libavutil/ppc/cpu.c
@@ -29,6 +29,7 @@
#endif /* __APPLE__ */
#include "libavutil/cpu.h"
+#include "libavutil/cpu_internal.h"
#include "config.h"
/**
diff --git a/ffmpeg/libavutil/ppc/float_dsp_altivec.h b/ffmpeg/libavutil/ppc/float_dsp_altivec.h
index b262a83..e1d530a 100644
--- a/ffmpeg/libavutil/ppc/float_dsp_altivec.h
+++ b/ffmpeg/libavutil/ppc/float_dsp_altivec.h
@@ -21,18 +21,18 @@
#ifndef AVUTIL_PPC_FLOAT_DSP_ALTIVEC_H
#define AVUTIL_PPC_FLOAT_DSP_ALTIVEC_H
-extern void ff_vector_fmul_altivec(float *dst, const float *src0,
- const float *src1, int len);
+void ff_vector_fmul_altivec(float *dst, const float *src0,
+ const float *src1, int len);
-extern void ff_vector_fmul_window_altivec(float *dst, const float *src0,
- const float *src1, const float *win,
- int len);
+void ff_vector_fmul_window_altivec(float *dst, const float *src0,
+ const float *src1, const float *win,
+ int len);
-extern void ff_vector_fmul_add_altivec(float *dst, const float *src0,
- const float *src1, const float *src2,
- int len);
+void ff_vector_fmul_add_altivec(float *dst, const float *src0,
+ const float *src1, const float *src2,
+ int len);
-extern void ff_vector_fmul_reverse_altivec(float *dst, const float *src0,
- const float *src1, int len);
+void ff_vector_fmul_reverse_altivec(float *dst, const float *src0,
+ const float *src1, int len);
#endif /* AVUTIL_PPC_FLOAT_DSP_ALTIVEC_H */
diff --git a/ffmpeg/libavutil/ppc/float_dsp_init.c b/ffmpeg/libavutil/ppc/float_dsp_init.c
index d9ca53e..9dd2072 100644
--- a/ffmpeg/libavutil/ppc/float_dsp_init.c
+++ b/ffmpeg/libavutil/ppc/float_dsp_init.c
@@ -19,16 +19,15 @@
*/
#include "config.h"
+#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/float_dsp.h"
+#include "libavutil/ppc/cpu.h"
#include "float_dsp_altivec.h"
-void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int bit_exact)
+av_cold void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int bit_exact)
{
-#if HAVE_ALTIVEC
- int mm_flags = av_get_cpu_flags();
-
- if (!(mm_flags & AV_CPU_FLAG_ALTIVEC))
+ if (!PPC_ALTIVEC(av_get_cpu_flags()))
return;
fdsp->vector_fmul = ff_vector_fmul_altivec;
@@ -38,5 +37,4 @@ void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int bit_exact)
if (!bit_exact) {
fdsp->vector_fmul_window = ff_vector_fmul_window_altivec;
}
-#endif
}
diff --git a/ffmpeg/libavutil/ppc/timer.h b/ffmpeg/libavutil/ppc/timer.h
index 155fc01..b28e624 100644
--- a/ffmpeg/libavutil/ppc/timer.h
+++ b/ffmpeg/libavutil/ppc/timer.h
@@ -23,6 +23,8 @@
#include <stdint.h>
+#include "config.h"
+
#define AV_READ_TIME read_time
static inline uint64_t read_time(void)
@@ -31,12 +33,11 @@ static inline uint64_t read_time(void)
/* from section 2.2.1 of the 32-bit PowerPC PEM */
__asm__ volatile(
- "1:\n"
"mftbu %2\n"
"mftb %0\n"
"mftbu %1\n"
"cmpw %2,%1\n"
- "bne 1b\n"
+ "bne $-0x10\n"
: "=r"(tbl), "=r"(tbu), "=r"(temp)
:
: "cc");
diff --git a/ffmpeg/libavutil/ppc/util_altivec.h b/ffmpeg/libavutil/ppc/util_altivec.h
index 7fe3150..fbf6d85 100644
--- a/ffmpeg/libavutil/ppc/util_altivec.h
+++ b/ffmpeg/libavutil/ppc/util_altivec.h
@@ -34,6 +34,8 @@
#include "types_altivec.h"
+#if HAVE_ALTIVEC
+
// used to build registers permutation vectors (vcprm)
// the 's' are for words in the _s_econd vector
#define WORD_0 0x00,0x01,0x02,0x03
@@ -115,4 +117,6 @@ static inline vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_ve
return vec_perm(a, b, perm_vec);
}
+#endif /* HAVE_ALTIVEC */
+
#endif /* AVUTIL_PPC_UTIL_ALTIVEC_H */
diff --git a/ffmpeg/libavutil/random_seed.c b/ffmpeg/libavutil/random_seed.c
index c674704..aa89024 100644
--- a/ffmpeg/libavutil/random_seed.c
+++ b/ffmpeg/libavutil/random_seed.c
@@ -32,6 +32,7 @@
#include <time.h>
#include <string.h>
#include "avassert.h"
+#include "internal.h"
#include "timer.h"
#include "random_seed.h"
#include "sha.h"
@@ -44,7 +45,7 @@
static int read_random(uint32_t *dst, const char *file)
{
#if HAVE_UNISTD_H
- int fd = open(file, O_RDONLY);
+ int fd = avpriv_open(file, O_RDONLY);
int err = -1;
if (fd == -1)
diff --git a/ffmpeg/libavutil/rational.c b/ffmpeg/libavutil/rational.c
index 768f252..ec2f2e5 100644
--- a/ffmpeg/libavutil/rational.c
+++ b/ffmpeg/libavutil/rational.c
@@ -26,7 +26,6 @@
*/
#include "avassert.h"
-//#include <math.h>
#include <limits.h>
#include "common.h"
@@ -111,11 +110,14 @@ AVRational av_d2q(double d, int max)
int64_t den;
if (isnan(d))
return (AVRational) { 0,0 };
- if (isinf(d))
+ if (fabs(d) > INT_MAX + 3LL)
return (AVRational) { d < 0 ? -1 : 1, 0 };
exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
den = 1LL << (61 - exponent);
- av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);
+ // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64
+ av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, max);
+ if ((!a.num || !a.den) && d && max>0 && max<INT_MAX)
+ av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, INT_MAX);
return a;
}
diff --git a/ffmpeg/libavutil/rational.h b/ffmpeg/libavutil/rational.h
index 417e29e..b9800ee 100644
--- a/ffmpeg/libavutil/rational.h
+++ b/ffmpeg/libavutil/rational.h
@@ -55,7 +55,7 @@ typedef struct AVRational{
static inline int av_cmp_q(AVRational a, AVRational b){
const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
- if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1;
+ if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1;
else if(b.den && a.den) return 0;
else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
else return INT_MIN;
diff --git a/ffmpeg/libavutil/samplefmt.c b/ffmpeg/libavutil/samplefmt.c
index 6f762df..08ecc83 100644
--- a/ffmpeg/libavutil/samplefmt.c
+++ b/ffmpeg/libavutil/samplefmt.c
@@ -207,6 +207,21 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
#endif
}
+int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
+ int nb_samples, enum AVSampleFormat sample_fmt, int align)
+{
+ int ret, nb_planes = av_sample_fmt_is_planar(sample_fmt) ? nb_channels : 1;
+
+ *audio_data = av_calloc(nb_planes, sizeof(**audio_data));
+ if (!*audio_data)
+ return AVERROR(ENOMEM);
+ ret = av_samples_alloc(*audio_data, linesize, nb_channels,
+ nb_samples, sample_fmt, align);
+ if (ret < 0)
+ av_freep(audio_data);
+ return ret;
+}
+
int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
int src_offset, int nb_samples, int nb_channels,
enum AVSampleFormat sample_fmt)
diff --git a/ffmpeg/libavutil/samplefmt.h b/ffmpeg/libavutil/samplefmt.h
index 529711f..db17d43 100644
--- a/ffmpeg/libavutil/samplefmt.h
+++ b/ffmpeg/libavutil/samplefmt.h
@@ -209,11 +209,24 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
* @return >=0 on success or a negative error code on failure
* @todo return the size of the allocated buffer in case of success at the next bump
* @see av_samples_fill_arrays()
+ * @see av_samples_alloc_array_and_samples()
*/
int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
int nb_samples, enum AVSampleFormat sample_fmt, int align);
/**
+ * Allocate a data pointers array, samples buffer for nb_samples
+ * samples, and fill data pointers and linesize accordingly.
+ *
+ * This is the same as av_samples_alloc(), but also allocates the data
+ * pointers array.
+ *
+ * @see av_samples_alloc()
+ */
+int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
+ int nb_samples, enum AVSampleFormat sample_fmt, int align);
+
+/**
* Copy samples from src to dst.
*
* @param dst destination array of pointers to data planes
diff --git a/ffmpeg/libavutil/sha.c b/ffmpeg/libavutil/sha.c
index 9f630fc..0cf9424 100644
--- a/ffmpeg/libavutil/sha.c
+++ b/ffmpeg/libavutil/sha.c
@@ -22,6 +22,8 @@
*/
#include <string.h>
+
+#include "attributes.h"
#include "avutil.h"
#include "bswap.h"
#include "sha.h"
@@ -96,39 +98,53 @@ static void sha1_transform(uint32_t state[5], const uint8_t buffer[64])
a = t;
}
#else
- for (i = 0; i < 15; i += 5) {
- R0(a, b, c, d, e, 0 + i);
- R0(e, a, b, c, d, 1 + i);
- R0(d, e, a, b, c, 2 + i);
- R0(c, d, e, a, b, 3 + i);
- R0(b, c, d, e, a, 4 + i);
- }
+
+#define R1_0 \
+ R0(a, b, c, d, e, 0 + i); \
+ R0(e, a, b, c, d, 1 + i); \
+ R0(d, e, a, b, c, 2 + i); \
+ R0(c, d, e, a, b, 3 + i); \
+ R0(b, c, d, e, a, 4 + i); \
+ i += 5
+
+ i = 0;
+ R1_0; R1_0; R1_0;
R0(a, b, c, d, e, 15);
R1(e, a, b, c, d, 16);
R1(d, e, a, b, c, 17);
R1(c, d, e, a, b, 18);
R1(b, c, d, e, a, 19);
- for (i = 20; i < 40; i += 5) {
- R2(a, b, c, d, e, 0 + i);
- R2(e, a, b, c, d, 1 + i);
- R2(d, e, a, b, c, 2 + i);
- R2(c, d, e, a, b, 3 + i);
- R2(b, c, d, e, a, 4 + i);
- }
- for (; i < 60; i += 5) {
- R3(a, b, c, d, e, 0 + i);
- R3(e, a, b, c, d, 1 + i);
- R3(d, e, a, b, c, 2 + i);
- R3(c, d, e, a, b, 3 + i);
- R3(b, c, d, e, a, 4 + i);
- }
- for (; i < 80; i += 5) {
- R4(a, b, c, d, e, 0 + i);
- R4(e, a, b, c, d, 1 + i);
- R4(d, e, a, b, c, 2 + i);
- R4(c, d, e, a, b, 3 + i);
- R4(b, c, d, e, a, 4 + i);
- }
+
+#define R1_20 \
+ R2(a, b, c, d, e, 0 + i); \
+ R2(e, a, b, c, d, 1 + i); \
+ R2(d, e, a, b, c, 2 + i); \
+ R2(c, d, e, a, b, 3 + i); \
+ R2(b, c, d, e, a, 4 + i); \
+ i += 5
+
+ i = 20;
+ R1_20; R1_20; R1_20; R1_20;
+
+#define R1_40 \
+ R3(a, b, c, d, e, 0 + i); \
+ R3(e, a, b, c, d, 1 + i); \
+ R3(d, e, a, b, c, 2 + i); \
+ R3(c, d, e, a, b, 3 + i); \
+ R3(b, c, d, e, a, 4 + i); \
+ i += 5
+
+ R1_40; R1_40; R1_40; R1_40;
+
+#define R1_60 \
+ R4(a, b, c, d, e, 0 + i); \
+ R4(e, a, b, c, d, 1 + i); \
+ R4(d, e, a, b, c, 2 + i); \
+ R4(c, d, e, a, b, 3 + i); \
+ R4(b, c, d, e, a, 4 + i); \
+ i += 5
+
+ R1_60; R1_60; R1_60; R1_60;
#endif
state[0] += a;
state[1] += b;
@@ -158,7 +174,7 @@ static const uint32_t K256[64] = {
#define Ch(x,y,z) (((x) & ((y) ^ (z))) ^ (z))
-#define Maj(x,y,z) ((((x) | (y)) & (z)) | ((x) & (y)))
+#define Maj(z,y,x) ((((x) | (y)) & (z)) | ((x) & (y)))
#define Sigma0_256(x) (rol((x), 30) ^ rol((x), 19) ^ rol((x), 10))
#define Sigma1_256(x) (rol((x), 26) ^ rol((x), 21) ^ rol((x), 7))
@@ -216,27 +232,32 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
a = T1 + T2;
}
#else
- for (i = 0; i < 16 - 7;) {
- ROUND256_0_TO_15(a, b, c, d, e, f, g, h);
- ROUND256_0_TO_15(h, a, b, c, d, e, f, g);
- ROUND256_0_TO_15(g, h, a, b, c, d, e, f);
- ROUND256_0_TO_15(f, g, h, a, b, c, d, e);
- ROUND256_0_TO_15(e, f, g, h, a, b, c, d);
- ROUND256_0_TO_15(d, e, f, g, h, a, b, c);
- ROUND256_0_TO_15(c, d, e, f, g, h, a, b);
- ROUND256_0_TO_15(b, c, d, e, f, g, h, a);
- }
- for (; i < 64 - 7;) {
- ROUND256_16_TO_63(a, b, c, d, e, f, g, h);
- ROUND256_16_TO_63(h, a, b, c, d, e, f, g);
- ROUND256_16_TO_63(g, h, a, b, c, d, e, f);
- ROUND256_16_TO_63(f, g, h, a, b, c, d, e);
- ROUND256_16_TO_63(e, f, g, h, a, b, c, d);
- ROUND256_16_TO_63(d, e, f, g, h, a, b, c);
- ROUND256_16_TO_63(c, d, e, f, g, h, a, b);
- ROUND256_16_TO_63(b, c, d, e, f, g, h, a);
- }
+ i = 0;
+#define R256_0 \
+ ROUND256_0_TO_15(a, b, c, d, e, f, g, h); \
+ ROUND256_0_TO_15(h, a, b, c, d, e, f, g); \
+ ROUND256_0_TO_15(g, h, a, b, c, d, e, f); \
+ ROUND256_0_TO_15(f, g, h, a, b, c, d, e); \
+ ROUND256_0_TO_15(e, f, g, h, a, b, c, d); \
+ ROUND256_0_TO_15(d, e, f, g, h, a, b, c); \
+ ROUND256_0_TO_15(c, d, e, f, g, h, a, b); \
+ ROUND256_0_TO_15(b, c, d, e, f, g, h, a)
+
+ R256_0; R256_0;
+
+#define R256_16 \
+ ROUND256_16_TO_63(a, b, c, d, e, f, g, h); \
+ ROUND256_16_TO_63(h, a, b, c, d, e, f, g); \
+ ROUND256_16_TO_63(g, h, a, b, c, d, e, f); \
+ ROUND256_16_TO_63(f, g, h, a, b, c, d, e); \
+ ROUND256_16_TO_63(e, f, g, h, a, b, c, d); \
+ ROUND256_16_TO_63(d, e, f, g, h, a, b, c); \
+ ROUND256_16_TO_63(c, d, e, f, g, h, a, b); \
+ ROUND256_16_TO_63(b, c, d, e, f, g, h, a)
+
+ R256_16; R256_16; R256_16;
+ R256_16; R256_16; R256_16;
#endif
state[0] += a;
state[1] += b;
@@ -249,7 +270,7 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
}
-int av_sha_init(AVSHA* ctx, int bits)
+av_cold int av_sha_init(AVSHA *ctx, int bits)
{
ctx->digest_len = bits >> 5;
switch (bits) {
@@ -338,7 +359,7 @@ int main(void)
int i, j, k;
AVSHA ctx;
unsigned char digest[32];
- const int lengths[3] = { 160, 224, 256 };
+ static const int lengths[3] = { 160, 224, 256 };
for (j = 0; j < 3; j++) {
printf("Testing SHA-%d\n", lengths[j]);
diff --git a/ffmpeg/libavutil/softfloat.c b/ffmpeg/libavutil/softfloat.c
index efa0420..bf9cfda 100644
--- a/ffmpeg/libavutil/softfloat.c
+++ b/ffmpeg/libavutil/softfloat.c
@@ -20,7 +20,6 @@
#include <inttypes.h>
#include <stdio.h>
-#include <assert.h>
#include "softfloat.h"
#include "common.h"
#include "log.h"
diff --git a/ffmpeg/libavutil/time.c b/ffmpeg/libavutil/time.c
index 27feb0b..5a00e70 100644
--- a/ffmpeg/libavutil/time.c
+++ b/ffmpeg/libavutil/time.c
@@ -33,7 +33,7 @@
#include <windows.h>
#endif
-#include "libavutil/time.h"
+#include "time.h"
#include "error.h"
int64_t av_gettime(void)
diff --git a/ffmpeg/libavutil/timestamp.h b/ffmpeg/libavutil/timestamp.h
index c7348d8..f63a08c 100644
--- a/ffmpeg/libavutil/timestamp.h
+++ b/ffmpeg/libavutil/timestamp.h
@@ -39,7 +39,7 @@
static inline char *av_ts_make_string(char *buf, int64_t ts)
{
if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS");
- else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64"", ts);
+ else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%"PRId64, ts);
return buf;
}
diff --git a/ffmpeg/libavutil/tree.c b/ffmpeg/libavutil/tree.c
index c6ae23d..d0b67ef 100644
--- a/ffmpeg/libavutil/tree.c
+++ b/ffmpeg/libavutil/tree.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "error.h"
#include "log.h"
#include "mem.h"
#include "tree.h"
@@ -41,7 +42,8 @@ void *av_tree_find(const AVTreeNode *t, void *key,
if (t) {
unsigned int v = cmp(key, t->elem);
if (v) {
- if (next) next[v >> 31] = t->elem;
+ if (next)
+ next[v >> 31] = t->elem;
return av_tree_find(t->child[(v >> 31) ^ 1], key, cmp, next);
} else {
if (next) {
@@ -69,56 +71,60 @@ void *av_tree_insert(AVTreeNode **tp, void *key,
void *next_elem[2];
av_tree_find(t->child[i], key, cmp, next_elem);
key = t->elem = next_elem[i];
- v = -i;
+ v = -i;
} else {
*next = t;
- *tp = NULL;
+ *tp = NULL;
return NULL;
}
}
ret = av_tree_insert(&t->child[v >> 31], key, cmp, next);
if (!ret) {
- int i = (v >> 31) ^ !!*next;
+ int i = (v >> 31) ^ !!*next;
AVTreeNode **child = &t->child[i];
t->state += 2 * i - 1;
if (!(t->state & 1)) {
if (t->state) {
/* The following code is equivalent to
- if((*child)->state*2 == -t->state)
- rotate(child, i^1);
- rotate(tp, i);
-
- with rotate():
- static void rotate(AVTreeNode **tp, int i) {
- AVTreeNode *t= *tp;
-
- *tp= t->child[i];
- t->child[i]= t->child[i]->child[i^1];
- (*tp)->child[i^1]= t;
- i= 4*t->state + 2*(*tp)->state + 12;
- t ->state= ((0x614586 >> i) & 3)-1;
- (*tp)->state= ((*tp)->state>>1) + ((0x400EEA >> i) & 3)-1;
- }
- but such a rotate function is both bigger and slower
- */
- if (( *child )->state * 2 == -t->state) {
+ * if ((*child)->state * 2 == -t->state)
+ * rotate(child, i ^ 1);
+ * rotate(tp, i);
+ *
+ * with rotate():
+ * static void rotate(AVTreeNode **tp, int i)
+ * {
+ * AVTreeNode *t= *tp;
+ *
+ * *tp = t->child[i];
+ * t->child[i] = t->child[i]->child[i ^ 1];
+ * (*tp)->child[i ^ 1] = t;
+ * i = 4 * t->state + 2 * (*tp)->state + 12;
+ * t->state = ((0x614586 >> i) & 3) - 1;
+ * (*tp)->state = ((0x400EEA >> i) & 3) - 1 +
+ * ((*tp)->state >> 1);
+ * }
+ * but such a rotate function is both bigger and slower
+ */
+ if ((*child)->state * 2 == -t->state) {
*tp = (*child)->child[i ^ 1];
(*child)->child[i ^ 1] = (*tp)->child[i];
(*tp)->child[i] = *child;
- *child = ( *tp )->child[i ^ 1];
+ *child = (*tp)->child[i ^ 1];
(*tp)->child[i ^ 1] = t;
(*tp)->child[0]->state = -((*tp)->state > 0);
- (*tp)->child[1]->state = (*tp)->state < 0;
+ (*tp)->child[1]->state = (*tp)->state < 0;
(*tp)->state = 0;
} else {
- *tp = *child;
- *child = (*child)->child[i ^ 1];
- (*tp)->child[i ^ 1] = t;
- if ((*tp)->state) t->state = 0;
- else t->state >>= 1;
- (*tp)->state = -t->state;
+ *tp = *child;
+ *child = (*child)->child[i ^ 1];
+ (*tp)->child[i ^ 1] = t;
+ if ((*tp)->state)
+ t->state = 0;
+ else
+ t->state >>= 1;
+ (*tp)->state = -t->state;
}
}
}
@@ -172,11 +178,11 @@ static int check(AVTreeNode *t)
int left = check(t->child[0]);
int right = check(t->child[1]);
- if (left>999 || right>999)
+ if (left > 999 || right > 999)
return 1000;
if (right - left != t->state)
return 1000;
- if (t->state>1 || t->state<-1)
+ if (t->state > 1 || t->state < -1)
return 1000;
return FFMAX(left, right) + 1;
}
@@ -186,7 +192,8 @@ static int check(AVTreeNode *t)
static void print(AVTreeNode *t, int depth)
{
int i;
- for (i = 0; i < depth * 4; i++) av_log(NULL, AV_LOG_ERROR, " ");
+ for (i = 0; i < depth * 4; i++)
+ av_log(NULL, AV_LOG_ERROR, " ");
if (t) {
av_log(NULL, AV_LOG_ERROR, "Node %p %2d %p\n", t, t->state, t->elem);
print(t->child[0], depth + 1);
@@ -200,37 +207,51 @@ static int cmp(void *a, const void *b)
return (uint8_t *) a - (const uint8_t *) b;
}
-int main (void)
+int main(int argc, char **argv)
{
int i;
void *k;
AVTreeNode *root = NULL, *node = NULL;
AVLFG prng;
+ int log_level = argc <= 1 ? AV_LOG_INFO : atoi(argv[1]);
+
+ av_log_set_level(log_level);
av_lfg_init(&prng, 1);
for (i = 0; i < 10000; i++) {
intptr_t j = av_lfg_get(&prng) % 86294;
+
if (check(root) > 999) {
av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i);
- print(root, 0);
- return -1;
+ print(root, 0);
+ return 1;
}
- av_log(NULL, AV_LOG_ERROR, "inserting %4d\n", (int)j);
+ av_log(NULL, AV_LOG_DEBUG, "inserting %4d\n", (int)j);
+
if (!node)
node = av_tree_node_alloc();
- av_tree_insert(&root, (void *) (j + 1), cmp, &node);
+ if (!node) {
+ av_log(NULL, AV_LOG_ERROR, "Memory allocation failure.\n");
+ return 1;
+ }
+ av_tree_insert(&root, (void *)(j + 1), cmp, &node);
j = av_lfg_get(&prng) % 86294;
{
AVTreeNode *node2 = NULL;
- av_log(NULL, AV_LOG_ERROR, "removing %4d\n", (int)j);
- av_tree_insert(&root, (void *) (j + 1), cmp, &node2);
- k = av_tree_find(root, (void *) (j + 1), cmp, NULL);
+ av_log(NULL, AV_LOG_DEBUG, "removing %4d\n", (int)j);
+ av_tree_insert(&root, (void *)(j + 1), cmp, &node2);
+ k = av_tree_find(root, (void *)(j + 1), cmp, NULL);
if (k)
av_log(NULL, AV_LOG_ERROR, "removal failure %d\n", i);
+ av_free(node2);
}
}
+ av_free(node);
+
+ av_tree_destroy(root);
+
return 0;
}
#endif
diff --git a/ffmpeg/libavutil/tree.h b/ffmpeg/libavutil/tree.h
index 13fb91b..a14fa91 100644
--- a/ffmpeg/libavutil/tree.h
+++ b/ffmpeg/libavutil/tree.h
@@ -34,10 +34,10 @@
* @addtogroup lavu_tree AVTree
* @ingroup lavu_data
*
- * Low complexity tree container
+ * Low-complexity tree container
*
* Insertion, removal, finding equal, largest which is smaller than and
- * smallest which is larger than, all have O(log n) worst case complexity.
+ * smallest which is larger than, all have O(log n) worst-case complexity.
* @{
*/
@@ -56,10 +56,11 @@ struct AVTreeNode *av_tree_node_alloc(void);
* @param next If next is not NULL, then next[0] will contain the previous
* element and next[1] the next element. If either does not exist,
* then the corresponding entry in next is unchanged.
- * @return An element with cmp(key, elem)==0 or NULL if no such element exists in
- * the tree.
+ * @return An element with cmp(key, elem) == 0 or NULL if no such element
+ * exists in the tree.
*/
-void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *key, const void *b), void *next[2]);
+void *av_tree_find(const struct AVTreeNode *root, void *key,
+ int (*cmp)(void *key, const void *b), void *next[2]);
/**
* Insert or remove an element.
@@ -83,11 +84,17 @@ void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *ke
* lower overhead compared to many malloced elements.
* You might want to define a function like:
* @code
- * void *tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b), AVTreeNode **next){
- * if(!*next) *next= av_mallocz(av_tree_node_size);
+ * void *tree_insert(struct AVTreeNode **rootp, void *key,
+ * int (*cmp)(void *key, const void *b),
+ * AVTreeNode **next)
+ * {
+ * if (!*next)
+ * *next = av_mallocz(av_tree_node_size);
* return av_tree_insert(rootp, key, cmp, next);
* }
- * void *tree_remove(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b, AVTreeNode **next)){
+ * void *tree_remove(struct AVTreeNode **rootp, void *key,
+ * int (*cmp)(void *key, const void *b, AVTreeNode **next))
+ * {
* av_freep(next);
* return av_tree_insert(rootp, key, cmp, next);
* }
@@ -98,7 +105,10 @@ void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *ke
* Which one it is depends on the tree state and the implementation. You
* should make no assumptions that it's one or the other in the code.
*/
-void *av_tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b), struct AVTreeNode **next);
+void *av_tree_insert(struct AVTreeNode **rootp, void *key,
+ int (*cmp)(void *key, const void *b),
+ struct AVTreeNode **next);
+
void av_tree_destroy(struct AVTreeNode *t);
/**
@@ -111,7 +121,9 @@ void av_tree_destroy(struct AVTreeNode *t);
* @note The cmp function should use the same ordering used to construct the
* tree.
*/
-void av_tree_enumerate(struct AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, void *elem), int (*enu)(void *opaque, void *elem));
+void av_tree_enumerate(struct AVTreeNode *t, void *opaque,
+ int (*cmp)(void *opaque, void *elem),
+ int (*enu)(void *opaque, void *elem));
/**
* @}
diff --git a/ffmpeg/libavutil/utils.c b/ffmpeg/libavutil/utils.c
index fbfbc49..9453c30 100644
--- a/ffmpeg/libavutil/utils.c
+++ b/ffmpeg/libavutil/utils.c
@@ -17,9 +17,10 @@
*/
#include "config.h"
-#include "avutil.h"
+#include "version.h"
#include "avassert.h"
#include "samplefmt.h"
+#include "pixdesc.h"
/**
* @file
@@ -28,6 +29,10 @@
unsigned avutil_version(void)
{
+ static int checks_done;
+ if (checks_done)
+ return LIBAVUTIL_VERSION_INT;
+
av_assert0(AV_PIX_FMT_VDA_VLD == 81); //check if the pix fmt enum has not had anything inserted or removed by mistake
av_assert0(AV_SAMPLE_FMT_DBLP == 9);
av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4);
@@ -35,11 +40,21 @@ unsigned avutil_version(void)
av_assert0(LIBAVUTIL_VERSION_MICRO >= 100);
av_assert0(HAVE_MMX2 == HAVE_MMXEXT);
+ av_assert0(((size_t)-1) > 0); // C gurantees this but if false on a platform we care about revert at least b284e1ffe343d6697fb950d1ee517bafda8a9844
+
if (av_sat_dadd32(1, 2) != 5) {
av_log(NULL, AV_LOG_FATAL, "Libavutil has been build with a broken binutils, please upgrade binutils and rebuild\n");
abort();
}
+ if (llrint(1LL<<60) != 1LL<<60) {
+ av_log(NULL, AV_LOG_ERROR, "Libavutil has been linked to a broken llrint()\n");
+ }
+
+#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0
+ ff_check_pixfmt_descriptors();
+#endif
+ checks_done = 1;
return LIBAVUTIL_VERSION_INT;
}
@@ -79,3 +94,22 @@ char av_get_picture_type_char(enum AVPictureType pict_type)
default: return '?';
}
}
+
+unsigned av_int_list_length_for_size(unsigned elsize,
+ const void *list, uint64_t term)
+{
+ unsigned i;
+
+ if (!list)
+ return 0;
+#define LIST_LENGTH(type) \
+ { type t = term, *l = (type *)list; for (i = 0; l[i] != t; i++); }
+ switch (elsize) {
+ case 1: LIST_LENGTH(uint8_t); break;
+ case 2: LIST_LENGTH(uint16_t); break;
+ case 4: LIST_LENGTH(uint32_t); break;
+ case 8: LIST_LENGTH(uint64_t); break;
+ default: av_assert0(!"valid element size");
+ }
+ return i;
+}
diff --git a/ffmpeg/libavutil/version.h b/ffmpeg/libavutil/version.h
index 1c163ca..446e1f2 100644
--- a/ffmpeg/libavutil/version.h
+++ b/ffmpeg/libavutil/version.h
@@ -41,6 +41,7 @@
* @}
*/
+
/**
* @defgroup version_utils Library Version Macros
*
@@ -58,7 +59,6 @@
* @}
*/
-
/**
* @file
* @ingroup lavu
@@ -75,7 +75,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR 22
+#define LIBAVUTIL_VERSION_MINOR 59
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -100,40 +100,58 @@
*/
#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT
-#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_FIND_OPT
-#define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_OLD_AVOPTIONS
-#define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_PIX_FMT
-#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_CONTEXT_SIZE
-#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_PIX_FMT_DESC
-#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_AV_REVERSE
-#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_AUDIOCONVERT
-#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_CPU_FLAG_MMX2
-#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_SAMPLES_UTILS_RETURN_ZERO
-#define FF_API_SAMPLES_UTILS_RETURN_ZERO (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_SAMPLES_UTILS_RETURN_ZERO (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_LLS_PRIVATE
-#define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_LLS1
+#define FF_API_LLS1 (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
#ifndef FF_API_AVFRAME_LAVC
-#define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 53)
+#define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_VDPAU
+#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT
+#define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_OLD_OPENCL
+#define FF_API_OLD_OPENCL (LIBAVUTIL_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_XVMC
+#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_INTFLOAT
+#define FF_API_INTFLOAT (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
/**
diff --git a/ffmpeg/libavutil/x86/Makefile b/ffmpeg/libavutil/x86/Makefile
index ae07470..1e19082 100644
--- a/ffmpeg/libavutil/x86/Makefile
+++ b/ffmpeg/libavutil/x86/Makefile
@@ -1,6 +1,8 @@
OBJS += x86/cpu.o \
x86/float_dsp_init.o \
+ x86/lls_init.o \
YASM-OBJS += x86/cpuid.o \
x86/emms.o \
x86/float_dsp.o \
+ x86/lls.o \
diff --git a/ffmpeg/libavutil/x86/cpu.c b/ffmpeg/libavutil/x86/cpu.c
index a3a5239..18049ea 100644
--- a/ffmpeg/libavutil/x86/cpu.c
+++ b/ffmpeg/libavutil/x86/cpu.c
@@ -26,6 +26,7 @@
#include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h"
#include "libavutil/cpu.h"
+#include "libavutil/cpu_internal.h"
#if HAVE_YASM
@@ -133,6 +134,14 @@ int ff_get_cpu_flags_x86(void)
if ((eax & 0x6) == 0x6)
rval |= AV_CPU_FLAG_AVX;
}
+#if HAVE_AVX2
+ if (max_std_level >= 7) {
+ cpuid(7, eax, ebx, ecx, edx);
+ if (ebx&0x00000020)
+ rval |= AV_CPU_FLAG_AVX2;
+ /* TODO: BMI1/2 */
+ }
+#endif /* HAVE_AVX2 */
#endif /* HAVE_AVX */
#endif /* HAVE_SSE */
}
diff --git a/ffmpeg/libavutil/x86/cpu.h b/ffmpeg/libavutil/x86/cpu.h
index 601476e..3724357 100644
--- a/ffmpeg/libavutil/x86/cpu.h
+++ b/ffmpeg/libavutil/x86/cpu.h
@@ -21,38 +21,52 @@
#include "config.h"
#include "libavutil/cpu.h"
-
-#define CPUEXT(flags, suffix, cpuext) \
- (HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext))
+#include "libavutil/cpu_internal.h"
#define AV_CPU_FLAG_AMD3DNOW AV_CPU_FLAG_3DNOW
#define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT
-#define EXTERNAL_AMD3DNOW(flags) CPUEXT(flags, _EXTERNAL, AMD3DNOW)
-#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT(flags, _EXTERNAL, AMD3DNOWEXT)
-#define EXTERNAL_MMX(flags) CPUEXT(flags, _EXTERNAL, MMX)
-#define EXTERNAL_MMXEXT(flags) CPUEXT(flags, _EXTERNAL, MMXEXT)
-#define EXTERNAL_SSE(flags) CPUEXT(flags, _EXTERNAL, SSE)
-#define EXTERNAL_SSE2(flags) CPUEXT(flags, _EXTERNAL, SSE2)
-#define EXTERNAL_SSE3(flags) CPUEXT(flags, _EXTERNAL, SSE3)
-#define EXTERNAL_SSSE3(flags) CPUEXT(flags, _EXTERNAL, SSSE3)
-#define EXTERNAL_SSE4(flags) CPUEXT(flags, _EXTERNAL, SSE4)
-#define EXTERNAL_SSE42(flags) CPUEXT(flags, _EXTERNAL, SSE42)
-#define EXTERNAL_AVX(flags) CPUEXT(flags, _EXTERNAL, AVX)
-#define EXTERNAL_FMA4(flags) CPUEXT(flags, _EXTERNAL, FMA4)
-
-#define INLINE_AMD3DNOW(flags) CPUEXT(flags, _INLINE, AMD3DNOW)
-#define INLINE_AMD3DNOWEXT(flags) CPUEXT(flags, _INLINE, AMD3DNOWEXT)
-#define INLINE_MMX(flags) CPUEXT(flags, _INLINE, MMX)
-#define INLINE_MMXEXT(flags) CPUEXT(flags, _INLINE, MMXEXT)
-#define INLINE_SSE(flags) CPUEXT(flags, _INLINE, SSE)
-#define INLINE_SSE2(flags) CPUEXT(flags, _INLINE, SSE2)
-#define INLINE_SSE3(flags) CPUEXT(flags, _INLINE, SSE3)
-#define INLINE_SSSE3(flags) CPUEXT(flags, _INLINE, SSSE3)
-#define INLINE_SSE4(flags) CPUEXT(flags, _INLINE, SSE4)
-#define INLINE_SSE42(flags) CPUEXT(flags, _INLINE, SSE42)
-#define INLINE_AVX(flags) CPUEXT(flags, _INLINE, AVX)
-#define INLINE_FMA4(flags) CPUEXT(flags, _INLINE, FMA4)
+#define X86_AMD3DNOW(flags) CPUEXT(flags, AMD3DNOW)
+#define X86_AMD3DNOWEXT(flags) CPUEXT(flags, AMD3DNOWEXT)
+#define X86_MMX(flags) CPUEXT(flags, MMX)
+#define X86_MMXEXT(flags) CPUEXT(flags, MMXEXT)
+#define X86_SSE(flags) CPUEXT(flags, SSE)
+#define X86_SSE2(flags) CPUEXT(flags, SSE2)
+#define X86_SSE3(flags) CPUEXT(flags, SSE3)
+#define X86_SSSE3(flags) CPUEXT(flags, SSSE3)
+#define X86_SSE4(flags) CPUEXT(flags, SSE4)
+#define X86_SSE42(flags) CPUEXT(flags, SSE42)
+#define X86_AVX(flags) CPUEXT(flags, AVX)
+#define X86_FMA4(flags) CPUEXT(flags, FMA4)
+#define X86_AVX2(flags) CPUEXT(flags, AVX2)
+
+#define EXTERNAL_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOW)
+#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOWEXT)
+#define EXTERNAL_MMX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMX)
+#define EXTERNAL_MMXEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMXEXT)
+#define EXTERNAL_SSE(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE)
+#define EXTERNAL_SSE2(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE2)
+#define EXTERNAL_SSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE3)
+#define EXTERNAL_SSSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSSE3)
+#define EXTERNAL_SSE4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE4)
+#define EXTERNAL_SSE42(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42)
+#define EXTERNAL_AVX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX)
+#define EXTERNAL_FMA4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, FMA4)
+#define EXTERNAL_AVX2(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX2)
+
+#define INLINE_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOW)
+#define INLINE_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOWEXT)
+#define INLINE_MMX(flags) CPUEXT_SUFFIX(flags, _INLINE, MMX)
+#define INLINE_MMXEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, MMXEXT)
+#define INLINE_SSE(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE)
+#define INLINE_SSE2(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE2)
+#define INLINE_SSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE3)
+#define INLINE_SSSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSSE3)
+#define INLINE_SSE4(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE4)
+#define INLINE_SSE42(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE42)
+#define INLINE_AVX(flags) CPUEXT_SUFFIX(flags, _INLINE, AVX)
+#define INLINE_FMA4(flags) CPUEXT_SUFFIX(flags, _INLINE, FMA4)
+#define INLINE_AVX2(flags) CPUEXT_SUFFIX(flags, _INLINE, AVX2)
void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx);
void ff_cpu_xgetbv(int op, int *eax, int *edx);
diff --git a/ffmpeg/libavutil/x86/float_dsp.asm b/ffmpeg/libavutil/x86/float_dsp.asm
index 004e6cf..49d4876 100644
--- a/ffmpeg/libavutil/x86/float_dsp.asm
+++ b/ffmpeg/libavutil/x86/float_dsp.asm
@@ -263,3 +263,28 @@ cglobal scalarproduct_float, 3,3,2, v1, v2, offset
%endif
RET
+;-----------------------------------------------------------------------------
+; void ff_butterflies_float(float *src0, float *src1, int len);
+;-----------------------------------------------------------------------------
+INIT_XMM sse
+cglobal butterflies_float, 3,3,3, src0, src1, len
+%if ARCH_X86_64
+ movsxd lenq, lend
+%endif
+ test lenq, lenq
+ jz .end
+ shl lenq, 2
+ add src0q, lenq
+ add src1q, lenq
+ neg lenq
+.loop:
+ mova m0, [src0q + lenq]
+ mova m1, [src1q + lenq]
+ subps m2, m0, m1
+ addps m0, m0, m1
+ mova [src1q + lenq], m2
+ mova [src0q + lenq], m0
+ add lenq, mmsize
+ jl .loop
+.end:
+ REP_RET
diff --git a/ffmpeg/libavutil/x86/float_dsp_init.c b/ffmpeg/libavutil/x86/float_dsp_init.c
index 5c6383b..97f7b7c 100644
--- a/ffmpeg/libavutil/x86/float_dsp_init.c
+++ b/ffmpeg/libavutil/x86/float_dsp_init.c
@@ -18,28 +18,29 @@
#include "config.h"
+#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/float_dsp.h"
#include "cpu.h"
#include "asm.h"
-extern void ff_vector_fmul_sse(float *dst, const float *src0, const float *src1,
+void ff_vector_fmul_sse(float *dst, const float *src0, const float *src1,
+ int len);
+void ff_vector_fmul_avx(float *dst, const float *src0, const float *src1,
+ int len);
+
+void ff_vector_fmac_scalar_sse(float *dst, const float *src, float mul,
int len);
-extern void ff_vector_fmul_avx(float *dst, const float *src0, const float *src1,
+void ff_vector_fmac_scalar_avx(float *dst, const float *src, float mul,
int len);
-extern void ff_vector_fmac_scalar_sse(float *dst, const float *src, float mul,
- int len);
-extern void ff_vector_fmac_scalar_avx(float *dst, const float *src, float mul,
- int len);
-
-extern void ff_vector_fmul_scalar_sse(float *dst, const float *src, float mul,
- int len);
+void ff_vector_fmul_scalar_sse(float *dst, const float *src, float mul,
+ int len);
-extern void ff_vector_dmul_scalar_sse2(double *dst, const double *src,
- double mul, int len);
-extern void ff_vector_dmul_scalar_avx(double *dst, const double *src,
- double mul, int len);
+void ff_vector_dmul_scalar_sse2(double *dst, const double *src,
+ double mul, int len);
+void ff_vector_dmul_scalar_avx(double *dst, const double *src,
+ double mul, int len);
void ff_vector_fmul_add_sse(float *dst, const float *src0, const float *src1,
const float *src2, int len);
@@ -53,6 +54,8 @@ void ff_vector_fmul_reverse_avx(float *dst, const float *src0,
float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order);
+void ff_butterflies_float_sse(float *src0, float *src1, int len);
+
#if HAVE_6REGS && HAVE_INLINE_ASM
static void vector_fmul_window_3dnowext(float *dst, const float *src0,
const float *src1, const float *win,
@@ -119,30 +122,31 @@ static void vector_fmul_window_sse(float *dst, const float *src0,
}
#endif /* HAVE_6REGS && HAVE_INLINE_ASM */
-void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp)
+av_cold void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp)
{
- int mm_flags = av_get_cpu_flags();
+ int cpu_flags = av_get_cpu_flags();
#if HAVE_6REGS && HAVE_INLINE_ASM
- if (INLINE_AMD3DNOWEXT(mm_flags)) {
+ if (INLINE_AMD3DNOWEXT(cpu_flags)) {
fdsp->vector_fmul_window = vector_fmul_window_3dnowext;
}
- if (INLINE_SSE(mm_flags)) {
+ if (INLINE_SSE(cpu_flags)) {
fdsp->vector_fmul_window = vector_fmul_window_sse;
}
#endif
- if (EXTERNAL_SSE(mm_flags)) {
+ if (EXTERNAL_SSE(cpu_flags)) {
fdsp->vector_fmul = ff_vector_fmul_sse;
fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_sse;
fdsp->vector_fmul_scalar = ff_vector_fmul_scalar_sse;
fdsp->vector_fmul_add = ff_vector_fmul_add_sse;
fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_sse;
fdsp->scalarproduct_float = ff_scalarproduct_float_sse;
+ fdsp->butterflies_float = ff_butterflies_float_sse;
}
- if (EXTERNAL_SSE2(mm_flags)) {
+ if (EXTERNAL_SSE2(cpu_flags)) {
fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_sse2;
}
- if (EXTERNAL_AVX(mm_flags)) {
+ if (EXTERNAL_AVX(cpu_flags)) {
fdsp->vector_fmul = ff_vector_fmul_avx;
fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_avx;
fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_avx;
diff --git a/ffmpeg/libavutil/x86/timer.h b/ffmpeg/libavutil/x86/timer.h
index 5969876..d812d46 100644
--- a/ffmpeg/libavutil/x86/timer.h
+++ b/ffmpeg/libavutil/x86/timer.h
@@ -36,6 +36,7 @@ static inline uint64_t read_time(void)
#elif HAVE_RDTSC
+#include <intrin.h>
#define AV_READ_TIME __rdtsc
#endif /* HAVE_INLINE_ASM */
diff --git a/ffmpeg/libavutil/x86/w64xmmtest.h b/ffmpeg/libavutil/x86/w64xmmtest.h
index b4ce7d3..9df499f 100644
--- a/ffmpeg/libavutil/x86/w64xmmtest.h
+++ b/ffmpeg/libavutil/x86/w64xmmtest.h
@@ -2,20 +2,20 @@
* check XMM registers for clobbers on Win64
* Copyright (c) 2008 Ramiro Polla <ramiro.polla@gmail.com>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
diff --git a/ffmpeg/libavutil/x86/x86inc.asm b/ffmpeg/libavutil/x86/x86inc.asm
index 068e3cf..420e293 100644
--- a/ffmpeg/libavutil/x86/x86inc.asm
+++ b/ffmpeg/libavutil/x86/x86inc.asm
@@ -1,12 +1,12 @@
;*****************************************************************************
;* x86inc.asm: x264asm abstraction layer
;*****************************************************************************
-;* Copyright (C) 2005-2012 x264 project
+;* Copyright (C) 2005-2013 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Anton Mitrofanov <BugMaster@narod.ru>
;* Jason Garrett-Glaser <darkshikari@gmail.com>
-;* Henrik Gramner <hengar-6@student.ltu.se>
+;* Henrik Gramner <henrik@gramner.com>
;*
;* Permission to use, copy, modify, and/or distribute this software for any
;* purpose with or without fee is hereby granted, provided that the above
@@ -49,6 +49,8 @@
%define WIN64 1
%elifidn __OUTPUT_FORMAT__,win64
%define WIN64 1
+ %elifidn __OUTPUT_FORMAT__,x64
+ %define WIN64 1
%else
%define UNIX64 1
%endif
@@ -60,42 +62,17 @@
%define mangle(x) x
%endif
-; Name of the .rodata section.
+; aout does not support align=
+; NOTE: This section is out of sync with x264, in order to
+; keep supporting OS/2.
%macro SECTION_RODATA 0-1 16
- ; Kludge: Something on OS X fails to align .rodata even given an align
- ; attribute, so use a different read-only section. This has been fixed in
- ; yasm 0.8.0 and nasm 2.6.
- %ifdef __YASM_VERSION_ID__
- %if __YASM_VERSION_ID__ < 00080000h
- %define NEED_MACHO_RODATA_KLUDGE
- %endif
- %elifdef __NASM_VERSION_ID__
- %if __NASM_VERSION_ID__ < 02060000h
- %define NEED_MACHO_RODATA_KLUDGE
- %endif
- %endif
-
%ifidn __OUTPUT_FORMAT__,aout
section .text
%else
- %ifndef NEED_MACHO_RODATA_KLUDGE
- SECTION .rodata align=%1
- %else
- %ifidn __OUTPUT_FORMAT__,macho64
- SECTION .text align=%1
- %elifidn __OUTPUT_FORMAT__,macho
- SECTION .text align=%1
- fakegot:
- %else
- SECTION .rodata align=%1
- %endif
- %endif
+ SECTION .rodata align=%1
%endif
-
- %undef NEED_MACHO_RODATA_KLUDGE
%endmacro
-; aout does not support align=
%macro SECTION_TEXT 0-1 16
%ifidn __OUTPUT_FORMAT__,aout
SECTION .text
@@ -154,8 +131,7 @@ CPUNOP amdnop
; Pops anything that was pushed by PROLOGUE, and returns.
; REP_RET:
-; Same, but if it doesn't pop anything it becomes a 2-byte ret, for athlons
-; which are slow when a normal ret follows a branch.
+; Use this instead of RET if it's a branch target.
; registers:
; rN and rNq are the native-size register holding function argument N
@@ -354,14 +330,18 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%if stack_size < 0
%assign stack_size -stack_size
%endif
- %if mmsize != 8
- %assign xmm_regs_used %2
+ %assign stack_size_padded stack_size
+ %if WIN64
+ %assign stack_size_padded stack_size_padded + 32 ; reserve 32 bytes for shadow space
+ %if mmsize != 8
+ %assign xmm_regs_used %2
+ %if xmm_regs_used > 8
+ %assign stack_size_padded stack_size_padded + (xmm_regs_used-8)*16
+ %endif
+ %endif
%endif
%if mmsize <= 16 && HAVE_ALIGNED_STACK
- %assign stack_size_padded stack_size + %%stack_alignment - gprsize - (stack_offset & (%%stack_alignment - 1))
- %if xmm_regs_used > 6
- %assign stack_size_padded stack_size_padded + (xmm_regs_used - 6) * 16
- %endif
+ %assign stack_size_padded stack_size_padded + %%stack_alignment - gprsize - (stack_offset & (%%stack_alignment - 1))
SUB rsp, stack_size_padded
%else
%assign %%reg_num (regs_used - 1)
@@ -371,14 +351,6 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
; stack in a single instruction (i.e. mov rsp, rstk or mov
; rsp, [rsp+stack_size_padded])
mov rstk, rsp
- %assign stack_size_padded stack_size
- %if xmm_regs_used > 6
- %assign stack_size_padded stack_size_padded + (xmm_regs_used - 6) * 16
- %if mmsize == 32 && xmm_regs_used & 1
- ; re-align to 32 bytes
- %assign stack_size_padded (stack_size_padded + 16)
- %endif
- %endif
%if %1 < 0 ; need to store rsp on stack
sub rsp, gprsize+stack_size_padded
and rsp, ~(%%stack_alignment-1)
@@ -390,9 +362,7 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%xdefine rstkm rstk
%endif
%endif
- %if xmm_regs_used > 6
- WIN64_PUSH_XMM
- %endif
+ WIN64_PUSH_XMM
%endif
%endif
%endmacro
@@ -453,40 +423,55 @@ DECLARE_REG 14, R15, 120
%endmacro
%macro WIN64_PUSH_XMM 0
- %assign %%i xmm_regs_used
- %rep (xmm_regs_used-6)
- %assign %%i %%i-1
- movdqa [rsp + (%%i-6)*16 + stack_size + (~stack_offset&8)], xmm %+ %%i
- %endrep
+ ; Use the shadow space to store XMM6 and XMM7, the rest needs stack space allocated.
+ %if xmm_regs_used > 6
+ movaps [rstk + stack_offset + 8], xmm6
+ %endif
+ %if xmm_regs_used > 7
+ movaps [rstk + stack_offset + 24], xmm7
+ %endif
+ %if xmm_regs_used > 8
+ %assign %%i 8
+ %rep xmm_regs_used-8
+ movaps [rsp + (%%i-8)*16 + stack_size + 32], xmm %+ %%i
+ %assign %%i %%i+1
+ %endrep
+ %endif
%endmacro
%macro WIN64_SPILL_XMM 1
%assign xmm_regs_used %1
ASSERT xmm_regs_used <= 16
- %if xmm_regs_used > 6
- SUB rsp, (xmm_regs_used-6)*16+16
- WIN64_PUSH_XMM
+ %if xmm_regs_used > 8
+ %assign stack_size_padded (xmm_regs_used-8)*16 + (~stack_offset&8) + 32
+ SUB rsp, stack_size_padded
%endif
+ WIN64_PUSH_XMM
%endmacro
%macro WIN64_RESTORE_XMM_INTERNAL 1
- %if xmm_regs_used > 6
+ %assign %%pad_size 0
+ %if xmm_regs_used > 8
%assign %%i xmm_regs_used
- %rep (xmm_regs_used-6)
+ %rep xmm_regs_used-8
%assign %%i %%i-1
- movdqa xmm %+ %%i, [%1 + (%%i-6)*16+stack_size+(~stack_offset&8)]
+ movaps xmm %+ %%i, [%1 + (%%i-8)*16 + stack_size + 32]
%endrep
- %if stack_size_padded == 0
- add %1, (xmm_regs_used-6)*16+16
- %endif
%endif
%if stack_size_padded > 0
%if stack_size > 0 && (mmsize == 32 || HAVE_ALIGNED_STACK == 0)
mov rsp, rstkm
%else
add %1, stack_size_padded
+ %assign %%pad_size stack_size_padded
%endif
%endif
+ %if xmm_regs_used > 7
+ movaps xmm7, [%1 + stack_offset - %%pad_size + 24]
+ %endif
+ %if xmm_regs_used > 6
+ movaps xmm6, [%1 + stack_offset - %%pad_size + 8]
+ %endif
%endmacro
%macro WIN64_RESTORE_XMM 1
@@ -503,7 +488,7 @@ DECLARE_REG 14, R15, 120
%if mmsize == 32
vzeroupper
%endif
- ret
+ AUTO_REP_RET
%endmacro
%elif ARCH_X86_64 ; *nix x64 ;=============================================
@@ -550,7 +535,7 @@ DECLARE_REG 14, R15, 72
%if mmsize == 32
vzeroupper
%endif
- ret
+ AUTO_REP_RET
%endmacro
%else ; X86_32 ;==============================================================
@@ -606,7 +591,7 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%if mmsize == 32
vzeroupper
%endif
- ret
+ AUTO_REP_RET
%endmacro
%endif ;======================================================================
@@ -620,6 +605,10 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%endmacro
%endif
+; On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
+; a branch or a branch target. So switch to a 2-byte form of ret in that case.
+; We can automatically detect "follows a branch", but not a branch target.
+; (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)
%macro REP_RET 0
%if has_epilogue
RET
@@ -628,6 +617,29 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%endif
%endmacro
+%define last_branch_adr $$
+%macro AUTO_REP_RET 0
+ %ifndef cpuflags
+ times ((last_branch_adr-$)>>31)+1 rep ; times 1 iff $ != last_branch_adr.
+ %elif notcpuflag(ssse3)
+ times ((last_branch_adr-$)>>31)+1 rep
+ %endif
+ ret
+%endmacro
+
+%macro BRANCH_INSTR 0-*
+ %rep %0
+ %macro %1 1-2 %1
+ %2 %1
+ %%branch_instr:
+ %xdefine last_branch_adr %%branch_instr
+ %endmacro
+ %rotate 1
+ %endrep
+%endmacro
+
+BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, jna, jnae, jb, jbe, jnb, jnbe, jc, jnc, js, jns, jo, jno, jp, jnp
+
%macro TAIL_CALL 2 ; callee, is_nonadjacent
%if has_epilogue
call %1
@@ -676,12 +688,12 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%endif
align function_align
%2:
- RESET_MM_PERMUTATION ; not really needed, but makes disassembly somewhat nicer
- %xdefine rstk rsp
- %assign stack_offset 0
- %assign stack_size 0
- %assign stack_size_padded 0
- %assign xmm_regs_used 0
+ RESET_MM_PERMUTATION ; needed for x86-64, also makes disassembly somewhat nicer
+ %xdefine rstk rsp ; copy of the original stack pointer, used when greater alignment than the known stack alignment is required
+ %assign stack_offset 0 ; stack pointer offset relative to the return address
+ %assign stack_size 0 ; amount of stack space that can be freely used inside a function
+ %assign stack_size_padded 0 ; total amount of allocated stack space, including space for callee-saved xmm registers on WIN64 and alignment padding
+ %assign xmm_regs_used 0 ; number of XMM registers requested, used for dealing with callee-saved registers on WIN64
%ifnidn %3, ""
PROLOGUE %3
%endif
@@ -700,9 +712,13 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
extern %1
%endmacro
-%macro const 2+
+%macro const 1-2+
%xdefine %1 mangle(private_prefix %+ _ %+ %1)
- global %1
+ %ifidn __OUTPUT_FORMAT__,elf
+ global %1:data hidden
+ %else
+ global %1
+ %endif
%1: %2
%endmacro
@@ -735,12 +751,10 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%assign cpuflags_cache64 (1<<17)
%assign cpuflags_slowctz (1<<18)
%assign cpuflags_lzcnt (1<<19)
-%assign cpuflags_misalign (1<<20)
-%assign cpuflags_aligned (1<<21) ; not a cpu feature, but a function variant
-%assign cpuflags_atom (1<<22)
-%assign cpuflags_bmi1 (1<<23)
-%assign cpuflags_bmi2 (1<<24)|cpuflags_bmi1
-%assign cpuflags_tbm (1<<25)|cpuflags_bmi1
+%assign cpuflags_aligned (1<<20) ; not a cpu feature, but a function variant
+%assign cpuflags_atom (1<<21)
+%assign cpuflags_bmi1 (1<<22)|cpuflags_lzcnt
+%assign cpuflags_bmi2 (1<<23)|cpuflags_bmi1
%define cpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
%define notcpuflag(x) ((cpuflags & (cpuflags_ %+ x)) != (cpuflags_ %+ x))
@@ -761,7 +775,7 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%if cpuflag(avx)
%assign avx_enabled 1
%endif
- %if mmsize == 16 && notcpuflag(sse2)
+ %if (mmsize == 16 && notcpuflag(sse2)) || (mmsize == 32 && notcpuflag(avx2))
%define mova movaps
%define movu movups
%define movnta movntps
@@ -781,7 +795,11 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%endif
%endmacro
-; merge mmx and sse*
+; Merge mmx and sse*
+; m# is a simd regsiter of the currently selected size
+; xm# is the corresponding xmmreg (if selcted xmm or ymm size), or mmreg (if selected mmx)
+; ym# is the corresponding ymmreg (if selcted xmm or ymm size), or mmreg (if selected mmx)
+; (All 3 remain in sync through SWAP.)
%macro CAT_XDEFINE 3
%xdefine %1%2 %3
@@ -851,10 +869,10 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%if ARCH_X86_64
%define num_mmregs 16
%endif
- %define mova vmovaps
- %define movu vmovups
+ %define mova movdqa
+ %define movu movdqu
%undef movh
- %define movnta vmovntps
+ %define movnta movntdq
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, ymm %+ %%i
@@ -866,6 +884,26 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
INIT_XMM
+%macro DECLARE_MMCAST 1
+ %define mmmm%1 mm%1
+ %define mmxmm%1 mm%1
+ %define mmymm%1 mm%1
+ %define xmmmm%1 mm%1
+ %define xmmxmm%1 xmm%1
+ %define xmmymm%1 xmm%1
+ %define ymmmm%1 mm%1
+ %define ymmxmm%1 ymm%1
+ %define ymmymm%1 ymm%1
+ %define xm%1 xmm %+ m%1
+ %define ym%1 ymm %+ m%1
+%endmacro
+
+%assign i 0
+%rep 16
+ DECLARE_MMCAST i
+%assign i i+1
+%endrep
+
; I often want to use macros that permute their arguments. e.g. there's no
; efficient way to implement butterfly or transpose or dct without swapping some
; arguments.
@@ -882,42 +920,42 @@ INIT_XMM
%macro PERMUTE 2-* ; takes a list of pairs to swap
%rep %0/2
- %xdefine tmp%2 m%2
- %xdefine ntmp%2 nm%2
+ %xdefine %%tmp%2 m%2
%rotate 2
%endrep
%rep %0/2
- %xdefine m%1 tmp%2
- %xdefine nm%1 ntmp%2
- %undef tmp%2
- %undef ntmp%2
+ %xdefine m%1 %%tmp%2
+ CAT_XDEFINE n, m%1, %1
%rotate 2
%endrep
%endmacro
-%macro SWAP 2-* ; swaps a single chain (sometimes more concise than pairs)
-%rep %0-1
-%ifdef m%1
- %xdefine tmp m%1
- %xdefine m%1 m%2
- %xdefine m%2 tmp
- CAT_XDEFINE n, m%1, %1
- CAT_XDEFINE n, m%2, %2
-%else
- ; If we were called as "SWAP m0,m1" rather than "SWAP 0,1" infer the original numbers here.
- ; Be careful using this mode in nested macros though, as in some cases there may be
- ; other copies of m# that have already been dereferenced and don't get updated correctly.
- %xdefine %%n1 n %+ %1
- %xdefine %%n2 n %+ %2
- %xdefine tmp m %+ %%n1
- CAT_XDEFINE m, %%n1, m %+ %%n2
- CAT_XDEFINE m, %%n2, tmp
- CAT_XDEFINE n, m %+ %%n1, %%n1
- CAT_XDEFINE n, m %+ %%n2, %%n2
+%macro SWAP 2+ ; swaps a single chain (sometimes more concise than pairs)
+%ifnum %1 ; SWAP 0, 1, ...
+ SWAP_INTERNAL_NUM %1, %2
+%else ; SWAP m0, m1, ...
+ SWAP_INTERNAL_NAME %1, %2
%endif
- %undef tmp
+%endmacro
+
+%macro SWAP_INTERNAL_NUM 2-*
+ %rep %0-1
+ %xdefine %%tmp m%1
+ %xdefine m%1 m%2
+ %xdefine m%2 %%tmp
+ CAT_XDEFINE n, m%1, %1
+ CAT_XDEFINE n, m%2, %2
%rotate 1
-%endrep
+ %endrep
+%endmacro
+
+%macro SWAP_INTERNAL_NAME 2-*
+ %xdefine %%args n %+ %1
+ %rep %0-1
+ %xdefine %%args %%args, n %+ %2
+ %rotate 1
+ %endrep
+ SWAP_INTERNAL_NUM %%args
%endmacro
; If SAVE_MM_PERMUTATION is placed at the end of a function, then any later
@@ -1015,122 +1053,148 @@ INIT_XMM
;%1 == instruction
;%2 == 1 if float, 0 if int
-;%3 == 1 if 4-operand (xmm, xmm, xmm, imm), 0 if 2- or 3-operand (xmm, xmm, xmm)
-;%4 == number of operands given
+;%3 == 1 if non-destructive or 4-operand (xmm, xmm, xmm, imm), 0 otherwise
+;%4 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not
;%5+: operands
-%macro RUN_AVX_INSTR 6-7+
- %ifid %6
- %define %%sizeofreg sizeof%6
- %elifid %5
- %define %%sizeofreg sizeof%5
+%macro RUN_AVX_INSTR 5-8+
+ %ifnum sizeof%6
+ %assign %%sizeofreg sizeof%6
+ %elifnum sizeof%5
+ %assign %%sizeofreg sizeof%5
%else
- %define %%sizeofreg mmsize
+ %assign %%sizeofreg mmsize
%endif
- %if %%sizeofreg==32
- %if %4>=3
- v%1 %5, %6, %7
- %else
- v%1 %5, %6
- %endif
+ %assign %%emulate_avx 0
+ %if avx_enabled && %%sizeofreg >= 16
+ %xdefine %%instr v%1
%else
- %if %%sizeofreg==8
- %define %%regmov movq
- %elif %2
- %define %%regmov movaps
- %else
- %define %%regmov movdqa
+ %xdefine %%instr %1
+ %if %0 >= 7+%3
+ %assign %%emulate_avx 1
%endif
+ %endif
- %if %4>=3+%3
- %ifnidn %5, %6
- %if avx_enabled && %%sizeofreg==16
- v%1 %5, %6, %7
- %else
- CHECK_AVX_INSTR_EMU {%1 %5, %6, %7}, %5, %7
- %%regmov %5, %6
- %1 %5, %7
+ %if %%emulate_avx
+ %xdefine %%src1 %6
+ %xdefine %%src2 %7
+ %ifnidn %5, %6
+ %if %0 >= 8
+ CHECK_AVX_INSTR_EMU {%1 %5, %6, %7, %8}, %5, %7, %8
+ %else
+ CHECK_AVX_INSTR_EMU {%1 %5, %6, %7}, %5, %7
+ %endif
+ %if %4 && %3 == 0
+ %ifnid %7
+ ; 3-operand AVX instructions with a memory arg can only have it in src2,
+ ; whereas SSE emulation prefers to have it in src1 (i.e. the mov).
+ ; So, if the instruction is commutative with a memory arg, swap them.
+ %xdefine %%src1 %7
+ %xdefine %%src2 %6
%endif
+ %endif
+ %if %%sizeofreg == 8
+ MOVQ %5, %%src1
+ %elif %2
+ MOVAPS %5, %%src1
%else
- %1 %5, %7
+ MOVDQA %5, %%src1
%endif
- %elif %4>=3
- %1 %5, %6, %7
- %else
- %1 %5, %6
- %endif
- %endif
-%endmacro
-
-; 3arg AVX ops with a memory arg can only have it in src2,
-; whereas SSE emulation of 3arg prefers to have it in src1 (i.e. the mov).
-; So, if the op is symmetric and the wrong one is memory, swap them.
-%macro RUN_AVX_INSTR1 8
- %assign %%swap 0
- %if avx_enabled
- %ifnid %6
- %assign %%swap 1
%endif
- %elifnidn %5, %6
- %ifnid %7
- %assign %%swap 1
+ %if %0 >= 8
+ %1 %5, %%src2, %8
+ %else
+ %1 %5, %%src2
%endif
- %endif
- %if %%swap && %3 == 0 && %8 == 1
- RUN_AVX_INSTR %1, %2, %3, %4, %5, %7, %6
+ %elif %0 >= 8
+ %%instr %5, %6, %7, %8
+ %elif %0 == 7
+ %%instr %5, %6, %7
+ %elif %0 == 6
+ %%instr %5, %6
%else
- RUN_AVX_INSTR %1, %2, %3, %4, %5, %6, %7
+ %%instr %5
%endif
%endmacro
;%1 == instruction
;%2 == 1 if float, 0 if int
-;%3 == 1 if 4-operand (xmm, xmm, xmm, imm), 0 if 2- or 3-operand (xmm, xmm, xmm)
-;%4 == 1 if symmetric (i.e. doesn't matter which src arg is which), 0 if not
-%macro AVX_INSTR 4
- %macro %1 2-9 fnord, fnord, fnord, %1, %2, %3, %4
- %ifidn %3, fnord
- RUN_AVX_INSTR %6, %7, %8, 2, %1, %2
+;%3 == 1 if non-destructive or 4-operand (xmm, xmm, xmm, imm), 0 otherwise
+;%4 == 1 if commutative (i.e. doesn't matter which src arg is which), 0 if not
+%macro AVX_INSTR 1-4 0, 1, 0
+ %macro %1 1-9 fnord, fnord, fnord, fnord, %1, %2, %3, %4
+ %ifidn %2, fnord
+ RUN_AVX_INSTR %6, %7, %8, %9, %1
+ %elifidn %3, fnord
+ RUN_AVX_INSTR %6, %7, %8, %9, %1, %2
%elifidn %4, fnord
- RUN_AVX_INSTR1 %6, %7, %8, 3, %1, %2, %3, %9
+ RUN_AVX_INSTR %6, %7, %8, %9, %1, %2, %3
%elifidn %5, fnord
- RUN_AVX_INSTR %6, %7, %8, 4, %1, %2, %3, %4
+ RUN_AVX_INSTR %6, %7, %8, %9, %1, %2, %3, %4
%else
- RUN_AVX_INSTR %6, %7, %8, 5, %1, %2, %3, %4, %5
+ RUN_AVX_INSTR %6, %7, %8, %9, %1, %2, %3, %4, %5
%endif
%endmacro
%endmacro
+; Instructions with both VEX and non-VEX encodings
+; Non-destructive instructions are written without parameters
AVX_INSTR addpd, 1, 0, 1
AVX_INSTR addps, 1, 0, 1
AVX_INSTR addsd, 1, 0, 1
AVX_INSTR addss, 1, 0, 1
AVX_INSTR addsubpd, 1, 0, 0
AVX_INSTR addsubps, 1, 0, 0
-AVX_INSTR andpd, 1, 0, 1
-AVX_INSTR andps, 1, 0, 1
+AVX_INSTR aesdec, 0, 0, 0
+AVX_INSTR aesdeclast, 0, 0, 0
+AVX_INSTR aesenc, 0, 0, 0
+AVX_INSTR aesenclast, 0, 0, 0
+AVX_INSTR aesimc
+AVX_INSTR aeskeygenassist
AVX_INSTR andnpd, 1, 0, 0
AVX_INSTR andnps, 1, 0, 0
+AVX_INSTR andpd, 1, 0, 1
+AVX_INSTR andps, 1, 0, 1
AVX_INSTR blendpd, 1, 0, 0
AVX_INSTR blendps, 1, 0, 0
AVX_INSTR blendvpd, 1, 0, 0
AVX_INSTR blendvps, 1, 0, 0
-AVX_INSTR cmppd, 1, 0, 0
-AVX_INSTR cmpps, 1, 0, 0
-AVX_INSTR cmpsd, 1, 0, 0
-AVX_INSTR cmpss, 1, 0, 0
-AVX_INSTR cvtdq2ps, 1, 0, 0
-AVX_INSTR cvtpd2dq, 1, 0, 0
-AVX_INSTR cvtps2dq, 1, 0, 0
+AVX_INSTR cmppd, 1, 1, 0
+AVX_INSTR cmpps, 1, 1, 0
+AVX_INSTR cmpsd, 1, 1, 0
+AVX_INSTR cmpss, 1, 1, 0
+AVX_INSTR comisd
+AVX_INSTR comiss
+AVX_INSTR cvtdq2pd
+AVX_INSTR cvtdq2ps
+AVX_INSTR cvtpd2dq
+AVX_INSTR cvtpd2ps
+AVX_INSTR cvtps2dq
+AVX_INSTR cvtps2pd
+AVX_INSTR cvtsd2si
+AVX_INSTR cvtsd2ss
+AVX_INSTR cvtsi2sd
+AVX_INSTR cvtsi2ss
+AVX_INSTR cvtss2sd
+AVX_INSTR cvtss2si
+AVX_INSTR cvttpd2dq
+AVX_INSTR cvttps2dq
+AVX_INSTR cvttsd2si
+AVX_INSTR cvttss2si
AVX_INSTR divpd, 1, 0, 0
AVX_INSTR divps, 1, 0, 0
AVX_INSTR divsd, 1, 0, 0
AVX_INSTR divss, 1, 0, 0
AVX_INSTR dppd, 1, 1, 0
AVX_INSTR dpps, 1, 1, 0
+AVX_INSTR extractps
AVX_INSTR haddpd, 1, 0, 0
AVX_INSTR haddps, 1, 0, 0
AVX_INSTR hsubpd, 1, 0, 0
AVX_INSTR hsubps, 1, 0, 0
+AVX_INSTR insertps, 1, 1, 0
+AVX_INSTR lddqu
+AVX_INSTR ldmxcsr
+AVX_INSTR maskmovdqu
AVX_INSTR maxpd, 1, 0, 1
AVX_INSTR maxps, 1, 0, 1
AVX_INSTR maxsd, 1, 0, 1
@@ -1139,10 +1203,31 @@ AVX_INSTR minpd, 1, 0, 1
AVX_INSTR minps, 1, 0, 1
AVX_INSTR minsd, 1, 0, 1
AVX_INSTR minss, 1, 0, 1
+AVX_INSTR movapd
+AVX_INSTR movaps
+AVX_INSTR movd
+AVX_INSTR movddup
+AVX_INSTR movdqa
+AVX_INSTR movdqu
AVX_INSTR movhlps, 1, 0, 0
+AVX_INSTR movhpd, 1, 0, 0
+AVX_INSTR movhps, 1, 0, 0
AVX_INSTR movlhps, 1, 0, 0
+AVX_INSTR movlpd, 1, 0, 0
+AVX_INSTR movlps, 1, 0, 0
+AVX_INSTR movmskpd
+AVX_INSTR movmskps
+AVX_INSTR movntdq
+AVX_INSTR movntdqa
+AVX_INSTR movntpd
+AVX_INSTR movntps
+AVX_INSTR movq
AVX_INSTR movsd, 1, 0, 0
+AVX_INSTR movshdup
+AVX_INSTR movsldup
AVX_INSTR movss, 1, 0, 0
+AVX_INSTR movupd
+AVX_INSTR movups
AVX_INSTR mpsadbw, 0, 1, 0
AVX_INSTR mulpd, 1, 0, 1
AVX_INSTR mulps, 1, 0, 1
@@ -1150,9 +1235,9 @@ AVX_INSTR mulsd, 1, 0, 1
AVX_INSTR mulss, 1, 0, 1
AVX_INSTR orpd, 1, 0, 1
AVX_INSTR orps, 1, 0, 1
-AVX_INSTR pabsb, 0, 0, 0
-AVX_INSTR pabsw, 0, 0, 0
-AVX_INSTR pabsd, 0, 0, 0
+AVX_INSTR pabsb
+AVX_INSTR pabsd
+AVX_INSTR pabsw
AVX_INSTR packsswb, 0, 0, 0
AVX_INSTR packssdw, 0, 0, 0
AVX_INSTR packuswb, 0, 0, 0
@@ -1172,10 +1257,11 @@ AVX_INSTR pavgb, 0, 0, 1
AVX_INSTR pavgw, 0, 0, 1
AVX_INSTR pblendvb, 0, 0, 0
AVX_INSTR pblendw, 0, 1, 0
-AVX_INSTR pcmpestri, 0, 0, 0
-AVX_INSTR pcmpestrm, 0, 0, 0
-AVX_INSTR pcmpistri, 0, 0, 0
-AVX_INSTR pcmpistrm, 0, 0, 0
+AVX_INSTR pclmulqdq, 0, 1, 0
+AVX_INSTR pcmpestri
+AVX_INSTR pcmpestrm
+AVX_INSTR pcmpistri
+AVX_INSTR pcmpistrm
AVX_INSTR pcmpeqb, 0, 0, 1
AVX_INSTR pcmpeqw, 0, 0, 1
AVX_INSTR pcmpeqd, 0, 0, 1
@@ -1184,12 +1270,21 @@ AVX_INSTR pcmpgtb, 0, 0, 0
AVX_INSTR pcmpgtw, 0, 0, 0
AVX_INSTR pcmpgtd, 0, 0, 0
AVX_INSTR pcmpgtq, 0, 0, 0
+AVX_INSTR pextrb
+AVX_INSTR pextrd
+AVX_INSTR pextrq
+AVX_INSTR pextrw
AVX_INSTR phaddw, 0, 0, 0
AVX_INSTR phaddd, 0, 0, 0
AVX_INSTR phaddsw, 0, 0, 0
+AVX_INSTR phminposuw
AVX_INSTR phsubw, 0, 0, 0
AVX_INSTR phsubd, 0, 0, 0
AVX_INSTR phsubsw, 0, 0, 0
+AVX_INSTR pinsrb, 0, 1, 0
+AVX_INSTR pinsrd, 0, 1, 0
+AVX_INSTR pinsrq, 0, 1, 0
+AVX_INSTR pinsrw, 0, 1, 0
AVX_INSTR pmaddwd, 0, 0, 1
AVX_INSTR pmaddubsw, 0, 0, 0
AVX_INSTR pmaxsb, 0, 0, 1
@@ -1204,20 +1299,32 @@ AVX_INSTR pminsd, 0, 0, 1
AVX_INSTR pminub, 0, 0, 1
AVX_INSTR pminuw, 0, 0, 1
AVX_INSTR pminud, 0, 0, 1
-AVX_INSTR pmovmskb, 0, 0, 0
-AVX_INSTR pmulhuw, 0, 0, 1
+AVX_INSTR pmovmskb
+AVX_INSTR pmovsxbw
+AVX_INSTR pmovsxbd
+AVX_INSTR pmovsxbq
+AVX_INSTR pmovsxwd
+AVX_INSTR pmovsxwq
+AVX_INSTR pmovsxdq
+AVX_INSTR pmovzxbw
+AVX_INSTR pmovzxbd
+AVX_INSTR pmovzxbq
+AVX_INSTR pmovzxwd
+AVX_INSTR pmovzxwq
+AVX_INSTR pmovzxdq
+AVX_INSTR pmuldq, 0, 0, 1
AVX_INSTR pmulhrsw, 0, 0, 1
+AVX_INSTR pmulhuw, 0, 0, 1
AVX_INSTR pmulhw, 0, 0, 1
AVX_INSTR pmullw, 0, 0, 1
AVX_INSTR pmulld, 0, 0, 1
AVX_INSTR pmuludq, 0, 0, 1
-AVX_INSTR pmuldq, 0, 0, 1
AVX_INSTR por, 0, 0, 1
AVX_INSTR psadbw, 0, 0, 1
AVX_INSTR pshufb, 0, 0, 0
-AVX_INSTR pshufd, 0, 1, 0
-AVX_INSTR pshufhw, 0, 1, 0
-AVX_INSTR pshuflw, 0, 1, 0
+AVX_INSTR pshufd
+AVX_INSTR pshufhw
+AVX_INSTR pshuflw
AVX_INSTR psignb, 0, 0, 0
AVX_INSTR psignw, 0, 0, 0
AVX_INSTR psignd, 0, 0, 0
@@ -1239,7 +1346,7 @@ AVX_INSTR psubsb, 0, 0, 0
AVX_INSTR psubsw, 0, 0, 0
AVX_INSTR psubusb, 0, 0, 0
AVX_INSTR psubusw, 0, 0, 0
-AVX_INSTR ptest, 0, 0, 0
+AVX_INSTR ptest
AVX_INSTR punpckhbw, 0, 0, 0
AVX_INSTR punpckhwd, 0, 0, 0
AVX_INSTR punpckhdq, 0, 0, 0
@@ -1249,11 +1356,27 @@ AVX_INSTR punpcklwd, 0, 0, 0
AVX_INSTR punpckldq, 0, 0, 0
AVX_INSTR punpcklqdq, 0, 0, 0
AVX_INSTR pxor, 0, 0, 1
+AVX_INSTR rcpps, 1, 0, 0
+AVX_INSTR rcpss, 1, 0, 0
+AVX_INSTR roundpd
+AVX_INSTR roundps
+AVX_INSTR roundsd
+AVX_INSTR roundss
+AVX_INSTR rsqrtps, 1, 0, 0
+AVX_INSTR rsqrtss, 1, 0, 0
+AVX_INSTR shufpd, 1, 1, 0
AVX_INSTR shufps, 1, 1, 0
+AVX_INSTR sqrtpd, 1, 0, 0
+AVX_INSTR sqrtps, 1, 0, 0
+AVX_INSTR sqrtsd, 1, 0, 0
+AVX_INSTR sqrtss, 1, 0, 0
+AVX_INSTR stmxcsr
AVX_INSTR subpd, 1, 0, 0
AVX_INSTR subps, 1, 0, 0
AVX_INSTR subsd, 1, 0, 0
AVX_INSTR subss, 1, 0, 0
+AVX_INSTR ucomisd
+AVX_INSTR ucomiss
AVX_INSTR unpckhpd, 1, 0, 0
AVX_INSTR unpckhps, 1, 0, 0
AVX_INSTR unpcklpd, 1, 0, 0
@@ -1285,22 +1408,16 @@ AVX_INSTR pfmul, 1, 0, 1
%undef j
%macro FMA_INSTR 3
- %macro %1 5-8 %1, %2, %3
- %if cpuflag(xop) || cpuflag(fma4)
- v%6 %1, %2, %3, %4
+ %macro %1 4-7 %1, %2, %3
+ %if cpuflag(xop)
+ v%5 %1, %2, %3, %4
%else
- %ifidn %1, %4
- %7 %5, %2, %3
- %8 %1, %4, %5
- %else
- %7 %1, %2, %3
- %8 %1, %4
- %endif
+ %6 %1, %2, %3
+ %7 %1, %4
%endif
%endmacro
%endmacro
-FMA_INSTR fmaddps, mulps, addps
FMA_INSTR pmacsdd, pmulld, paddd
FMA_INSTR pmacsww, pmullw, paddw
FMA_INSTR pmadcswd, pmaddwd, paddd
@@ -1308,3 +1425,56 @@ FMA_INSTR pmadcswd, pmaddwd, paddd
; tzcnt is equivalent to "rep bsf" and is backwards-compatible with bsf.
; This lets us use tzcnt without bumping the yasm version requirement yet.
%define tzcnt rep bsf
+
+; convert FMA4 to FMA3 if possible
+%macro FMA4_INSTR 4
+ %macro %1 4-8 %1, %2, %3, %4
+ %if cpuflag(fma4)
+ v%5 %1, %2, %3, %4
+ %elifidn %1, %2
+ v%6 %1, %4, %3 ; %1 = %1 * %3 + %4
+ %elifidn %1, %3
+ v%7 %1, %2, %4 ; %1 = %2 * %1 + %4
+ %elifidn %1, %4
+ v%8 %1, %2, %3 ; %1 = %2 * %3 + %1
+ %else
+ %error fma3 emulation of ``%5 %1, %2, %3, %4'' is not supported
+ %endif
+ %endmacro
+%endmacro
+
+FMA4_INSTR fmaddpd, fmadd132pd, fmadd213pd, fmadd231pd
+FMA4_INSTR fmaddps, fmadd132ps, fmadd213ps, fmadd231ps
+FMA4_INSTR fmaddsd, fmadd132sd, fmadd213sd, fmadd231sd
+FMA4_INSTR fmaddss, fmadd132ss, fmadd213ss, fmadd231ss
+
+FMA4_INSTR fmaddsubpd, fmaddsub132pd, fmaddsub213pd, fmaddsub231pd
+FMA4_INSTR fmaddsubps, fmaddsub132ps, fmaddsub213ps, fmaddsub231ps
+FMA4_INSTR fmsubaddpd, fmsubadd132pd, fmsubadd213pd, fmsubadd231pd
+FMA4_INSTR fmsubaddps, fmsubadd132ps, fmsubadd213ps, fmsubadd231ps
+
+FMA4_INSTR fmsubpd, fmsub132pd, fmsub213pd, fmsub231pd
+FMA4_INSTR fmsubps, fmsub132ps, fmsub213ps, fmsub231ps
+FMA4_INSTR fmsubsd, fmsub132sd, fmsub213sd, fmsub231sd
+FMA4_INSTR fmsubss, fmsub132ss, fmsub213ss, fmsub231ss
+
+FMA4_INSTR fnmaddpd, fnmadd132pd, fnmadd213pd, fnmadd231pd
+FMA4_INSTR fnmaddps, fnmadd132ps, fnmadd213ps, fnmadd231ps
+FMA4_INSTR fnmaddsd, fnmadd132sd, fnmadd213sd, fnmadd231sd
+FMA4_INSTR fnmaddss, fnmadd132ss, fnmadd213ss, fnmadd231ss
+
+FMA4_INSTR fnmsubpd, fnmsub132pd, fnmsub213pd, fnmsub231pd
+FMA4_INSTR fnmsubps, fnmsub132ps, fnmsub213ps, fnmsub231ps
+FMA4_INSTR fnmsubsd, fnmsub132sd, fnmsub213sd, fnmsub231sd
+FMA4_INSTR fnmsubss, fnmsub132ss, fnmsub213ss, fnmsub231ss
+
+; workaround: vpbroadcastq is broken in x86_32 due to a yasm bug
+%if ARCH_X86_64 == 0
+%macro vpbroadcastq 2
+%if sizeof%1 == 16
+ movddup %1, %2
+%else
+ vbroadcastsd %1, %2
+%endif
+%endmacro
+%endif
diff --git a/ffmpeg/libavutil/x86/x86util.asm b/ffmpeg/libavutil/x86/x86util.asm
index 8908444..59e5df2 100644
--- a/ffmpeg/libavutil/x86/x86util.asm
+++ b/ffmpeg/libavutil/x86/x86util.asm
@@ -665,3 +665,16 @@
psrad %1, 16
%endif
%endmacro
+
+; Wrapper for non-FMA version of fmaddps
+%macro FMULADD_PS 5
+ %if cpuflag(fma3) || cpuflag(fma4)
+ fmaddps %1, %2, %3, %4
+ %elifidn %1, %4
+ mulps %5, %2, %3
+ addps %1, %4, %5
+ %else
+ mulps %1, %2, %3
+ addps %1, %4
+ %endif
+%endmacro
diff --git a/ffmpeg/libavutil/xtea.c b/ffmpeg/libavutil/xtea.c
index e729c91..1750cbc 100644
--- a/ffmpeg/libavutil/xtea.c
+++ b/ffmpeg/libavutil/xtea.c
@@ -21,10 +21,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/intreadwrite.h"
+/**
+ * @file
+ * @brief XTEA 32-bit implementation
+ * @author Samuel Pitoiset
+ * @ingroup lavu_xtea
+ */
#include "avutil.h"
#include "common.h"
+#include "intreadwrite.h"
#include "xtea.h"
void av_xtea_init(AVXTEA *ctx, const uint8_t key[16])
@@ -244,7 +250,7 @@ int main(void)
AVXTEA ctx;
uint8_t buf[8], iv[8];
int i;
- const uint8_t src[32] = "HelloWorldHelloWorldHelloWorld";
+ static const uint8_t src[32] = "HelloWorldHelloWorldHelloWorld";
uint8_t ct[32];
uint8_t pl[32];
diff --git a/ffmpeg/libavutil/xtea.h b/ffmpeg/libavutil/xtea.h
index 0899c92..6f1e71e 100644
--- a/ffmpeg/libavutil/xtea.h
+++ b/ffmpeg/libavutil/xtea.h
@@ -25,6 +25,8 @@
#include <stdint.h>
/**
+ * @file
+ * @brief Public header for libavutil XTEA algorithm
* @defgroup lavu_xtea XTEA
* @ingroup lavu_crypto
* @{