diff --git a/README.chromium b/README.chromium index 252614510..f4aa928b8 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1615 +Version: 1616 License: BSD License File: LICENSE diff --git a/include/libyuv/row.h b/include/libyuv/row.h index f7b09b108..013a7e53e 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -373,8 +373,11 @@ extern "C" { #endif #if defined(_MSC_VER) && !defined(__CLR_VER) && !defined(__clang__) +#if defined(VISUALC_HAS_AVX2) +#define SIMD_ALIGNED(var) __declspec(align(32)) var +#else #define SIMD_ALIGNED(var) __declspec(align(16)) var -#define SIMD_ALIGNED32(var) __declspec(align(32)) var +#endif typedef __declspec(align(16)) int16 vec16[8]; typedef __declspec(align(16)) int32 vec32[4]; typedef __declspec(align(16)) int8 vec8[16]; @@ -389,8 +392,11 @@ typedef __declspec(align(32)) uint32 ulvec32[8]; typedef __declspec(align(32)) uint8 ulvec8[32]; #elif !defined(__pnacl__) && (defined(__GNUC__) || defined(__clang__)) // Caveat GCC 4.2 to 4.7 have a known issue using vectors with const. +#if defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2) +#define SIMD_ALIGNED(var) var __attribute__((aligned(32))) +#else #define SIMD_ALIGNED(var) var __attribute__((aligned(16))) -#define SIMD_ALIGNED32(var) var __attribute__((aligned(32))) +#endif typedef int16 __attribute__((vector_size(16))) vec16; typedef int32 __attribute__((vector_size(16))) vec32; typedef int8 __attribute__((vector_size(16))) vec8; @@ -405,7 +411,6 @@ typedef uint32 __attribute__((vector_size(32))) ulvec32; typedef uint8 __attribute__((vector_size(32))) ulvec8; #else #define SIMD_ALIGNED(var) var -#define SIMD_ALIGNED32(var) var typedef int16 vec16[8]; typedef int32 vec32[4]; typedef int8 vec8[16]; @@ -461,14 +466,14 @@ struct YuvConstants { #endif // Conversion matrix for YUV to RGB -extern const struct YuvConstants kYuvI601Constants; // BT.601 -extern const struct YuvConstants kYuvJPEGConstants; // JPeg color space -extern const struct YuvConstants kYuvH709Constants; // BT.709 +extern const struct YuvConstants SIMD_ALIGNED(kYuvI601Constants); // BT.601 +extern const struct YuvConstants SIMD_ALIGNED(kYuvJPEGConstants); // JPeg +extern const struct YuvConstants SIMD_ALIGNED(kYuvH709Constants); // BT.709 // Conversion matrix for YVU to BGR -extern const struct YuvConstants kYvuI601Constants; // BT.601 -extern const struct YuvConstants kYvuJPEGConstants; // JPeg color space -extern const struct YuvConstants kYvuH709Constants; // BT.709 +extern const struct YuvConstants SIMD_ALIGNED(kYvuI601Constants); // BT.601 +extern const struct YuvConstants SIMD_ALIGNED(kYvuJPEGConstants); // JPeg +extern const struct YuvConstants SIMD_ALIGNED(kYvuH709Constants); // BT.709 #if defined(__APPLE__) || defined(__x86_64__) || defined(__llvm__) #define OMITFP diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 18b481c2d..0fbdc022d 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1615 +#define LIBYUV_VERSION 1616 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/row_common.cc b/source/row_common.cc index 229da9752..aefa38c49 100644 --- a/source/row_common.cc +++ b/source/row_common.cc @@ -1019,7 +1019,7 @@ const struct YuvConstants SIMD_ALIGNED(kYvuI601Constants) = { { 0x0101 * YG, 0, 0, 0 } }; #else -const struct YuvConstants SIMD_ALIGNED32(kYuvI601Constants) = { +const struct YuvConstants SIMD_ALIGNED(kYuvI601Constants) = { { UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0 }, { UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, @@ -1031,7 +1031,7 @@ const struct YuvConstants SIMD_ALIGNED32(kYuvI601Constants) = { { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } }; -const struct YuvConstants SIMD_ALIGNED32(kYvuI601Constants) = { +const struct YuvConstants SIMD_ALIGNED(kYvuI601Constants) = { { VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0 }, { VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, @@ -1106,7 +1106,7 @@ const struct YuvConstants SIMD_ALIGNED(kYvuJPEGConstants) = { { 0x0101 * YG, 0, 0, 0 } }; #else -const struct YuvConstants SIMD_ALIGNED32(kYuvJPEGConstants) = { +const struct YuvConstants SIMD_ALIGNED(kYuvJPEGConstants) = { { UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0 }, { UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, @@ -1118,7 +1118,7 @@ const struct YuvConstants SIMD_ALIGNED32(kYuvJPEGConstants) = { { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } }; -const struct YuvConstants SIMD_ALIGNED32(kYvuJPEGConstants) = { +const struct YuvConstants SIMD_ALIGNED(kYvuJPEGConstants) = { { VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0 }, { VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, @@ -1194,7 +1194,7 @@ const struct YuvConstants SIMD_ALIGNED(kYvuH709Constants) = { { 0x0101 * YG, 0, 0, 0 } }; #else -const struct YuvConstants SIMD_ALIGNED32(kYuvH709Constants) = { +const struct YuvConstants SIMD_ALIGNED(kYuvH709Constants) = { { UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0, UB, 0 }, { UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, @@ -1206,7 +1206,7 @@ const struct YuvConstants SIMD_ALIGNED32(kYuvH709Constants) = { { BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR, BR }, { YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG, YG } }; -const struct YuvConstants SIMD_ALIGNED32(kYvuH709Constants) = { +const struct YuvConstants SIMD_ALIGNED(kYvuH709Constants) = { { VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0, VR, 0 }, { VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, VG, UG, @@ -2504,7 +2504,7 @@ void I422ToRGB565Row_AVX2(const uint8* src_y, uint8* dst_rgb565, const struct YuvConstants* yuvconstants, int width) { - SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); + SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); while (width > 0) { int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); @@ -2530,7 +2530,7 @@ void I422ToARGB1555Row_AVX2(const uint8* src_y, const struct YuvConstants* yuvconstants, int width) { // Row buffer for intermediate ARGB pixels. - SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); + SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); while (width > 0) { int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); @@ -2556,7 +2556,7 @@ void I422ToARGB4444Row_AVX2(const uint8* src_y, const struct YuvConstants* yuvconstants, int width) { // Row buffer for intermediate ARGB pixels. - SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); + SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); while (width > 0) { int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); @@ -2582,7 +2582,7 @@ void I422ToRGB24Row_AVX2(const uint8* src_y, const struct YuvConstants* yuvconstants, int width) { // Row buffer for intermediate ARGB pixels. - SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); + SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); while (width > 0) { int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); @@ -2604,7 +2604,7 @@ void NV12ToRGB565Row_AVX2(const uint8* src_y, const struct YuvConstants* yuvconstants, int width) { // Row buffer for intermediate ARGB pixels. - SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); + SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); while (width > 0) { int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; NV12ToARGBRow_AVX2(src_y, src_uv, row, yuvconstants, twidth);