diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 7332bdf79..96973da67 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -274,7 +274,7 @@ extern "C" { // The following are available for AVX2 gcc/clang x86 platforms: // TODO(fbarchard): Port to Visual C -#if !defined(LIBYUV_DISABLE_X86) && \ +#if !defined(LIBYUV_DISABLE_X86) && \ (defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER))) && \ (defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2)) #define HAS_MERGEUV10ROW_AVX2 diff --git a/source/cpu_id.cc b/source/cpu_id.cc index 7b979703d..344f3c06a 100644 --- a/source/cpu_id.cc +++ b/source/cpu_id.cc @@ -244,11 +244,11 @@ static SAFEBUFFERS int GetCpuFlags(void) { if ((GetXCR0() & 0xe0) == 0xe0) { cpu_info |= (cpu_info7[1] & 0x40000000) ? kCpuHasAVX512BW : 0; cpu_info |= (cpu_info7[1] & 0x80000000) ? kCpuHasAVX512VL : 0; - cpu_info |= (cpu_info7[2] & 0x00000002) ? kCpuHasAVX512VBMI: 0; - cpu_info |= (cpu_info7[2] & 0x00000040) ? kCpuHasAVX512VBMI2: 0; - cpu_info |= (cpu_info7[2] & 0x00001000) ? kCpuHasAVX512VBITALG: 0; - cpu_info |= (cpu_info7[2] & 0x00004000) ? kCpuHasAVX512VPOPCNTDQ: 0; - cpu_info |= (cpu_info7[2] & 0x00000100) ? kCpuHasGFNI: 0; + cpu_info |= (cpu_info7[2] & 0x00000002) ? kCpuHasAVX512VBMI : 0; + cpu_info |= (cpu_info7[2] & 0x00000040) ? kCpuHasAVX512VBMI2 : 0; + cpu_info |= (cpu_info7[2] & 0x00001000) ? kCpuHasAVX512VBITALG : 0; + cpu_info |= (cpu_info7[2] & 0x00004000) ? kCpuHasAVX512VPOPCNTDQ : 0; + cpu_info |= (cpu_info7[2] & 0x00000100) ? kCpuHasGFNI : 0; } } diff --git a/source/mjpeg_validate.cc b/source/mjpeg_validate.cc index 1a17dd721..bd7604253 100644 --- a/source/mjpeg_validate.cc +++ b/source/mjpeg_validate.cc @@ -24,7 +24,7 @@ static LIBYUV_BOOL ScanEOI(const uint8* sample, size_t sample_size) { const uint8* it = sample; while (it < end) { // TODO(fbarchard): scan for 0xd9 instead. - it = static_cast(memchr(it, 0xff, end - it)); + it = (const uint8*)(memchr(it, 0xff, end - it)); if (it == NULL) { break; } diff --git a/source/row_gcc.cc b/source/row_gcc.cc index c2874e159..ff2e8a378 100644 --- a/source/row_gcc.cc +++ b/source/row_gcc.cc @@ -2758,9 +2758,11 @@ void MergeUV10Row_AVX2(const uint16* src_u, const uint16* src_v, uint16* dst_uv, int width) { + // clang-format off asm volatile ( "sub %0,%1 \n" + // 16 pixels per loop. LABELALIGN "1: \n" "vmovdqu (%0),%%ymm0 \n" @@ -2768,14 +2770,8 @@ void MergeUV10Row_AVX2(const uint16* src_u, "add $0x20,%0 \n" "vpsllw $0x6,%%ymm0,%%ymm0 \n" "vpsllw $0x6,%%ymm1,%%ymm1 \n" -// "vpermq $0xd8,%%ymm0,%%ymm0 \n" -// "vpermq $0xd8,%%ymm1,%%ymm1 \n" - "vpunpcklwd %%ymm1,%%ymm0,%%ymm2 \n" + "vpunpcklwd %%ymm1,%%ymm0,%%ymm2 \n" // mutates "vpunpckhwd %%ymm1,%%ymm0,%%ymm0 \n" - -// "vmovdqu %%ymm2, (%2) \n" -// "vmovdqu %%ymm0, 0x20(%2) \n" - "vextractf128 $0x0,%%ymm2,(%2) \n" "vextractf128 $0x0,%%ymm0,0x10(%2) \n" "vextractf128 $0x1,%%ymm2,0x20(%2) \n" @@ -2784,17 +2780,16 @@ void MergeUV10Row_AVX2(const uint16* src_u, "sub $0x10,%3 \n" "jg 1b \n" "vzeroupper \n" - : "+r"(src_u), // %0 - "+r"(src_v), // %1 - "+r"(dst_uv), // %2 - "+r"(width) // %3 + : "+r"(src_u), // %0 + "+r"(src_v), // %1 + "+r"(dst_uv), // %2 + "+r"(width) // %3 : - : "memory", "cc", "xmm0", "xmm1", "xmm2" - ); + : "memory", "cc", "xmm0", "xmm1", "xmm2"); + // clang-format on } #endif // HAS_MERGEUVROW_AVX2 - #ifdef HAS_SPLITRGBROW_SSSE3 // Shuffle table for converting RGB to Planar. diff --git a/source/scale.cc b/source/scale.cc index 13e242ba0..b3ad64e84 100644 --- a/source/scale.cc +++ b/source/scale.cc @@ -822,11 +822,12 @@ static void ScaleAddCols2_16_C(int dst_width, static void ScaleAddCols0_C(int dst_width, int boxheight, int x, - int, + int dx, const uint16* src_ptr, uint8* dst_ptr) { int scaleval = 65536 / boxheight; int i; + (void)dx; src_ptr += (x >> 16); for (i = 0; i < dst_width; ++i) { *dst_ptr++ = src_ptr[i] * scaleval >> 16; diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc index 8115e0dda..4e694f55c 100644 --- a/unit_test/cpu_test.cc +++ b/unit_test/cpu_test.cc @@ -36,7 +36,7 @@ TEST_F(LibYUVBaseTest, TestCpuHas) { int has_avx2 = TestCpuFlag(kCpuHasAVX2); int has_erms = TestCpuFlag(kCpuHasERMS); int has_fma3 = TestCpuFlag(kCpuHasFMA3); - int has_f16c = TestCpuFlag(kCpuHasF16C); + int has_f16c = TestCpuFlag(kCpuHasF16C); int has_gfni = TestCpuFlag(kCpuHasGFNI); int has_avx512bw = TestCpuFlag(kCpuHasAVX512BW); int has_avx512vl = TestCpuFlag(kCpuHasAVX512VL);