summaryrefslogtreecommitdiffstats
path: root/third_party/aom/aom_ports
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/aom/aom_ports')
-rw-r--r--third_party/aom/aom_ports/aom_once.h2
-rw-r--r--third_party/aom/aom_ports/aom_ports.cmake103
-rw-r--r--third_party/aom/aom_ports/aom_ports.mk29
-rw-r--r--third_party/aom/aom_ports/aom_timer.h4
-rw-r--r--third_party/aom/aom_ports/arm.h3
-rw-r--r--third_party/aom/aom_ports/arm_cpudetect.c18
-rw-r--r--third_party/aom/aom_ports/mem.h4
-rw-r--r--third_party/aom/aom_ports/mem_ops.h1
-rw-r--r--third_party/aom/aom_ports/mem_ops_aligned.h3
-rw-r--r--third_party/aom/aom_ports/msvc.h12
-rw-r--r--third_party/aom/aom_ports/ppc.h (renamed from third_party/aom/aom_ports/config.h)23
-rw-r--r--third_party/aom/aom_ports/ppc_cpudetect.c82
-rw-r--r--third_party/aom/aom_ports/sanitizer.h38
-rw-r--r--third_party/aom/aom_ports/system_state.h2
-rw-r--r--third_party/aom/aom_ports/x86.h5
-rw-r--r--third_party/aom/aom_ports/x86_abi_support.asm2
16 files changed, 230 insertions, 101 deletions
diff --git a/third_party/aom/aom_ports/aom_once.h b/third_party/aom/aom_ports/aom_once.h
index 3cfd2fd95..bb1e21366 100644
--- a/third_party/aom/aom_ports/aom_once.h
+++ b/third_party/aom/aom_ports/aom_once.h
@@ -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.
diff --git a/third_party/aom/aom_ports/aom_ports.cmake b/third_party/aom/aom_ports/aom_ports.cmake
index e1ffb56f5..6272fc0e3 100644
--- a/third_party/aom/aom_ports/aom_ports.cmake
+++ b/third_party/aom/aom_ports/aom_ports.cmake
@@ -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()
diff --git a/third_party/aom/aom_ports/aom_ports.mk b/third_party/aom/aom_ports/aom_ports.mk
deleted file mode 100644
index 1f18f6bd1..000000000
--- a/third_party/aom/aom_ports/aom_ports.mk
+++ /dev/null
@@ -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
diff --git a/third_party/aom/aom_ports/aom_timer.h b/third_party/aom/aom_ports/aom_timer.h
index 904f2fe51..c719ec677 100644
--- a/third_party/aom/aom_ports/aom_timer.h
+++ b/third_party/aom/aom_ports/aom_timer.h
@@ -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
}
diff --git a/third_party/aom/aom_ports/arm.h b/third_party/aom/aom_ports/arm.h
index 448a70dcc..a1a2ab765 100644
--- a/third_party/aom/aom_ports/arm.h
+++ b/third_party/aom/aom_ports/arm.h
@@ -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" {
diff --git a/third_party/aom/aom_ports/arm_cpudetect.c b/third_party/aom/aom_ports/arm_cpudetect.c
index 4dd1a1a62..70efee996 100644
--- a/third_party/aom/aom_ports/arm_cpudetect.c
+++ b/third_party/aom/aom_ports/arm_cpudetect.c
@@ -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);
}
diff --git a/third_party/aom/aom_ports/mem.h b/third_party/aom/aom_ports/mem.h
index 500e397c6..0793d82e4 100644
--- a/third_party/aom/aom_ports/mem.h
+++ b/third_party/aom/aom_ports/mem.h
@@ -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))
diff --git a/third_party/aom/aom_ports/mem_ops.h b/third_party/aom/aom_ports/mem_ops.h
index 62126755c..ef0ee17ee 100644
--- a/third_party/aom/aom_ports/mem_ops.h
+++ b/third_party/aom/aom_ports/mem_ops.h
@@ -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_
diff --git a/third_party/aom/aom_ports/mem_ops_aligned.h b/third_party/aom/aom_ports/mem_ops_aligned.h
index 8c3ab1cb1..81fe41a63 100644
--- a/third_party/aom/aom_ports/mem_ops_aligned.h
+++ b/third_party/aom/aom_ports/mem_ops_aligned.h
@@ -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)
diff --git a/third_party/aom/aom_ports/msvc.h b/third_party/aom/aom_ports/msvc.h
index 5a41d29d2..7d2b54028 100644
--- a/third_party/aom/aom_ports/msvc.h
+++ b/third_party/aom/aom_ports/msvc.h
@@ -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_
diff --git a/third_party/aom/aom_ports/config.h b/third_party/aom/aom_ports/ppc.h
index 462ec66fb..ec487c2bc 100644
--- a/third_party/aom/aom_ports/config.h
+++ b/third_party/aom/aom_ports/ppc.h
@@ -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_
diff --git a/third_party/aom/aom_ports/ppc_cpudetect.c b/third_party/aom/aom_ports/ppc_cpudetect.c
new file mode 100644
index 000000000..82b4f58cc
--- /dev/null
+++ b/third_party/aom/aom_ports/ppc_cpudetect.c
@@ -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
diff --git a/third_party/aom/aom_ports/sanitizer.h b/third_party/aom/aom_ports/sanitizer.h
new file mode 100644
index 000000000..d4e197e2f
--- /dev/null
+++ b/third_party/aom/aom_ports/sanitizer.h
@@ -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_
diff --git a/third_party/aom/aom_ports/system_state.h b/third_party/aom/aom_ports/system_state.h
index 5d40d4cb8..0f2c3d8b5 100644
--- a/third_party/aom/aom_ports/system_state.h
+++ b/third_party/aom/aom_ports/system_state.h
@@ -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);
diff --git a/third_party/aom/aom_ports/x86.h b/third_party/aom/aom_ports/x86.h
index e5680ca93..b642a57f7 100644
--- a/third_party/aom/aom_ports/x86.h
+++ b/third_party/aom/aom_ports/x86.h
@@ -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) {
diff --git a/third_party/aom/aom_ports/x86_abi_support.asm b/third_party/aom/aom_ports/x86_abi_support.asm
index 6aeee60a0..0e7c26287 100644
--- a/third_party/aom/aom_ports/x86_abi_support.asm
+++ b/third_party/aom/aom_ports/x86_abi_support.asm
@@ -12,7 +12,7 @@
;
-%include "aom_config.asm"
+%include "config/aom_config.asm"
; 32/64 bit compatibility macros
;