From 0387df518647a5ded0c18a4197e8a9993e7ce4ed Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Tue, 11 Nov 2014 19:12:38 +0000 Subject: [PATCH] ARGBSubtract_AVX2 ported to GCC. BUG=269 TESTED=try bots R=harryjin@google.com Review URL: https://webrtc-codereview.appspot.com/27129004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@1159 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/row.h | 2 +- include/libyuv/version.h | 2 +- source/row_posix.cc | 30 ++++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/README.chromium b/README.chromium index 66e61c053..5649bef1f 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1158 +Version: 1159 License: BSD License File: LICENSE diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 5f8b558de..d2fb55934 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -202,6 +202,7 @@ extern "C" { // Effects: #define HAS_ARGBADDROW_AVX2 +#define HAS_ARGBSUBTRACTROW_AVX2 #endif // The following are require VS2012. @@ -220,7 +221,6 @@ extern "C" { #define HAS_ARGBATTENUATEROW_AVX2 #define HAS_ARGBMIRRORROW_AVX2 #define HAS_ARGBMULTIPLYROW_AVX2 -#define HAS_ARGBSUBTRACTROW_AVX2 #define HAS_ARGBUNATTENUATEROW_AVX2 #endif // defined(VISUALC_HAS_AVX2) diff --git a/include/libyuv/version.h b/include/libyuv/version.h index e4406a4ca..132c83fd0 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 1158 +#define LIBYUV_VERSION 1159 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/row_posix.cc b/source/row_posix.cc index 57139c040..1cde6ba66 100644 --- a/source/row_posix.cc +++ b/source/row_posix.cc @@ -4015,6 +4015,36 @@ void ARGBSubtractRow_SSE2(const uint8* src_argb0, const uint8* src_argb1, } #endif // HAS_ARGBSUBTRACTROW_SSE2 +#ifdef HAS_ARGBSUBTRACTROW_AVX2 +// Subtract 2 rows of ARGB pixels, 8 pixels at a time. +void ARGBSubtractRow_AVX2(const uint8* src_argb0, const uint8* src_argb1, + uint8* dst_argb, int width) { + asm volatile ( + // 4 pixel loop. + LABELALIGN + "1: \n" + "vmovdqu " MEMACCESS(0) ",%%ymm0 \n" + "lea " MEMLEA(0x20,0) ",%0 \n" + "vpsubusb " MEMACCESS(1) ",%%ymm0,%%ymm0 \n" + "lea " MEMLEA(0x20,1) ",%1 \n" + "vmovdqu %%ymm0," MEMACCESS(2) " \n" + "lea " MEMLEA(0x20,2) ",%2 \n" + "sub $0x8,%3 \n" + "jg 1b \n" + "vzeroupper \n" + : "+r"(src_argb0), // %0 + "+r"(src_argb1), // %1 + "+r"(dst_argb), // %2 + "+r"(width) // %3 + : + : "memory", "cc" +#if defined(__SSE2__) + , "xmm0" +#endif + ); +} +#endif // HAS_ARGBSUBTRACTROW_AVX2 + #ifdef HAS_SOBELXROW_SSE2 // SobelX as a matrix is // -1 0 1