1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1685: Cross build RTC with FFmpeg

This commit is contained in:
winlin 2021-06-19 21:55:12 +08:00
parent 1c75a270b3
commit 1e9de0e191
267 changed files with 12603 additions and 1451 deletions

View file

@ -31,7 +31,6 @@ HEADERS = adler32.h \
file.h \
frame.h \
hash.h \
hdr_dynamic_metadata.h \
hmac.h \
hwcontext.h \
hwcontext_cuda.h \
@ -79,7 +78,6 @@ HEADERS = adler32.h \
version.h \
xtea.h \
tea.h \
tx.h \
HEADERS-$(CONFIG_LZO) += lzo.h
@ -96,7 +94,6 @@ OBJS = adler32.o \
aes_ctr.o \
audio_fifo.o \
avstring.o \
avsscanf.o \
base64.o \
blowfish.o \
bprint.o \
@ -121,7 +118,6 @@ OBJS = adler32.o \
fixed_dsp.o \
frame.o \
hash.o \
hdr_dynamic_metadata.o \
hmac.o \
hwcontext.o \
imgutils.o \
@ -160,7 +156,6 @@ OBJS = adler32.o \
xga_font_data.o \
xtea.o \
tea.o \
tx.o \
OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
OBJS-$(CONFIG_D3D11VA) += hwcontext_d3d11va.o
@ -180,8 +175,7 @@ OBJS += $(COMPAT_OBJS:%=../compat/%)
SLIBOBJS-$(HAVE_GNU_WINDRES) += avutilres.o
SKIPHEADERS-$(HAVE_CUDA_H) += hwcontext_cuda.h
SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda_internal.h \
cuda_check.h
SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda_internal.h
SKIPHEADERS-$(CONFIG_D3D11VA) += hwcontext_d3d11va.h
SKIPHEADERS-$(CONFIG_DXVA2) += hwcontext_dxva2.h
SKIPHEADERS-$(CONFIG_QSV) += hwcontext_qsv.h

View file

@ -0,0 +1,8 @@
OBJS += arm/cpu.o \
arm/float_dsp_init_arm.o \
VFP-OBJS += arm/float_dsp_init_vfp.o \
arm/float_dsp_vfp.o \
NEON-OBJS += arm/float_dsp_init_neon.o \
arm/float_dsp_neon.o \

View file

@ -0,0 +1,67 @@
/*
* 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_ARM_BSWAP_H
#define AVUTIL_ARM_BSWAP_H
#include <stdint.h>
#include "config.h"
#include "libavutil/attributes.h"
#ifdef __ARMCC_VERSION
#if HAVE_ARMV6
#define av_bswap32 av_bswap32
static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
return __rev(x);
}
#endif /* HAVE_ARMV6 */
#elif HAVE_INLINE_ASM
#if HAVE_ARMV6_INLINE
#define av_bswap16 av_bswap16
static av_always_inline av_const unsigned av_bswap16(unsigned x)
{
__asm__("rev16 %0, %0" : "+r"(x));
return x;
}
#endif
#if AV_GCC_VERSION_AT_MOST(4,4)
#define av_bswap32 av_bswap32
static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
#if HAVE_ARMV6_INLINE
__asm__("rev %0, %0" : "+r"(x));
#else
uint32_t t;
__asm__ ("eor %1, %0, %0, ror #16 \n\t"
"bic %1, %1, #0xFF0000 \n\t"
"mov %0, %0, ror #8 \n\t"
"eor %0, %0, %1, lsr #8 \n\t"
: "+r"(x), "=&r"(t));
#endif /* HAVE_ARMV6_INLINE */
return x;
}
#endif /* AV_GCC_VERSION_AT_MOST(4,4) */
#endif /* __ARMCC_VERSION */
#endif /* AVUTIL_ARM_BSWAP_H */

View file

@ -0,0 +1,170 @@
/*
* 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
*/
#include "libavutil/cpu.h"
#include "libavutil/cpu_internal.h"
#include "config.h"
#define CORE_FLAG(f) \
(AV_CPU_FLAG_ ## f * (HAVE_ ## f ## _EXTERNAL || HAVE_ ## f ## _INLINE))
#define CORE_CPU_FLAGS \
(CORE_FLAG(ARMV5TE) | \
CORE_FLAG(ARMV6) | \
CORE_FLAG(ARMV6T2) | \
CORE_FLAG(VFP) | \
CORE_FLAG(VFPV3) | \
CORE_FLAG(NEON))
#if defined __linux__ || defined __ANDROID__
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/avstring.h"
#define AT_HWCAP 16
/* Relevant HWCAP values from kernel headers */
#define HWCAP_VFP (1 << 6)
#define HWCAP_EDSP (1 << 7)
#define HWCAP_THUMBEE (1 << 11)
#define HWCAP_NEON (1 << 12)
#define HWCAP_VFPv3 (1 << 13)
#define HWCAP_TLS (1 << 15)
static int get_hwcap(uint32_t *hwcap)
{
struct { uint32_t a_type; uint32_t a_val; } auxv;
FILE *f = fopen("/proc/self/auxv", "r");
int err = -1;
if (!f)
return -1;
while (fread(&auxv, sizeof(auxv), 1, f) > 0) {
if (auxv.a_type == AT_HWCAP) {
*hwcap = auxv.a_val;
err = 0;
break;
}
}
fclose(f);
return err;
}
static int get_cpuinfo(uint32_t *hwcap)
{
FILE *f = fopen("/proc/cpuinfo", "r");
char buf[200];
if (!f)
return -1;
*hwcap = 0;
while (fgets(buf, sizeof(buf), f)) {
if (av_strstart(buf, "Features", NULL)) {
if (strstr(buf, " edsp "))
*hwcap |= HWCAP_EDSP;
if (strstr(buf, " tls "))
*hwcap |= HWCAP_TLS;
if (strstr(buf, " thumbee "))
*hwcap |= HWCAP_THUMBEE;
if (strstr(buf, " vfp "))
*hwcap |= HWCAP_VFP;
if (strstr(buf, " vfpv3 "))
*hwcap |= HWCAP_VFPv3;
if (strstr(buf, " neon ") || strstr(buf, " asimd "))
*hwcap |= HWCAP_NEON;
if (strstr(buf, " fp ")) // Listed on 64 bit ARMv8 kernels
*hwcap |= HWCAP_VFP | HWCAP_VFPv3;
break;
}
}
fclose(f);
return 0;
}
int ff_get_cpu_flags_arm(void)
{
int flags = CORE_CPU_FLAGS;
uint32_t hwcap;
if (get_hwcap(&hwcap) < 0)
if (get_cpuinfo(&hwcap) < 0)
return flags;
#define check_cap(cap, flag) do { \
if (hwcap & HWCAP_ ## cap) \
flags |= AV_CPU_FLAG_ ## flag; \
} while (0)
/* No flags explicitly indicate v6 or v6T2 so check others which
imply support. */
check_cap(EDSP, ARMV5TE);
check_cap(TLS, ARMV6);
check_cap(THUMBEE, ARMV6T2);
check_cap(VFP, VFP);
check_cap(VFPv3, VFPV3);
check_cap(NEON, NEON);
/* The v6 checks above are not reliable so let higher flags
trickle down. */
if (flags & (AV_CPU_FLAG_VFPV3 | AV_CPU_FLAG_NEON))
flags |= AV_CPU_FLAG_ARMV6T2;
else if (flags & (AV_CPU_FLAG_ARMV6T2 | AV_CPU_FLAG_ARMV6))
/* Some functions use the 'setend' instruction which is deprecated on ARMv8
* and serializing on some ARMv7 cores. This ensures such functions
* are only enabled on ARMv6. */
flags |= AV_CPU_FLAG_SETEND;
if (flags & AV_CPU_FLAG_ARMV6T2)
flags |= AV_CPU_FLAG_ARMV6;
/* set the virtual VFPv2 vector mode flag */
if ((flags & AV_CPU_FLAG_VFP) && !(flags & (AV_CPU_FLAG_VFPV3 | AV_CPU_FLAG_NEON)))
flags |= AV_CPU_FLAG_VFP_VM;
return flags;
}
#else
int ff_get_cpu_flags_arm(void)
{
return AV_CPU_FLAG_ARMV5TE * HAVE_ARMV5TE |
AV_CPU_FLAG_ARMV6 * HAVE_ARMV6 |
AV_CPU_FLAG_ARMV6T2 * HAVE_ARMV6T2 |
AV_CPU_FLAG_VFP * HAVE_VFP |
AV_CPU_FLAG_VFPV3 * HAVE_VFPV3 |
AV_CPU_FLAG_NEON * HAVE_NEON |
AV_CPU_FLAG_SETEND * !(HAVE_NEON | HAVE_VFPV3);
}
#endif
size_t ff_get_cpu_max_align_arm(void)
{
int flags = av_get_cpu_flags();
if (flags & AV_CPU_FLAG_NEON)
return 16;
return 8;
}

View file

@ -0,0 +1,38 @@
/*
* 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_ARM_CPU_H
#define AVUTIL_ARM_CPU_H
#include "libavutil/cpu.h"
#include "libavutil/cpu_internal.h"
#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)
#define have_setend(flags) CPUEXT(flags, SETEND)
/* some functions use the VFPv2 vector mode which is deprecated in ARMv7-A
* and might trap on such CPU depending on the OS configuration */
#define have_vfp_vm(flags) \
(HAVE_VFP && ((flags) & AV_CPU_FLAG_VFP_VM))
#endif /* AVUTIL_ARM_CPU_H */

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
*
* 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_ARM_FLOAT_DSP_ARM_H
#define AVUTIL_ARM_FLOAT_DSP_ARM_H
#include "libavutil/float_dsp.h"
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 */

View file

@ -0,0 +1,32 @@
/*
* 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
*/
#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "cpu.h"
#include "float_dsp_arm.h"
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, cpu_flags);
if (have_neon(cpu_flags))
ff_float_dsp_init_neon(fdsp);
}

