]> granicus.if.org Git - libvpx/commitdiff
Make generic SIMD code compile if no native support
authorSteinar Midtskogen <stemidts@cisco.com>
Mon, 26 Sep 2016 19:05:51 +0000 (21:05 +0200)
committerYaowu Xu <yaowu@google.com>
Tue, 11 Oct 2016 19:36:16 +0000 (12:36 -0700)
Change-Id: I7f691a0ae27f06ef3d727764829a60a8ffc509eb

aom_dsp/aom_dsp.mk
aom_dsp/aom_simd.c [new file with mode: 0644]
aom_dsp/simd/v128_intrinsics_c.h

index 0d0dc94738407f2eec36bd1157a4ea3d77c2f351..2adbef16ca01aba6f902eeeb7fda55dbcef96d95 100644 (file)
@@ -376,4 +376,6 @@ DSP_SRCS-no += $(DSP_SRCS_REMOVE-yes)
 DSP_SRCS-yes += aom_dsp_rtcd.c
 DSP_SRCS-yes += aom_dsp_rtcd_defs.pl
 
+DSP_SRCS-yes += aom_simd.c
+
 $(eval $(call rtcd_h_template,aom_dsp_rtcd,aom_dsp/aom_dsp_rtcd_defs.pl))
diff --git a/aom_dsp/aom_simd.c b/aom_dsp/aom_simd.c
new file mode 100644 (file)
index 0000000..03f4ba9
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * 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.
+ */
+
+// Set to 1 to add some sanity checks in the fallback C code
+const int simd_check = 1;
index 561ac86e21320958c4a1850fd0fbbc1c46949a1d..34e312ec45bca1baf10a49efdbcee640e3a30df6 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "./v64_intrinsics_c.h"
+#include "./aom_config.h"
 
 typedef union {
   uint8_t u8[16];
@@ -406,11 +407,13 @@ SIMD_INLINE c_v128 _c_v128_unzip_8(c_v128 a, c_v128 b, int mode) {
 }
 
 SIMD_INLINE c_v128 c_v128_unziplo_8(c_v128 a, c_v128 b) {
-  return big_endian() ? _c_v128_unzip_8(a, b, 1) : _c_v128_unzip_8(a, b, 0);
+  return CONFIG_BIG_ENDIAN ? _c_v128_unzip_8(a, b, 1)
+                           : _c_v128_unzip_8(a, b, 0);
 }
 
 SIMD_INLINE c_v128 c_v128_unziphi_8(c_v128 a, c_v128 b) {
-  return big_endian() ? _c_v128_unzip_8(b, a, 0) : _c_v128_unzip_8(b, a, 1);
+  return CONFIG_BIG_ENDIAN ? _c_v128_unzip_8(b, a, 0)
+                           : _c_v128_unzip_8(b, a, 1);
 }
 
 SIMD_INLINE c_v128 _c_v128_unzip_16(c_v128 a, c_v128 b, int mode) {
@@ -438,11 +441,13 @@ SIMD_INLINE c_v128 _c_v128_unzip_16(c_v128 a, c_v128 b, int mode) {
 }
 
 SIMD_INLINE c_v128 c_v128_unziplo_16(c_v128 a, c_v128 b) {
-  return big_endian() ? _c_v128_unzip_16(a, b, 1) : _c_v128_unzip_16(a, b, 0);
+  return CONFIG_BIG_ENDIAN ? _c_v128_unzip_16(a, b, 1)
+                           : _c_v128_unzip_16(a, b, 0);
 }
 
 SIMD_INLINE c_v128 c_v128_unziphi_16(c_v128 a, c_v128 b) {
-  return big_endian() ? _c_v128_unzip_16(b, a, 0) : _c_v128_unzip_16(b, a, 1);
+  return CONFIG_BIG_ENDIAN ? _c_v128_unzip_16(b, a, 0)
+                           : _c_v128_unzip_16(b, a, 1);
 }
 
 SIMD_INLINE c_v128 _c_v128_unzip_32(c_v128 a, c_v128 b, int mode) {
@@ -462,11 +467,13 @@ SIMD_INLINE c_v128 _c_v128_unzip_32(c_v128 a, c_v128 b, int mode) {
 }
 
 SIMD_INLINE c_v128 c_v128_unziplo_32(c_v128 a, c_v128 b) {
-  return big_endian() ? _c_v128_unzip_32(a, b, 1) : _c_v128_unzip_32(a, b, 0);
+  return CONFIG_BIG_ENDIAN ? _c_v128_unzip_32(a, b, 1)
+                           : _c_v128_unzip_32(a, b, 0);
 }
 
 SIMD_INLINE c_v128 c_v128_unziphi_32(c_v128 a, c_v128 b) {
-  return big_endian() ? _c_v128_unzip_32(b, a, 0) : _c_v128_unzip_32(b, a, 1);
+  return CONFIG_BIG_ENDIAN ? _c_v128_unzip_32(b, a, 0)
+                           : _c_v128_unzip_32(b, a, 1);
 }
 
 SIMD_INLINE c_v128 c_v128_unpack_u8_s16(c_v64 a) {
@@ -535,8 +542,8 @@ SIMD_INLINE c_v128 c_v128_shuffle_8(c_v128 a, c_v128 pattern) {
               c);
       abort();
     }
-    t.u8[c] =
-        a.u8[big_endian() ? 15 - (pattern.u8[c] & 15) : pattern.u8[c] & 15];
+    t.u8[c] = a.u8[CONFIG_BIG_ENDIAN ? 15 - (pattern.u8[c] & 15)
+                                     : pattern.u8[c] & 15];
   }
   return t;
 }