Update aom to v1.0.0

Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
This commit is contained in:
trav90 2018-10-19 21:52:15 -05:00 • committed by Roy Tam
commit 48f6d2e034
1087 changed files with 154333 additions and 265310 deletions

View file

@ -12,7 +12,7 @@
#ifndef AOM_PORTS_AOM_ONCE_H_
#define AOM_PORTS_AOM_ONCE_H_
#include "aom_config.h"
#include "config/aom_config.h"
/* Implement a function wrapper to guarantee initialization
* thread-safety for library singletons.

View file

@ -1,70 +1,81 @@
##
## Copyright (c) 2017, Alliance for Open Media. All rights reserved
##
## This source code is subject to the terms of the BSD 2 Clause License and
## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
## was not distributed with this source code in the LICENSE file, you can
## obtain it at www.aomedia.org/license/software. If the Alliance for Open
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
if (NOT AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
#
# Copyright (c) 2017, Alliance for Open Media. All rights reserved
#
# This source code is subject to the terms of the BSD 2 Clause License and the
# Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was
# not distributed with this source code in the LICENSE file, you can obtain it
# at www.aomedia.org/license/software. If the Alliance for Open Media Patent
# License 1.0 was not distributed with this source code in the PATENTS file, you
# can obtain it at www.aomedia.org/license/patent.
#
if(AOM_AOM_PORTS_AOM_PORTS_CMAKE_)
return()
endif() # AOM_AOM_PORTS_AOM_PORTS_CMAKE_
set(AOM_AOM_PORTS_AOM_PORTS_CMAKE_ 1)
set(AOM_PORTS_INCLUDES
"${AOM_ROOT}/aom_ports/aom_once.h"
"${AOM_ROOT}/aom_ports/aom_timer.h"
"${AOM_ROOT}/aom_ports/bitops.h"
"${AOM_ROOT}/aom_ports/emmintrin_compat.h"
"${AOM_ROOT}/aom_ports/mem.h"
"${AOM_ROOT}/aom_ports/mem_ops.h"
"${AOM_ROOT}/aom_ports/mem_ops_aligned.h"
"${AOM_ROOT}/aom_ports/msvc.h"
"${AOM_ROOT}/aom_ports/system_state.h")
list(APPEND AOM_PORTS_INCLUDES
"${AOM_ROOT}/aom_ports/aom_once.h"
"${AOM_ROOT}/aom_ports/aom_timer.h"
"${AOM_ROOT}/aom_ports/bitops.h"
"${AOM_ROOT}/aom_ports/emmintrin_compat.h"
"${AOM_ROOT}/aom_ports/mem.h"
"${AOM_ROOT}/aom_ports/mem_ops.h"
"${AOM_ROOT}/aom_ports/mem_ops_aligned.h"
"${AOM_ROOT}/aom_ports/msvc.h"
"${AOM_ROOT}/aom_ports/sanitizer.h"
"${AOM_ROOT}/aom_ports/system_state.h")
set(AOM_PORTS_ASM_X86 "${AOM_ROOT}/aom_ports/emms.asm")
list(APPEND AOM_PORTS_ASM_X86 "${AOM_ROOT}/aom_ports/emms.asm")
set(AOM_PORTS_INCLUDES_X86
"${AOM_ROOT}/aom_ports/x86_abi_support.asm")
list(APPEND AOM_PORTS_INCLUDES_X86 "${AOM_ROOT}/aom_ports/x86_abi_support.asm")
set(AOM_PORTS_SOURCES_ARM
"${AOM_ROOT}/aom_ports/arm.h"
"${AOM_ROOT}/aom_ports/arm_cpudetect.c")
list(APPEND AOM_PORTS_SOURCES_ARM "${AOM_ROOT}/aom_ports/arm.h"
"${AOM_ROOT}/aom_ports/arm_cpudetect.c")
list(APPEND AOM_PORTS_SOURCES_PPC "${AOM_ROOT}/aom_ports/ppc.h"
"${AOM_ROOT}/aom_ports/ppc_cpudetect.c")
# For arm and x86 targets:
# Creates the aom_ports build target, adds the includes in aom_ports to the
#
# * Creates the aom_ports build target, adds the includes in aom_ports to the
# target, and makes libaom depend on it.
#
# Otherwise:
# Adds the includes in aom_ports to the libaom target.
#
# * Adds the includes in aom_ports to the libaom target.
#
# For all target platforms:
# The libaom target must exist before this function is called.
function (setup_aom_ports_targets)
if ("${AOM_TARGET_CPU}" MATCHES "^x86")
#
# * The libaom target must exist before this function is called.
function(setup_aom_ports_targets)
if("${AOM_TARGET_CPU}" MATCHES "^x86")
add_asm_library("aom_ports" "AOM_PORTS_ASM_X86" "aom")
set(aom_ports_has_symbols 1)
elseif ("${AOM_TARGET_CPU}" MATCHES "arm")
elseif("${AOM_TARGET_CPU}" MATCHES "arm")
add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_ARM})
set(aom_ports_has_symbols 1)
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_ports>)
endif ()
elseif("${AOM_TARGET_CPU}" MATCHES "ppc")
add_library(aom_ports OBJECT ${AOM_PORTS_SOURCES_PPC})
set(aom_ports_has_symbols 1)
target_sources(aom PRIVATE $<TARGET_OBJECTS:aom_ports>)
endif()
if (aom_ports_has_symbols)
if(aom_ports_has_symbols)
target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES})
if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR
"${AOM_TARGET_CPU}" STREQUAL "x86_64")
if("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL
"x86_64")
target_sources(aom_ports PRIVATE ${AOM_PORTS_INCLUDES_X86})
endif ()
endif()
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} PARENT_SCOPE)
else ()
else()
target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES})
if ("${AOM_TARGET_CPU}" STREQUAL "x86" OR
"${AOM_TARGET_CPU}" STREQUAL "x86_64")
if("${AOM_TARGET_CPU}" STREQUAL "x86" OR "${AOM_TARGET_CPU}" STREQUAL
"x86_64")
target_sources(aom PRIVATE ${AOM_PORTS_INCLUDES_X86})
endif ()
endif ()
endfunction ()
endif () # AOM_AOM_PORTS_AOM_PORTS_CMAKE_
endif()
endif()
endfunction()

View file

@ -1,29 +0,0 @@
##
## Copyright (c) 2016, Alliance for Open Media. All rights reserved
##
## This source code is subject to the terms of the BSD 2 Clause License and
## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
## was not distributed with this source code in the LICENSE file, you can
## obtain it at www.aomedia.org/license/software. If the Alliance for Open
## Media Patent License 1.0 was not distributed with this source code in the
## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
##
PORTS_SRCS-yes += aom_ports.mk
PORTS_SRCS-yes += bitops.h
PORTS_SRCS-yes += mem.h
PORTS_SRCS-yes += msvc.h
PORTS_SRCS-yes += system_state.h
PORTS_SRCS-yes += aom_timer.h
ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
PORTS_SRCS-yes += emms.asm
PORTS_SRCS-yes += x86.h
PORTS_SRCS-yes += x86_abi_support.asm
endif
PORTS_SRCS-$(ARCH_ARM) += arm_cpudetect.c
PORTS_SRCS-$(ARCH_ARM) += arm.h

View file

@ -12,7 +12,7 @@
#ifndef AOM_PORTS_AOM_TIMER_H_
#define AOM_PORTS_AOM_TIMER_H_
#include "./aom_config.h"
#include "config/aom_config.h"
#include "aom/aom_integer.h"
@ -82,7 +82,7 @@ static INLINE int64_t aom_usec_timer_elapsed(struct aom_usec_timer *t) {
struct timeval diff;
timersub(&t->end, &t->begin, &diff);
return diff.tv_sec * 1000000 + diff.tv_usec;
return ((int64_t)diff.tv_sec) * 1000000 + diff.tv_usec;
#endif
}

View file

@ -12,7 +12,8 @@
#ifndef AOM_PORTS_ARM_H_
#define AOM_PORTS_ARM_H_
#include <stdlib.h>
#include "aom_config.h"
#include "config/aom_config.h"
#ifdef __cplusplus
extern "C" {

View file

@ -12,7 +12,7 @@
#include <stdlib.h>
#include <string.h>
#include "aom_ports/arm.h"
#include "./aom_config.h"
#include "config/aom_config.h"
#ifdef WINAPI_FAMILY
#include <winapifamily.h>
@ -50,9 +50,9 @@ int arm_cpu_caps(void) {
return flags;
}
mask = arm_cpu_env_mask();
#if HAVE_NEON || HAVE_NEON_ASM
#if HAVE_NEON
flags |= HAS_NEON;
#endif /* HAVE_NEON || HAVE_NEON_ASM */
#endif /* HAVE_NEON */
return flags & mask;
}
@ -73,7 +73,7 @@ int arm_cpu_caps(void) {
* instructions via their assembled hex code.
* All of these instructions should be essentially nops.
*/
#if HAVE_NEON || HAVE_NEON_ASM
#if HAVE_NEON
if (mask & HAS_NEON) {
__try {
/*VORR q0,q0,q0*/
@ -83,7 +83,7 @@ int arm_cpu_caps(void) {
/*Ignore exception.*/
}
}
#endif /* HAVE_NEON || HAVE_NEON_ASM */
#endif /* HAVE_NEON */
return flags & mask;
}
@ -100,9 +100,9 @@ int arm_cpu_caps(void) {
mask = arm_cpu_env_mask();
features = android_getCpuFeatures();
#if HAVE_NEON || HAVE_NEON_ASM
#if HAVE_NEON
if (features & ANDROID_CPU_ARM_FEATURE_NEON) flags |= HAS_NEON;
#endif /* HAVE_NEON || HAVE_NEON_ASM */
#endif /* HAVE_NEON */
return flags & mask;
}
@ -129,7 +129,7 @@ int arm_cpu_caps(void) {
*/
char buf[512];
while (fgets(buf, 511, fin) != NULL) {
#if HAVE_NEON || HAVE_NEON_ASM
#if HAVE_NEON
if (memcmp(buf, "Features", 8) == 0) {
char *p;
p = strstr(buf, " neon");
@ -137,7 +137,7 @@ int arm_cpu_caps(void) {
flags |= HAS_NEON;
}
}
#endif /* HAVE_NEON || HAVE_NEON_ASM */
#endif /* HAVE_NEON */
}
fclose(fin);
}

View file

@ -12,8 +12,8 @@
#ifndef AOM_PORTS_MEM_H_
#define AOM_PORTS_MEM_H_
#include "aom_config.h"
#include "aom/aom_integer.h"
#include "config/aom_config.h"
#if (defined(__GNUC__) && __GNUC__) || defined(__SUNPRO_C)
#define DECLARE_ALIGNED(n, typ, val) typ val __attribute__((aligned(n)))
@ -61,6 +61,8 @@
#define ALIGN_POWER_OF_TWO(value, n) \
(((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
#define DIVIDE_AND_ROUND(x, y) (((x) + ((y) >> 1)) / (y))
#define CONVERT_TO_SHORTPTR(x) ((uint16_t *)(((uintptr_t)(x)) << 1))
#define CONVERT_TO_BYTEPTR(x) ((uint8_t *)(((uintptr_t)(x)) >> 1))

View file

@ -225,5 +225,4 @@ static AOM_INLINE void mem_put_le32(void *vmem, MEM_VALUE_T val) {
mem[3] = (MAU_T)((val >> 24) & 0xff);
}
/* clang-format on */
#endif // AOM_PORTS_MEM_OPS_H_

View file

@ -91,7 +91,8 @@
*mem = (uint##sz##_t)raw; \
}
#include "aom_config.h"
#include "config/aom_config.h"
#if CONFIG_BIG_ENDIAN
#define mem_get_be_aligned_generic(sz) mem_get_ne_aligned_generic(be, sz)
#define mem_get_sbe_aligned_generic(sz) mem_get_sne_aligned_generic(be, sz)

View file

@ -13,7 +13,7 @@
#define AOM_PORTS_MSVC_H_
#ifdef _MSC_VER
#include "./aom_config.h"
#include "config/aom_config.h"
#if _MSC_VER < 1900 // VS2015 provides snprintf
#define snprintf _snprintf
@ -60,8 +60,16 @@ static INLINE long lroundf(float x) {
a, \
_mm_insert_epi16(_mm256_extractf128_si256(a, indx >> 3), d, indx % 8), \
indx >> 3)
static INLINE int _mm256_extract_epi32(__m256i a, const int i) {
return a.m256i_i32[i & 7];
}
static INLINE __m256i _mm256_insert_epi32(__m256i a, int b, const int i) {
__m256i c = a;
c.m256i_i32[i & 7] = b;
return c;
}
#endif // _MSC_VER <= 1900
#endif // HAVE_AVX
#endif // _MSC_VER
#endif // AOM_PORTS_MSVC_H_

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
@ -9,9 +9,22 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_PORTS_CONFIG_H_
#define AOM_PORTS_CONFIG_H_
#ifndef AOM_PORTS_PPC_H_
#define AOM_PORTS_PPC_H_
#include <stdlib.h>
#include "aom_config.h"
#include "config/aom_config.h"
#endif // AOM_PORTS_CONFIG_H_
#ifdef __cplusplus
extern "C" {
#endif
#define HAS_VSX 0x01
int ppc_simd_caps(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // AOM_PORTS_PPC_H_

View file

@ -0,0 +1,82 @@
/*
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <asm/cputable.h>
#include <linux/auxvec.h>
#include "config/aom_config.h"
#include "aom_ports/ppc.h"
#if CONFIG_RUNTIME_CPU_DETECT
static int cpu_env_flags(int *flags) {
char *env;
env = getenv("AOM_SIMD_CAPS");
if (env && *env) {
*flags = (int)strtol(env, NULL, 0);
return 0;
}
*flags = 0;
return -1;
}
static int cpu_env_mask(void) {
char *env;
env = getenv("AOM_SIMD_CAPS_MASK");
return env && *env ? (int)strtol(env, NULL, 0) : ~0;
}
int ppc_simd_caps(void) {
int flags;
int mask;
int fd;
ssize_t count;
unsigned int i;
uint64_t buf[64];
// If VPX_SIMD_CAPS is set then allow only those capabilities.
if (!cpu_env_flags(&flags)) {
return flags;
}
mask = cpu_env_mask();
fd = open("/proc/self/auxv", O_RDONLY);
if (fd < 0) {
return 0;
}
while ((count = read(fd, buf, sizeof(buf))) > 0) {
for (i = 0; i < (count / sizeof(*buf)); i += 2) {
if (buf[i] == AT_HWCAP) {
#if HAVE_VSX
if (buf[i + 1] & PPC_FEATURE_HAS_VSX) {
flags |= HAS_VSX;
}
#endif // HAVE_VSX
goto out_close;
} else if (buf[i] == AT_NULL) {
goto out_close;
}
}
}
out_close:
close(fd);
return flags & mask;
}
#else
// If there is no RTCD the function pointers are not used and can not be
// changed.
int ppc_simd_caps(void) { return 0; }
#endif // CONFIG_RUNTIME_CPU_DETECT

38
third_party/aom/aom_ports/sanitizer.h vendored Normal file
View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2018, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#ifndef AOM_PORTS_SANITIZER_H_
#define AOM_PORTS_SANITIZER_H_
// AddressSanitizer support.
// Define AOM_ADDRESS_SANITIZER if AddressSanitizer is used.
// Clang.
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define AOM_ADDRESS_SANITIZER 1
#endif
#endif // defined(__has_feature)
// GCC.
#if defined(__SANITIZE_ADDRESS__)
#define AOM_ADDRESS_SANITIZER 1
#endif // defined(__SANITIZE_ADDRESS__)
// Define the macros for AddressSanitizer manual memory poisoning. See
// https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning.
#if defined(AOM_ADDRESS_SANITIZER)
#include <sanitizer/asan_interface.h>
#else
#define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
#define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
#endif
#endif // AOM_PORTS_SANITIZER_H_

View file

@ -12,7 +12,7 @@
#ifndef AOM_PORTS_SYSTEM_STATE_H_
#define AOM_PORTS_SYSTEM_STATE_H_
#include "./aom_config.h"
#include "config/aom_config.h"
#if ARCH_X86 || ARCH_X86_64
void aom_reset_mmx_state(void);

View file

@ -17,8 +17,8 @@
#include <intrin.h> /* For __cpuidex, __rdtsc */
#endif
#include "aom_config.h"
#include "aom/aom_integer.h"
#include "config/aom_config.h"
#ifdef __cplusplus
extern "C" {
@ -162,6 +162,7 @@ static INLINE uint64_t xgetbv(void) {
#define HAS_SSE4_1 0x20
#define HAS_AVX 0x40
#define HAS_AVX2 0x80
#define HAS_SSE4_2 0x100
#ifndef BIT
#define BIT(n) (1 << n)
#endif
@ -202,6 +203,8 @@ static INLINE int x86_simd_caps(void) {
if (reg_ecx & BIT(19)) flags |= HAS_SSE4_1;
if (reg_ecx & BIT(20)) flags |= HAS_SSE4_2;
// bits 27 (OSXSAVE) & 28 (256-bit AVX)
if ((reg_ecx & (BIT(27) | BIT(28))) == (BIT(27) | BIT(28))) {
if ((xgetbv() & 0x6) == 0x6) {

View file

@ -12,7 +12,7 @@
;
%include "aom_config.asm"
%include "config/aom_config.asm"
; 32/64 bit compatibility macros
;