View file

@ -0,0 +1,59 @@
/*
* ARM NEON optimised Float DSP functions
* Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
*
* 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
*/
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "float_dsp_arm.h"
void ff_vector_fmul_neon(float *dst, const float *src0, const float *src1, int len);
void ff_vector_fmac_scalar_neon(float *dst, const float *src, float mul,
int len);
void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul,
int len);
void ff_vector_fmul_window_neon(float *dst, const float *src0,
const float *src1, const float *win, int len);
void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1,
const float *src2, int len);
void ff_vector_fmul_reverse_neon(float *dst, const float *src0,
const float *src1, int len);
void ff_butterflies_float_neon(float *v1, float *v2, int len);
float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len);
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;
fdsp->vector_fmul_scalar = ff_vector_fmul_scalar_neon;
fdsp->vector_fmul_window = ff_vector_fmul_window_neon;
fdsp->vector_fmul_add = ff_vector_fmul_add_neon;
fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_neon;
fdsp->butterflies_float = ff_butterflies_float_neon;
fdsp->scalarproduct_float = ff_scalarproduct_float_neon;
}

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
*
* 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
*/
#include "libavutil/attributes.h"
#include "libavutil/float_dsp.h"
#include "cpu.h"
#include "float_dsp_arm.h"
void ff_vector_fmul_vfp(float *dst, const float *src0, const float *src1,
int len);
void ff_vector_fmul_window_vfp(float *dst, const float *src0,
const float *src1, const float *win, int len);
void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
const float *src1, int len);
void ff_butterflies_float_vfp(float *av_restrict v1, float *av_restrict v2, int len);
av_cold void ff_float_dsp_init_vfp(AVFloatDSPContext *fdsp, int cpu_flags)
{
if (have_vfp_vm(cpu_flags)) {
fdsp->vector_fmul = ff_vector_fmul_vfp;
fdsp->vector_fmul_window = ff_vector_fmul_window_vfp;
}
fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_vfp;
if (have_vfp_vm(cpu_flags))
fdsp->butterflies_float = ff_butterflies_float_vfp;
}

View file

@ -0,0 +1,134 @@
/*
* Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
*
* 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_ARM_INTMATH_H
#define AVUTIL_ARM_INTMATH_H
#include <stdint.h>
#include "config.h"
#include "libavutil/attributes.h"
#if HAVE_INLINE_ASM
#if HAVE_ARMV6_INLINE
#define av_clip_uint8 av_clip_uint8_arm
static av_always_inline av_const int av_clip_uint8_arm(int a)
{
int x;
__asm__ ("usat %0, #8, %1" : "=r"(x) : "r"(a));
return x;
}
#define av_clip_int8 av_clip_int8_arm
static av_always_inline av_const int av_clip_int8_arm(int a)
{
int x;
__asm__ ("ssat %0, #8, %1" : "=r"(x) : "r"(a));
return x;
}
#define av_clip_uint16 av_clip_uint16_arm
static av_always_inline av_const int av_clip_uint16_arm(int a)
{
int x;
__asm__ ("usat %0, #16, %1" : "=r"(x) : "r"(a));
return x;
}
#define av_clip_int16 av_clip_int16_arm
static av_always_inline av_const int av_clip_int16_arm(int a)
{
int x;
__asm__ ("ssat %0, #16, %1" : "=r"(x) : "r"(a));
return x;
}
#define av_clip_intp2 av_clip_intp2_arm
static av_always_inline av_const int av_clip_intp2_arm(int a, int p)
{
unsigned x;
__asm__ ("ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p+1));
return x;
}
#define av_clip_uintp2 av_clip_uintp2_arm
static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p)
{
unsigned x;
__asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
return x;
}
#define av_sat_add32 av_sat_add32_arm
static av_always_inline int av_sat_add32_arm(int a, int b)
{
int r;
__asm__ ("qadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
return r;
}
#define av_sat_dadd32 av_sat_dadd32_arm
static av_always_inline int av_sat_dadd32_arm(int a, int b)
{
int r;
__asm__ ("qdadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
return r;
}
#define av_sat_sub32 av_sat_sub32_arm
static av_always_inline int av_sat_sub32_arm(int a, int b)
{
int r;
__asm__ ("qsub %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
return r;
}
#define av_sat_dsub32 av_sat_dsub32_arm
static av_always_inline int av_sat_dsub32_arm(int a, int b)
{
int r;
__asm__ ("qdsub %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
return r;
}
#endif /* HAVE_ARMV6_INLINE */
#if HAVE_ASM_MOD_Q
#define av_clipl_int32 av_clipl_int32_arm
static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
{
int x, y;
__asm__ ("adds %1, %R2, %Q2, lsr #31 \n\t"
"itet ne \n\t"
"mvnne %1, #1<<31 \n\t"
"moveq %0, %Q2 \n\t"
"eorne %0, %1, %R2, asr #31 \n\t"
: "=r"(x), "=&r"(y) : "r"(a) : "cc");
return x;
}
#endif /* HAVE_ASM_MOD_Q */
#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_ARM_INTMATH_H */

View file

@ -0,0 +1,91 @@
/*
* 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_ARM_INTREADWRITE_H
#define AVUTIL_ARM_INTREADWRITE_H
#include <stdint.h>
#include "config.h"
#include "libavutil/attributes.h"
#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM && AV_GCC_VERSION_AT_MOST(4,6)
#define AV_RN16 AV_RN16
static av_always_inline unsigned AV_RN16(const void *p)
{
const uint8_t *q = p;
unsigned v;
#if AV_GCC_VERSION_AT_MOST(4,5)
__asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)q));
#elif defined __thumb__
__asm__ ("ldrh %0, %1" : "=r"(v) : "m"(q[0]), "m"(q[1]));
#else
__asm__ ("ldrh %0, %1" : "=r"(v) : "Uq"(q[0]), "m"(q[1]));
#endif
return v;
}
#define AV_WN16 AV_WN16
static av_always_inline void AV_WN16(void *p, uint16_t v)
{
__asm__ ("strh %1, %0" : "=m"(*(uint16_t *)p) : "r"(v));
}
#define AV_RN32 AV_RN32
static av_always_inline uint32_t AV_RN32(const void *p)
{
const struct __attribute__((packed)) { uint32_t v; } *q = p;
uint32_t v;
__asm__ ("ldr %0, %1" : "=r"(v) : "m"(*q));
return v;
}
#define AV_WN32 AV_WN32
static av_always_inline void AV_WN32(void *p, uint32_t v)
{
__asm__ ("str %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
}
#if HAVE_ASM_MOD_Q
#define AV_RN64 AV_RN64
static av_always_inline uint64_t AV_RN64(const void *p)
{
const struct __attribute__((packed)) { uint32_t v; } *q = p;
uint64_t v;
__asm__ ("ldr %Q0, %1 \n\t"
"ldr %R0, %2 \n\t"
: "=&r"(v)
: "m"(q[0]), "m"(q[1]));
return v;
}
#define AV_WN64 AV_WN64
static av_always_inline void AV_WN64(void *p, uint64_t v)
{
__asm__ ("str %Q2, %0 \n\t"
"str %R2, %1 \n\t"
: "=m"(*(uint32_t*)p), "=m"(*((uint32_t*)p+1))
: "r"(v));
}
#endif /* HAVE_ASM_MOD_Q */
#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_ARM_INTREADWRITE_H */

View file

@ -0,0 +1,67 @@
/*
* check NEON registers for clobbering
* Copyright (c) 2008 Ramiro Polla <ramiro.polla@gmail.com>
* Copyright (c) 2013 Martin Storsjo
*
* 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_ARM_NEONTEST_H
#define AVUTIL_ARM_NEONTEST_H
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "libavutil/bswap.h"
#define storeneonregs(mem) \
__asm__ volatile( \
"vstm %0, {d8-d15}\n\t" \
:: "r"(mem) : "memory")
#define testneonclobbers(func, ctx, ...) \
uint64_t neon[2][8]; \
int ret; \
storeneonregs(neon[0]); \
ret = __real_ ## func(ctx, __VA_ARGS__); \
storeneonregs(neon[1]); \
if (memcmp(neon[0], neon[1], sizeof(neon[0]))) { \
int i; \
av_log(ctx, AV_LOG_ERROR, \
"NEON REGS CLOBBERED IN %s!\n", #func); \
for (i = 0; i < 8; i ++) \
if (neon[0][i] != neon[1][i]) { \
av_log(ctx, AV_LOG_ERROR, \
"d%-2d = %016"PRIx64"\n", \
8 + i, av_bswap64(neon[0][i])); \
av_log(ctx, AV_LOG_ERROR, \
" -> %016"PRIx64"\n", \
av_bswap64(neon[1][i])); \
} \
abort(); \
} \
return ret
#define wrap(func) \
int __real_ ## func; \
int __wrap_ ## func; \
int __wrap_ ## func
#endif /* AVUTIL_ARM_NEONTEST_H */

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2009 Mans Rullgard <mans@mansr.com>
*
* 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_ARM_TIMER_H
#define AVUTIL_ARM_TIMER_H
#include <stdint.h>
#include "config.h"
#if HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__)
#define AV_READ_TIME read_time
static inline uint64_t read_time(void)
{
unsigned cc;
__asm__ volatile ("mrc p15, 0, %0, c9, c13, 0" : "=r"(cc));
return cc;
}
#endif /* HAVE_INLINE_ASM && __ARM_ARCH_7A__ */
#endif /* AVUTIL_ARM_TIMER_H */

View file

@ -400,12 +400,6 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
*/
int av_match_list(const char *name, const char *list, char separator);
/**
* See libc sscanf manual for more information.
* Locale-independent sscanf implementation.
*/
int av_sscanf(const char *string, const char *format, ...);
/**
* @}
*/

View file

@ -119,32 +119,4 @@ static inline int C_JPEG_TO_CCIR(int y) {
(((FIX(0.50000) * r1 - FIX(0.41869) * g1 - \
FIX(0.08131) * b1 + (ONE_HALF) - 1) >> (SCALEBITS)) + 128)
// Conversion macros for 8-bit RGB to YUV
// Derived from ITU-R BT.709-6 (06/2015) Item 3.5
// https://www.itu.int/rec/R-REC-BT.709-6-201506-I/en
#define RGB_TO_Y_BT709(r, g, b) \
((FIX(0.21260*219.0/255.0) * (r) + FIX(0.71520*219.0/255.0) * (g) + \
FIX(0.07220*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
#define RGB_TO_U_BT709(r1, g1, b1, shift)\
(((- FIX(0.11457*224.0/255.0) * r1 - FIX(0.38543*224.0/255.0) * g1 + \
FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
#define RGB_TO_V_BT709(r1, g1, b1, shift)\
(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.45415*224.0/255.0) * g1 - \
FIX(0.04585*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
#define RGB_TO_Y_BT709_FULL(r, g, b) \
(FFMIN((FIX(0.21260) * (r) + FIX(0.71520) * (g) + \
FIX(0.07220) * (b) + (ONE_HALF)) >> SCALEBITS, 255))
#define RGB_TO_U_BT709_FULL(r1, g1, b1)\
(((- FIX(0.11457) * r1 - FIX(0.38543) * g1 + \
FIX(0.50000) * b1 + (ONE_HALF) - 1) >> (SCALEBITS)) + 128)
#define RGB_TO_V_BT709_FULL(r1, g1, b1)\
(((FIX(0.50000) * r1 - FIX(0.45415) * g1 - \
FIX(0.04585) * b1 + (ONE_HALF) - 1) >> (SCALEBITS)) + 128)
#endif /* AVUTIL_COLORSPACE_H */

View file

@ -331,7 +331,7 @@ static av_always_inline av_const double av_clipd_c(double a, double amin, double
*/
static av_always_inline av_const int av_ceil_log2_c(int x)
{
return av_log2((x - 1) << 1);
return av_log2((x - 1U) << 1);
}
/**

View file

@ -23,7 +23,7 @@
#include "mem.h"
/**
* Add an element to a dynamic array.
* Add an element of 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.

View file

@ -331,8 +331,10 @@ uint8_t *av_encryption_init_info_add_side_data(const AVEncryptionInitInfo *info,
memcpy(cur_buffer, cur_info->key_ids[i], cur_info->key_id_size);
cur_buffer += cur_info->key_id_size;
}
memcpy(cur_buffer, cur_info->data, cur_info->data_size);
cur_buffer += cur_info->data_size;
if (cur_info->data_size > 0) {
memcpy(cur_buffer, cur_info->data, cur_info->data_size);
cur_buffer += cur_info->data_size;
}
}
return buffer;

View file

@ -138,7 +138,7 @@ int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *l
#else
snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
fd = mkstemp(*filename);
#if defined(_WIN32) || defined (__ANDROID__) || defined(__DJGPP__)
#if defined(_WIN32) || defined (__ANDROID__)
if (fd < 0) {
snprintf(*filename, len, "./%sXXXXXX", prefix);
fd = mkstemp(*filename);

View file

@ -840,8 +840,6 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
case AV_FRAME_DATA_QP_TABLE_PROPERTIES: return "QP table properties";
case AV_FRAME_DATA_QP_TABLE_DATA: return "QP table data";
#endif
case AV_FRAME_DATA_DYNAMIC_HDR_PLUS: return "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)";
case AV_FRAME_DATA_REGIONS_OF_INTEREST: return "Regions Of Interest";
}
return NULL;
}

View file

@ -166,19 +166,6 @@ enum AVFrameSideDataType {
* function in libavutil/timecode.c.
*/
AV_FRAME_DATA_S12M_TIMECODE,
/**
* HDR dynamic metadata associated with a video frame. The payload is
* an AVDynamicHDRPlus type and contains information for color
* volume transform - application 4 of SMPTE 2094-40:2016 standard.
*/
AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
/**
* Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of
* array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.
*/
AV_FRAME_DATA_REGIONS_OF_INTEREST,
};
enum AVActiveFormatDescription {
@ -206,62 +193,6 @@ typedef struct AVFrameSideData {
AVBufferRef *buf;
} AVFrameSideData;
/**
* Structure describing a single Region Of Interest.
*
* When multiple regions are defined in a single side-data block, they
* should be ordered from most to least important - some encoders are only
* capable of supporting a limited number of distinct regions, so will have
* to truncate the list.
*
* When overlapping regions are defined, the first region containing a given
* area of the frame applies.
*/
typedef struct AVRegionOfInterest {
/**
* Must be set to the size of this data structure (that is,
* sizeof(AVRegionOfInterest)).
*/
uint32_t self_size;
/**
* Distance in pixels from the top edge of the frame to the top and
* bottom edges and from the left edge of the frame to the left and
* right edges of the rectangle defining this region of interest.
*
* The constraints on a region are encoder dependent, so the region
* actually affected may be slightly larger for alignment or other
* reasons.
*/
int top;
int bottom;
int left;
int right;
/**
* Quantisation offset.
*
* Must be in the range -1 to +1. A value of zero indicates no quality
* change. A negative value asks for better quality (less quantisation),
* while a positive value asks for worse quality (greater quantisation).
*
* The range is calibrated so that the extreme values indicate the
* largest possible offset - if the rest of the frame is encoded with the
* worst possible quality, an offset of -1 indicates that this region
* should be encoded with the best possible quality anyway. Intermediate
* values are then interpolated in some codec-dependent way.
*
* For example, in 10-bit H.264 the quantisation parameter varies between
* -12 and 51. A typical qoffset value of -1/10 therefore indicates that
* this region should be encoded with a QP around one-tenth of the full
* range better than the rest of the frame. So, if most of the frame
* were to be encoded with a QP of around 30, this region would get a QP
* of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
* An extreme value of -1 would indicate that this region should be
* encoded with the best possible quality regardless of the treatment of
* the rest of the frame - that is, should be encoded at a QP of -12.
*/
AVRational qoffset;
} AVRegionOfInterest;
/**
* This structure describes decoded (raw) audio or video data.
*
@ -458,6 +389,7 @@ typedef struct AVFrame {
* that time,
* the decoder reorders values as needed and sets AVFrame.reordered_opaque
* to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
* @deprecated in favor of pkt_pts
*/
int64_t reordered_opaque;
@ -590,8 +522,6 @@ typedef struct AVFrame {
int decode_error_flags;
#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
#define FF_DECODE_ERROR_MISSING_REFERENCE 2
#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4
#define FF_DECODE_ERROR_DECODE_SLICES 8
/**
* number of audio channels, only used for audio.

View file

@ -21,7 +21,6 @@
#include "hwcontext.h"
#include "hwcontext_internal.h"
#include "hwcontext_cuda_internal.h"
#include "cuda_check.h"
#include "mem.h"
#include "pixdesc.h"
#include "pixfmt.h"
@ -44,8 +43,6 @@ static const enum AVPixelFormat supported_formats[] = {
AV_PIX_FMT_0BGR32,
};
#define CHECK_CU(x) FF_CUDA_CHECK_DL(device_ctx, cu, x)
static int cuda_frames_get_constraints(AVHWDeviceContext *ctx,
const void *hwconfig,
AVHWFramesConstraints *constraints)
@ -73,48 +70,48 @@ static int cuda_frames_get_constraints(AVHWDeviceContext *ctx,
static void cuda_buffer_free(void *opaque, uint8_t *data)
{
AVHWFramesContext *ctx = opaque;
AVHWDeviceContext *device_ctx = ctx->device_ctx;
AVCUDADeviceContext *hwctx = device_ctx->hwctx;
CudaFunctions *cu = hwctx->internal->cuda_dl;
AVHWFramesContext *ctx = opaque;
AVCUDADeviceContext *hwctx = ctx->device_ctx->hwctx;
CudaFunctions *cu = hwctx->internal->cuda_dl;
CUcontext dummy;
CHECK_CU(cu->cuCtxPushCurrent(hwctx->cuda_ctx));
cu->cuCtxPushCurrent(hwctx->cuda_ctx);
CHECK_CU(cu->cuMemFree((CUdeviceptr)data));
cu->cuMemFree((CUdeviceptr)data);
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
cu->cuCtxPopCurrent(&dummy);
}
static AVBufferRef *cuda_pool_alloc(void *opaque, int size)
{
AVHWFramesContext *ctx = opaque;
AVHWDeviceContext *device_ctx = ctx->device_ctx;
AVCUDADeviceContext *hwctx = device_ctx->hwctx;
CudaFunctions *cu = hwctx->internal->cuda_dl;
AVHWFramesContext *ctx = opaque;
AVCUDADeviceContext *hwctx = ctx->device_ctx->hwctx;
CudaFunctions *cu = hwctx->internal->cuda_dl;
AVBufferRef *ret = NULL;
CUcontext dummy = NULL;
CUdeviceptr data;
int err;
CUresult err;
err = CHECK_CU(cu->cuCtxPushCurrent(hwctx->cuda_ctx));
if (err < 0)
err = cu->cuCtxPushCurrent(hwctx->cuda_ctx);
if (err != CUDA_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Error setting current CUDA context\n");
return NULL;
}
err = CHECK_CU(cu->cuMemAlloc(&data, size));
if (err < 0)
err = cu->cuMemAlloc(&data, size);
if (err != CUDA_SUCCESS)
goto fail;
ret = av_buffer_create((uint8_t*)data, size, cuda_buffer_free, ctx, 0);
if (!ret) {
CHECK_CU(cu->cuMemFree(data));
cu->cuMemFree(data);
goto fail;
}
fail:
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
cu->cuCtxPopCurrent(&dummy);
return ret;
}
@ -197,17 +194,17 @@ static int cuda_transfer_get_formats(AVHWFramesContext *ctx,
static int cuda_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,
const AVFrame *src)
{
CUDAFramesContext *priv = ctx->internal->priv;
AVHWDeviceContext *device_ctx = ctx->device_ctx;
AVCUDADeviceContext *hwctx = device_ctx->hwctx;
CudaFunctions *cu = hwctx->internal->cuda_dl;
CUDAFramesContext *priv = ctx->internal->priv;
AVCUDADeviceContext *device_hwctx = ctx->device_ctx->hwctx;
CudaFunctions *cu = device_hwctx->internal->cuda_dl;
CUcontext dummy;
int i, ret;
CUresult err;
int i;
ret = CHECK_CU(cu->cuCtxPushCurrent(hwctx->cuda_ctx));
if (ret < 0)
return ret;
err = cu->cuCtxPushCurrent(device_hwctx->cuda_ctx);
if (err != CUDA_SUCCESS)
return AVERROR_UNKNOWN;
for (i = 0; i < FF_ARRAY_ELEMS(src->data) && src->data[i]; i++) {
CUDA_MEMCPY2D cpy = {
@ -221,17 +218,20 @@ static int cuda_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,
.Height = src->height >> (i ? priv->shift_height : 0),
};
ret = CHECK_CU(cu->cuMemcpy2DAsync(&cpy, hwctx->stream));
if (ret < 0)
goto exit;
err = cu->cuMemcpy2DAsync(&cpy, device_hwctx->stream);
if (err != CUDA_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Error transferring the data from the CUDA frame\n");
return AVERROR_UNKNOWN;
}
}
ret = CHECK_CU(cu->cuStreamSynchronize(hwctx->stream));
if (ret < 0)
goto exit;
err = cu->cuStreamSynchronize(device_hwctx->stream);
if (err != CUDA_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Error synchronizing CUDA stream\n");
return AVERROR_UNKNOWN;
}
exit:
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
cu->cuCtxPopCurrent(&dummy);
return 0;
}
@ -239,17 +239,17 @@ exit:
static int cuda_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
const AVFrame *src)
{
CUDAFramesContext *priv = ctx->internal->priv;
AVHWDeviceContext *device_ctx = ctx->device_ctx;
AVCUDADeviceContext *hwctx = device_ctx->hwctx;
CudaFunctions *cu = hwctx->internal->cuda_dl;
CUDAFramesContext *priv = ctx->internal->priv;
AVCUDADeviceContext *device_hwctx = ctx->device_ctx->hwctx;
CudaFunctions *cu = device_hwctx->internal->cuda_dl;
CUcontext dummy;
int i, ret;
CUresult err;
int i;
ret = CHECK_CU(cu->cuCtxPushCurrent(hwctx->cuda_ctx));
if (ret < 0)
return ret;
err = cu->cuCtxPushCurrent(device_hwctx->cuda_ctx);
if (err != CUDA_SUCCESS)
return AVERROR_UNKNOWN;
for (i = 0; i < FF_ARRAY_ELEMS(src->data) && src->data[i]; i++) {
CUDA_MEMCPY2D cpy = {
@ -263,25 +263,31 @@ static int cuda_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
.Height = src->height >> (i ? priv->shift_height : 0),
};
ret = CHECK_CU(cu->cuMemcpy2DAsync(&cpy, hwctx->stream));
if (ret < 0)
goto exit;
err = cu->cuMemcpy2DAsync(&cpy, device_hwctx->stream);
if (err != CUDA_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Error transferring the data to the CUDA frame\n");
return AVERROR_UNKNOWN;
}
}
exit:
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
err = cu->cuStreamSynchronize(device_hwctx->stream);
if (err != CUDA_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Error synchronizing CUDA stream\n");
return AVERROR_UNKNOWN;
}
cu->cuCtxPopCurrent(&dummy);
return 0;
}
static void cuda_device_uninit(AVHWDeviceContext *device_ctx)
static void cuda_device_uninit(AVHWDeviceContext *ctx)
{
AVCUDADeviceContext *hwctx = device_ctx->hwctx;
AVCUDADeviceContext *hwctx = ctx->hwctx;
if (hwctx->internal) {
CudaFunctions *cu = hwctx->internal->cuda_dl;
if (hwctx->internal->is_allocated && hwctx->cuda_ctx) {
CHECK_CU(cu->cuCtxDestroy(hwctx->cuda_ctx));
hwctx->internal->cuda_dl->cuCtxDestroy(hwctx->cuda_ctx);
hwctx->cuda_ctx = NULL;
}
cuda_free_functions(&hwctx->internal->cuda_dl);
@ -316,47 +322,53 @@ error:
return ret;
}
static int cuda_device_create(AVHWDeviceContext *device_ctx,
const char *device,
static int cuda_device_create(AVHWDeviceContext *ctx, const char *device,
AVDictionary *opts, int flags)
{
AVCUDADeviceContext *hwctx = device_ctx->hwctx;
AVCUDADeviceContext *hwctx = ctx->hwctx;
CudaFunctions *cu;
CUdevice cu_device;
CUcontext dummy;
int ret, device_idx = 0;
CUresult err;
int device_idx = 0;
if (device)
device_idx = strtol(device, NULL, 0);
if (cuda_device_init(device_ctx) < 0)
if (cuda_device_init(ctx) < 0)
goto error;
cu = hwctx->internal->cuda_dl;
ret = CHECK_CU(cu->cuInit(0));
if (ret < 0)
err = cu->cuInit(0);
if (err != CUDA_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Could not initialize the CUDA driver API\n");
goto error;
}
ret = CHECK_CU(cu->cuDeviceGet(&cu_device, device_idx));
if (ret < 0)
err = cu->cuDeviceGet(&cu_device, device_idx);
if (err != CUDA_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Could not get the device number %d\n", device_idx);
goto error;
}
ret = CHECK_CU(cu->cuCtxCreate(&hwctx->cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, cu_device));
if (ret < 0)
err = cu->cuCtxCreate(&hwctx->cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, cu_device);
if (err != CUDA_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Error creating a CUDA context\n");
goto error;
}
// Setting stream to NULL will make functions automatically use the default CUstream
hwctx->stream = NULL;
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
cu->cuCtxPopCurrent(&dummy);
hwctx->internal->is_allocated = 1;
return 0;
error:
cuda_device_uninit(device_ctx);
cuda_device_uninit(ctx);
return AVERROR_UNKNOWN;
}

View file

@ -410,7 +410,7 @@ static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst,
fill_texture_ptrs(map_data, map_linesize, ctx, &desc, &map);
av_image_copy(dst->data, dst->linesize, (const uint8_t **)map_data, map_linesize,
av_image_copy(dst->data, dst->linesize, map_data, map_linesize,
ctx->sw_format, w, h);
ID3D11DeviceContext_Unmap(device_hwctx->device_context, staging, 0);
@ -422,7 +422,7 @@ static int d3d11va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst,
fill_texture_ptrs(map_data, map_linesize, ctx, &desc, &map);
av_image_copy(map_data, map_linesize, (const uint8_t **)src->data, src->linesize,
av_image_copy(map_data, map_linesize, src->data, src->linesize,
ctx->sw_format, w, h);
ID3D11DeviceContext_Unmap(device_hwctx->device_context, staging, 0);

View file

@ -348,7 +348,7 @@ static int dxva2_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
if (ret < 0)
goto fail;
av_image_copy(map->data, map->linesize, (const uint8_t **)src->data, src->linesize,
av_image_copy(map->data, map->linesize, src->data, src->linesize,
ctx->sw_format, src->width, src->height);
fail:
@ -379,7 +379,7 @@ static int dxva2_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,
dst_linesize[i] = dst->linesize[i];
src_linesize[i] = map->linesize[i];
}
av_image_copy_uc_from(dst->data, dst_linesize, (const uint8_t **)map->data, src_linesize,
av_image_copy_uc_from(dst->data, dst_linesize, map->data, src_linesize,
ctx->sw_format, src->width, src->height);
fail:
av_frame_free(&map);

View file

@ -50,7 +50,7 @@
#include <mfx/mfxstructures.h>
#endif
#include <va/va.h>
#include <CL/cl_va_api_media_sharing_intel.h>
#include <CL/va_ext.h>
#include "hwcontext_vaapi.h"
#endif
@ -500,9 +500,6 @@ static int opencl_device_create_internal(AVHWDeviceContext *hwdev,
*device_name_src = NULL;
int err, found, p, d;
av_assert0(selector->enumerate_platforms &&
selector->enumerate_devices);
err = selector->enumerate_platforms(hwdev, &nb_platforms, &platforms,
selector->context);
if (err)
@ -534,9 +531,9 @@ static int opencl_device_create_internal(AVHWDeviceContext *hwdev,
continue;
}
err = selector->enumerate_devices(hwdev, platforms[p], platform_name,
&nb_devices, &devices,
selector->context);
err = opencl_enumerate_devices(hwdev, platforms[p], platform_name,
&nb_devices, &devices,
selector->context);
if (err < 0)
continue;
@ -1419,9 +1416,8 @@ static int opencl_get_plane_format(enum AVPixelFormat pixfmt,
// from the same component.
if (step && comp->step != step)
return AVERROR(EINVAL);
order = order * 10 + c + 1;
depth = comp->depth;
order = order * 10 + comp->offset / ((depth + 7) / 8) + 1;
step = comp->step;
alpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA &&
c == desc->nb_components - 1);
@ -1457,10 +1453,14 @@ static int opencl_get_plane_format(enum AVPixelFormat pixfmt,
case order: image_format->image_channel_order = type; break;
switch (order) {
CHANNEL_ORDER(1, CL_R);
CHANNEL_ORDER(2, CL_R);
CHANNEL_ORDER(3, CL_R);
CHANNEL_ORDER(4, CL_R);
CHANNEL_ORDER(12, CL_RG);
CHANNEL_ORDER(23, CL_RG);
CHANNEL_ORDER(1234, CL_RGBA);
CHANNEL_ORDER(2341, CL_ARGB);
CHANNEL_ORDER(3214, CL_BGRA);
CHANNEL_ORDER(4123, CL_ARGB);
#ifdef CL_ABGR
CHANNEL_ORDER(4321, CL_ABGR);
#endif
@ -1726,13 +1726,10 @@ static void opencl_frames_uninit(AVHWFramesContext *hwfc)
av_freep(&priv->mapped_frames);
#endif
if (priv->command_queue) {
cle = clReleaseCommandQueue(priv->command_queue);
if (cle != CL_SUCCESS) {
av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
"command queue: %d.\n", cle);
}
priv->command_queue = NULL;
cle = clReleaseCommandQueue(priv->command_queue);
if (cle != CL_SUCCESS) {
av_log(hwfc, AV_LOG_ERROR, "Failed to release frame "
"command queue: %d.\n", cle);
}
}

View file

@ -389,7 +389,7 @@ static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req,
!(req->Type & (MFX_MEMTYPE_FROM_VPPIN | MFX_MEMTYPE_FROM_VPPOUT)) ||
!(req->Type & MFX_MEMTYPE_EXTERNAL_FRAME))
return MFX_ERR_UNSUPPORTED;
if (i->Width > i1->Width || i->Height > i1->Height ||
if (i->Width != i1->Width || i->Height != i1->Height ||
i->FourCC != i1->FourCC || i->ChromaFormat != i1->ChromaFormat) {
av_log(ctx, AV_LOG_ERROR, "Mismatching surface properties in an "
"allocation request: %dx%d %d %d vs %dx%d %d %d\n",
@ -863,8 +863,7 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
mfxStatus err;
int ret = 0;
/* make a copy if the input is not padded as libmfx requires */
AVFrame tmp_frame;
const AVFrame *src_frame;
AVFrame tmp_frame, *src_frame;
int realigned = 0;
@ -892,7 +891,8 @@ static int qsv_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
if (ret < 0)
return ret;
if (src->height & 15 || src->linesize[0] & 15) {
if (src->height & 16 || src->linesize[0] & 16) {
realigned = 1;
memset(&tmp_frame, 0, sizeof(tmp_frame));
tmp_frame.format = src->format;
@ -1206,7 +1206,6 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
QSVDevicePriv *priv;
enum AVHWDeviceType child_device_type;
AVHWDeviceContext *child_device;
AVDictionary *child_device_opts;
AVDictionaryEntry *e;
mfxIMPL impl;
@ -1221,17 +1220,9 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
e = av_dict_get(opts, "child_device", NULL, 0);
child_device_opts = NULL;
if (CONFIG_VAAPI) {
if (CONFIG_VAAPI)
child_device_type = AV_HWDEVICE_TYPE_VAAPI;
// libmfx does not actually implement VAAPI properly, rather it
// depends on the specific behaviour of a matching iHD driver when
// used on recent Intel hardware. Set options to the VAAPI device
// creation so that we should pick a usable setup by default if
// possible, even when multiple devices and drivers are available.
av_dict_set(&child_device_opts, "kernel_driver", "i915", 0);
av_dict_set(&child_device_opts, "driver", "iHD", 0);
} else if (CONFIG_DXVA2)
else if (CONFIG_DXVA2)
child_device_type = AV_HWDEVICE_TYPE_DXVA2;
else {
av_log(ctx, AV_LOG_ERROR, "No supported child device type is enabled\n");
@ -1239,7 +1230,7 @@ static int qsv_device_create(AVHWDeviceContext *ctx, const char *device,
}
ret = av_hwdevice_ctx_create(&priv->child_device_ctx, child_device_type,
e ? e->value : NULL, child_device_opts, 0);
e ? e->value : NULL, NULL, 0);
if (ret < 0)
return ret;

View file

@ -27,7 +27,6 @@
#if CONFIG_LIBDRM
# include <va/va_drmcommon.h>
# include <xf86drm.h>
# include <drm_fourcc.h>
# ifndef DRM_FORMAT_MOD_INVALID
# define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
@ -1470,8 +1469,6 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
{
VAAPIDevicePriv *priv;
VADisplay display = NULL;
const AVDictionaryEntry *ent;
int try_drm, try_x11, try_all;
priv = av_mallocz(sizeof(*priv));
if (!priv)
@ -1482,95 +1479,8 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
ctx->user_opaque = priv;
ctx->free = vaapi_device_free;
ent = av_dict_get(opts, "connection_type", NULL, 0);
if (ent) {
try_all = try_drm = try_x11 = 0;
if (!strcmp(ent->value, "drm")) {
try_drm = 1;
} else if (!strcmp(ent->value, "x11")) {
try_x11 = 1;
} else {
av_log(ctx, AV_LOG_ERROR, "Invalid connection type %s.\n",
ent->value);
return AVERROR(EINVAL);
}
} else {
try_all = 1;
try_drm = HAVE_VAAPI_DRM;
try_x11 = HAVE_VAAPI_X11;
}
#if HAVE_VAAPI_DRM
while (!display && try_drm) {
// If the device is specified, try to open it as a DRM device node.
// If not, look for a usable render node, possibly restricted to those
// using a specified kernel driver.
int loglevel = try_all ? AV_LOG_VERBOSE : AV_LOG_ERROR;
if (device) {
priv->drm_fd = open(device, O_RDWR);
if (priv->drm_fd < 0) {
av_log(ctx, loglevel, "Failed to open %s as "
"DRM device node.\n", device);
break;
}
} else {
char path[64];
int n, max_devices = 8;
#if CONFIG_LIBDRM
const AVDictionaryEntry *kernel_driver;
kernel_driver = av_dict_get(opts, "kernel_driver", NULL, 0);
#endif
for (n = 0; n < max_devices; n++) {
snprintf(path, sizeof(path),
"/dev/dri/renderD%d", 128 + n);
priv->drm_fd = open(path, O_RDWR);
if (priv->drm_fd < 0) {
av_log(ctx, AV_LOG_VERBOSE, "Cannot open "
"DRM render node for device %d.\n", n);
break;
}
#if CONFIG_LIBDRM
if (kernel_driver) {
drmVersion *info;
info = drmGetVersion(priv->drm_fd);
if (strcmp(kernel_driver->value, info->name)) {
av_log(ctx, AV_LOG_VERBOSE, "Ignoring device %d "
"with non-matching kernel driver (%s).\n",
n, info->name);
drmFreeVersion(info);
close(priv->drm_fd);
priv->drm_fd = -1;
continue;
}
av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
"DRM render node for device %d, "
"with matching kernel driver (%s).\n",
n, info->name);
drmFreeVersion(info);
} else
#endif
{
av_log(ctx, AV_LOG_VERBOSE, "Trying to use "
"DRM render node for device %d.\n", n);
}
break;
}
if (n >= max_devices)
break;
}
display = vaGetDisplayDRM(priv->drm_fd);
if (!display) {
av_log(ctx, AV_LOG_VERBOSE, "Cannot open a VA display "
"from DRM device %s.\n", device);
return AVERROR_EXTERNAL;
}
break;
}
#endif
#if HAVE_VAAPI_X11
if (!display && try_x11) {
if (!display && !(device && device[0] == '/')) {
// Try to open the device as an X11 display.
priv->x11_display = XOpenDisplay(device);
if (!priv->x11_display) {
@ -1590,31 +1500,34 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device,
}
#endif
#if HAVE_VAAPI_DRM
if (!display) {
if (device)
av_log(ctx, AV_LOG_ERROR, "No VA display found for "
"device %s.\n", device);
else
av_log(ctx, AV_LOG_ERROR, "No VA display found for "
"any default device.\n");
return AVERROR(EINVAL);
}
// Try to open the device as a DRM path.
// Default to using the first render node if the user did not
// supply a path.
const char *path = device ? device : "/dev/dri/renderD128";
priv->drm_fd = open(path, O_RDWR);
if (priv->drm_fd < 0) {
av_log(ctx, AV_LOG_VERBOSE, "Cannot open DRM device %s.\n",
path);
} else {
display = vaGetDisplayDRM(priv->drm_fd);
if (!display) {
av_log(ctx, AV_LOG_ERROR, "Cannot open a VA display "
"from DRM device %s.\n", path);
return AVERROR_UNKNOWN;
}
ent = av_dict_get(opts, "driver", NULL, 0);
if (ent) {
#if VA_CHECK_VERSION(0, 38, 0)
VAStatus vas;
vas = vaSetDriverName(display, ent->value);
if (vas != VA_STATUS_SUCCESS) {
av_log(ctx, AV_LOG_ERROR, "Failed to set driver name to "
"%s: %d (%s).\n", ent->value, vas, vaErrorStr(vas));
vaTerminate(display);
return AVERROR_EXTERNAL;
av_log(ctx, AV_LOG_VERBOSE, "Opened VA display via "
"DRM device %s.\n", path);
}
#else
av_log(ctx, AV_LOG_WARNING, "Driver name setting is not "
"supported with this VAAPI version.\n");
}
#endif
if (!display) {
av_log(ctx, AV_LOG_ERROR, "No VA display found for "
"device: %s.\n", device ? device : "");
return AVERROR(EINVAL);
}
return vaapi_device_connect(ctx, display);

View file

@ -73,10 +73,8 @@ static const VDPAUPixFmtMap pix_fmts_422[] = {
};
static const VDPAUPixFmtMap pix_fmts_444[] = {
#ifdef VDP_YCBCR_FORMAT_Y_U_V_444
{ VDP_YCBCR_FORMAT_Y_U_V_444, AV_PIX_FMT_YUV444P },
#endif
{ 0, AV_PIX_FMT_NONE, },
{ VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV444P },
{ 0, AV_PIX_FMT_NONE, },
};
static const struct {
@ -351,11 +349,7 @@ static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst,
return AVERROR(EINVAL);
}
if ((vdpau_format == VDP_YCBCR_FORMAT_YV12)
#ifdef VDP_YCBCR_FORMAT_Y_U_V_444
|| (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444)
#endif
)
if (vdpau_format == VDP_YCBCR_FORMAT_YV12)
FFSWAP(void*, data[1], data[2]);
err = priv->get_data(surf, vdpau_format, data, linesize);
@ -406,11 +400,7 @@ static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst,
return AVERROR(EINVAL);
}
if ((vdpau_format == VDP_YCBCR_FORMAT_YV12)
#ifdef VDP_YCBCR_FORMAT_Y_U_V_444
|| (vdpau_format == VDP_YCBCR_FORMAT_Y_U_V_444)
#endif
)
if (vdpau_format == VDP_YCBCR_FORMAT_YV12)
FFSWAP(const void*, data[1], data[2]);
err = priv->put_data(surf, vdpau_format, data, linesize);

View file

@ -42,9 +42,6 @@ static const struct {
#ifdef kCFCoreFoundationVersionNumber10_7
{ kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, AV_PIX_FMT_NV12 },
#endif
#if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
{ kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange, AV_PIX_FMT_P010 },
#endif
};
enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt)

View file

@ -311,8 +311,8 @@ static void image_copy_plane(uint8_t *dst, ptrdiff_t dst_linesize,
{
if (!dst || !src)
return;
av_assert0(FFABS(src_linesize) >= bytewidth);
av_assert0(FFABS(dst_linesize) >= bytewidth);
av_assert0(abs(src_linesize) >= bytewidth);
av_assert0(abs(dst_linesize) >= bytewidth);
for (;height > 0; height--) {
memcpy(dst, src, bytewidth);
dst += dst_linesize;

View file

@ -52,7 +52,7 @@
#endif
#ifndef emms_c
# define emms_c() do {} while(0)
# define emms_c() while(0)
#endif
#ifndef attribute_align_arg

View file

@ -542,21 +542,6 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
# define AV_WN64A(p, v) AV_WNA(64, p, v)
#endif
#if AV_HAVE_BIGENDIAN
# define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p))
# define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
#else
# define AV_RLA(s, p) AV_RN##s##A(p)
# define AV_WLA(s, p, v) AV_WN##s##A(p, v)
#endif
#ifndef AV_RL64A
# define AV_RL64A(p) AV_RLA(64, p)
#endif
#ifndef AV_WL64A
# define AV_WL64A(p, v) AV_WLA(64, p, v)
#endif
/*
* The AV_COPYxxU macros are suitable for copying data to/from unaligned
* memory locations.

View file

@ -24,6 +24,12 @@
#include <stdint.h>
/**
* Context structure for the Lagged Fibonacci PRNG.
* The exact layout, types and content of this struct may change and should
* not be accessed directly. Only its sizeof() is guranteed to stay the same
* to allow easy instanciation.
*/
typedef struct AVLFG {
unsigned int state[64];
int index;
@ -45,8 +51,9 @@ int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length);
* it may be good enough and faster for your specific use case.
*/
static inline unsigned int av_lfg_get(AVLFG *c){
c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
return c->state[c->index++ & 63];
unsigned a = c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
c->index += 1U;
return a;
}
/**
@ -57,7 +64,9 @@ static inline unsigned int av_lfg_get(AVLFG *c){
static inline unsigned int av_mlfg_get(AVLFG *c){
unsigned int a= c->state[(c->index-55) & 63];
unsigned int b= c->state[(c->index-24) & 63];
return c->state[c->index++ & 63] = 2*a*b+a+b;
a = c->state[c->index & 63] = 2*a*b+a+b;
c->index += 1U;
return a;
}
/**

View file

@ -363,10 +363,10 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
* @endcode
*
* @param[in,out] ptr Already allocated buffer, or `NULL`
* @param[in,out] size Pointer to the size of buffer `ptr`. `*size` is
* updated to the new allocated size, in particular 0
* in case of failure.
* @param[in] min_size Desired minimal size of buffer `ptr`
* @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is
* changed to `min_size` in case of success or 0 in
* case of failure
* @param[in] min_size New size of buffer `ptr`
* @return `ptr` if the buffer is large enough, a pointer to newly reallocated
* buffer if the buffer was not large enough, or `NULL` in case of
* error
@ -397,10 +397,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
* `*ptr` will be overwritten with pointer to new
* buffer on success or `NULL` on failure
* @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
* updated to the new allocated size, in particular 0
* in case of failure.
* @param[in] min_size Desired minimal size of buffer `*ptr`
* @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
* changed to `min_size` in case of success or 0 in
* case of failure
* @param[in] min_size New size of buffer `*ptr`
* @see av_realloc()
* @see av_fast_mallocz()
*/
@ -418,10 +418,10 @@ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
* @param[in,out] ptr Pointer to pointer to an already allocated buffer.
* `*ptr` will be overwritten with pointer to new
* buffer on success or `NULL` on failure
* @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is
* updated to the new allocated size, in particular 0
* in case of failure.
* @param[in] min_size Desired minimal size of buffer `*ptr`
* @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is
* changed to `min_size` in case of success or 0 in
* case of failure
* @param[in] min_size New size of buffer `*ptr`
* @see av_fast_malloc()
*/
void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);

View file

@ -504,7 +504,7 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
switch(c) {
case 'H':
case 'J':
val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, c == 'H' ? 2 : 4);
val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2);
if (val == -1)
return NULL;

View file

@ -2268,82 +2268,6 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.flags = AV_PIX_FMT_FLAG_FLOAT,
.alias = "yf32le",
},
[AV_PIX_FMT_YUVA422P12BE] = {
.name = "yuva422p12be",
.nb_components = 4,
.log2_chroma_w = 1,
.log2_chroma_h = 0,
.comp = {
{ 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
{ 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
{ 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
{ 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
},
.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA422P12LE] = {
.name = "yuva422p12le",
.nb_components = 4,
.log2_chroma_w = 1,
.log2_chroma_h = 0,
.comp = {
{ 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
{ 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
{ 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
{ 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
},
.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P12BE] = {
.name = "yuva444p12be",
.nb_components = 4,
.log2_chroma_w = 0,
.log2_chroma_h = 0,
.comp = {
{ 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
{ 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
{ 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
{ 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
},
.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_YUVA444P12LE] = {
.name = "yuva444p12le",
.nb_components = 4,
.log2_chroma_w = 0,
.log2_chroma_h = 0,
.comp = {
{ 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
{ 1, 2, 0, 0, 12, 1, 11, 1 }, /* U */
{ 2, 2, 0, 0, 12, 1, 11, 1 }, /* V */
{ 3, 2, 0, 0, 12, 1, 11, 1 }, /* A */
},
.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA,
},
[AV_PIX_FMT_NV24] = {
.name = "nv24",
.nb_components = 3,
.log2_chroma_w = 0,
.log2_chroma_h = 0,
.comp = {
{ 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
{ 1, 2, 0, 0, 8, 1, 7, 1 }, /* U */
{ 1, 2, 1, 0, 8, 1, 7, 2 }, /* V */
},
.flags = AV_PIX_FMT_FLAG_PLANAR,
},
[AV_PIX_FMT_NV42] = {
.name = "nv42",
.nb_components = 3,
.log2_chroma_w = 0,
.log2_chroma_h = 0,
.comp = {
{ 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */
{ 1, 2, 1, 0, 8, 1, 7, 2 }, /* U */
{ 1, 2, 0, 0, 8, 1, 7, 1 }, /* V */
},
.flags = AV_PIX_FMT_FLAG_PLANAR,
},
};
#if FF_API_PLUS1_MINUS1
FF_ENABLE_DEPRECATION_WARNINGS

View file

@ -340,14 +340,6 @@ enum AVPixelFormat {
AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian
AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian
AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
AV_PIX_FMT_NV42, ///< as above, but U and V bytes are swapped
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
};
@ -424,8 +416,6 @@ enum AVPixelFormat {
#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE)
#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE)
#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE)
#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE)
#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE)
#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE)
#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE)
#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE)

View file

@ -23,7 +23,7 @@
#include "config.h"
#if !HAVE_GMTIME_R && !defined(gmtime_r)
static inline struct tm *ff_gmtime_r(const time_t* clock, struct tm *result)
static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
{
struct tm *ptr = gmtime(clock);
if (!ptr)
@ -31,11 +31,10 @@ static inline struct tm *ff_gmtime_r(const time_t* clock, struct tm *result)
*result = *ptr;
return result;
}
#define gmtime_r ff_gmtime_r
#endif
#if !HAVE_LOCALTIME_R && !defined(localtime_r)
static inline struct tm *ff_localtime_r(const time_t* clock, struct tm *result)
static inline struct tm *localtime_r(const time_t* clock, struct tm *result)
{
struct tm *ptr = localtime(clock);
if (!ptr)
@ -43,7 +42,6 @@ static inline struct tm *ff_localtime_r(const time_t* clock, struct tm *result)
*result = *ptr;
return result;
}
#define localtime_r ff_localtime_r
#endif
#endif /* AVUTIL_TIME_INTERNAL_H */

View file

@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 56
#define LIBAVUTIL_VERSION_MINOR 31
#define LIBAVUTIL_VERSION_MINOR 22
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \