From ee2208885f7efbe236d4070628948fe079527bfd Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Thu, 14 Jun 2012 00:07:56 +0000 Subject: [PATCH] Fix constant in rowposix, remove addrow and minor cleanups BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/637013 git-svn-id: http://libyuv.googlecode.com/svn/trunk@286 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/planar_functions.h | 27 ++++-------- include/libyuv/version.h | 2 +- source/planar_functions.cc | 26 ------------ source/row.h | 6 --- source/row_common.cc | 24 ----------- source/row_posix.cc | 68 +------------------------------ source/row_win.cc | 59 --------------------------- 8 files changed, 11 insertions(+), 203 deletions(-) diff --git a/README.chromium b/README.chromium index 903df484f..ec25d3903 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 285 +Version: 286 License: BSD License File: LICENSE diff --git a/include/libyuv/planar_functions.h b/include/libyuv/planar_functions.h index 00f84d8b1..49a02cc6d 100644 --- a/include/libyuv/planar_functions.h +++ b/include/libyuv/planar_functions.h @@ -201,33 +201,27 @@ int ARGBToI422(const uint8* src_frame, int src_stride_frame, int I420Rect(uint8* dst_y, int dst_stride_y, uint8* dst_u, int dst_stride_u, uint8* dst_v, int dst_stride_v, - int x, int y, - int width, int height, + int x, int y, int width, int height, int value_y, int value_u, int value_v); // Draw a rectangle into ARGB. int ARGBRect(uint8* dst_argb, int dst_stride_argb, - int x, int y, - int width, int height, - uint32 value); + int x, int y, int width, int height, uint32 value); // Make a rectangle of ARGB gray scale. int ARGBGray(uint8* dst_argb, int dst_stride_argb, - int x, int y, - int width, int height); + int x, int y, int width, int height); // Make a rectangle of ARGB Sepia tone. int ARGBSepia(uint8* dst_argb, int dst_stride_argb, - int x, int y, - int width, int height); + int x, int y, int width, int height); // Copy ARGB to ARGB. int ARGBCopy(const uint8* src_argb, int src_stride_argb, uint8* dst_argb, int dst_stride_argb, int width, int height); -typedef void (*ARGBBlendRow)(const uint8* src_argb0, - const uint8* src_argb1, +typedef void (*ARGBBlendRow)(const uint8* src_argb0, const uint8* src_argb1, uint8* dst_argb, int width); // Get function to Alpha Blend ARGB pixels and store to destination. @@ -263,17 +257,10 @@ int ARGBUnattenuate(const uint8* src_argb, int src_stride_argb, uint8* dst_argb, int dst_stride_argb, int width, int height); -// Get function to add or subtract rows of bytes to a 16 bit buffer. For blur. -typedef void (*AddRow)(const uint8* src, uint16* dst, int width); -AddRow GetAddRow(uint16* dst, int width); -AddRow GetSubRow(uint16* dst, int width); - // Convert MJPG to ARGB. -int MJPGToARGB(const uint8* sample, - size_t sample_size, +int MJPGToARGB(const uint8* sample, size_t sample_size, uint8* argb, int argb_stride, - int w, int h, - int dw, int dh); + int w, int h, int dw, int dh); // Computes table of cumulative sum for image where the value is the sum // of all values above and to the left of the entry. Used by ARGBBlur. diff --git a/include/libyuv/version.h b/include/libyuv/version.h index d5883e68b..6ae848321 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,7 +11,7 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 285 +#define LIBYUV_VERSION 286 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/planar_functions.cc b/source/planar_functions.cc index 1a697e201..0ec658ca7 100644 --- a/source/planar_functions.cc +++ b/source/planar_functions.cc @@ -1424,32 +1424,6 @@ int ARGBUnattenuate(const uint8* src_argb, int src_stride_argb, return 0; } -// AddRow is useful for summing up rows of an image, when implementing a -// box filter or blur effect. -AddRow GetAddRow(uint16* dst, int width) { - AddRow AddRowF = AddRow_C; -#if defined(HAS_ADDROW_SSE2) - if (TestCpuFlag(kCpuHasSSE2) && - IS_ALIGNED(dst, 16) && IS_ALIGNED(width, 16)) { - AddRowF = AddRow_SSE2; - } -#endif - return AddRowF; -} - -// SubRow is useful when a sum of rows exists and the caller wants to -// remove a row and add a new row without recomputing the full sum of rows. -AddRow GetSubRow(uint16* dst, int width) { - AddRow SubRowF = SubRow_C; -#if defined(HAS_ADDROW_SSE2) - if (TestCpuFlag(kCpuHasSSE2) && - IS_ALIGNED(dst, 16) && IS_ALIGNED(width, 16)) { - SubRowF = SubRow_SSE2; - } -#endif - return SubRowF; -} - // Make a rectangle of ARGB gray scale. int ARGBGray(uint8* dst_argb, int dst_stride_argb, int dst_x, int dst_y, diff --git a/source/row.h b/source/row.h index 295d593c1..c9e0c12f6 100644 --- a/source/row.h +++ b/source/row.h @@ -64,7 +64,6 @@ extern "C" { #define HAS_I400TOARGBROW_SSE2 #define HAS_MIRRORROW_SSSE3 #define HAS_MIRRORROWUV_SSSE3 -#define HAS_ADDROW_SSE2 #define HAS_RAWTOARGBROW_SSSE3 #define HAS_RGB24TOARGBROW_SSSE3 #define HAS_RGB565TOARGBROW_SSE2 @@ -177,11 +176,6 @@ void MirrorRowUV_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v, int width); void MirrorRowUV_NEON(const uint8* src, uint8* dst_u, uint8* dst_v, int width); void MirrorRowUV_C(const uint8* src, uint8* dst_u, uint8* dst_v, int width); -void AddRow_SSE2(const uint8* src, uint16* dst, int width); -void SubRow_SSE2(const uint8* src, uint16* dst, int width); -void AddRow_C(const uint8* src, uint16* dst, int width); -void SubRow_C(const uint8* src, uint16* dst, int width); - void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix); void SplitUV_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix); void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix); diff --git a/source/row_common.cc b/source/row_common.cc index a1993f485..080c54895 100644 --- a/source/row_common.cc +++ b/source/row_common.cc @@ -521,30 +521,6 @@ void MirrorRowUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) { } } -void AddRow_C(const uint8* src, uint16* dst, int width) { - for (int x = 0; x < width - 1; x += 2) { - dst[0] += static_cast(src[0]); - dst[1] += static_cast(src[1]); - src += 2; - dst += 2; - } - if (width & 1) { - dst[0] += static_cast(src[0]); - } -} - -void SubRow_C(const uint8* src, uint16* dst, int width) { - for (int x = 0; x < width - 1; x += 2) { - dst[0] -= static_cast(src[0]); - dst[1] -= static_cast(src[1]); - src += 2; - dst += 2; - } - if (width & 1) { - dst[0] -= static_cast(src[0]); - } -} - void SplitUV_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) { for (int x = 0; x < width - 1; x += 2) { dst_u[x] = src_uv[0]; diff --git a/source/row_posix.cc b/source/row_posix.cc index 19f4e60f5..4d071fc61 100644 --- a/source/row_posix.cc +++ b/source/row_posix.cc @@ -1977,70 +1977,6 @@ void MirrorRowUV_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v, } #endif // HAS_MIRRORROW_UV_SSSE3 -#ifdef HAS_ADDROW_SSE2 -// dst and width aligned to 16 -void AddRow_SSE2(const uint8* src, uint16* dst, int width) { - asm volatile ( - "pxor %%xmm4,%%xmm4 \n" - ".p2align 4 \n" - "1: \n" - "movdqu (%0),%%xmm2 \n" - "lea 0x10(%0),%0 \n" - "movdqa (%1),%%xmm0 \n" - "movdqa 0x10(%1),%%xmm1 \n" - "movdqa %%xmm2,%%xmm3 \n" - "punpcklbw %%xmm4,%%xmm2 \n" - "punpckhbw %%xmm4,%%xmm3 \n" - "paddusw %%xmm2,%%xmm0 \n" - "paddusw %%xmm3,%%xmm1 \n" - "sub $0x10,%2 \n" - "movdqa %%xmm0,(%1) \n" - "movdqa %%xmm1,0x10(%1) \n" - "lea 0x20(%1),%1 \n" - "jg 1b \n" - : "+r"(src), // %0 - "+r"(dst), // %1 - "+r"(width) // %2 - : - : "memory", "cc" -#if defined(__SSE2__) - , "xmm0", "xmm1", "xmm2", "xmm3", "xmm4" -#endif - ); -} - -// dst and width aligned to 16 -void SubRow_SSE2(const uint8* src, uint16* dst, int width) { - asm volatile ( - "pxor %%xmm4,%%xmm4 \n" - ".p2align 4 \n" - "1: \n" - "movdqu (%0),%%xmm2 \n" - "lea 0x10(%0),%0 \n" - "movdqa (%1),%%xmm0 \n" - "movdqa 0x10(%1),%%xmm1 \n" - "movdqa %%xmm2,%%xmm3 \n" - "punpcklbw %%xmm4,%%xmm2 \n" - "punpckhbw %%xmm4,%%xmm3 \n" - "psubusw %%xmm2,%%xmm0 \n" - "psubusw %%xmm3,%%xmm1 \n" - "sub $0x10,%2 \n" - "movdqa %%xmm0,(%1) \n" - "movdqa %%xmm1,0x10(%1) \n" - "lea 0x20(%1),%1 \n" - "jg 1b \n" - : "+r"(src), // %0 - "+r"(dst), // %1 - "+r"(width) // %2 - : - : "memory", "cc" -#if defined(__SSE2__) - , "xmm0", "xmm1", "xmm2", "xmm3", "xmm4" -#endif - ); -} -#endif // HAS_ADDROW_SSE2 - #ifdef HAS_SPLITUV_SSE2 void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) { asm volatile ( @@ -2436,7 +2372,7 @@ void ARGBBlendRow_SSE2(const uint8* src_argb0, const uint8* src_argb1, "jge 10b \n" "19: \n" - "add $1-$4,%3 \n" + "add $1-4,%3 \n" "jl 49f \n" // 8 pixel loop. @@ -2592,7 +2528,7 @@ void ARGBBlendRow_SSSE3(const uint8* src_argb0, const uint8* src_argb1, "jge 10b \n" "19: \n" - "add $1-$4,%3 \n" + "add $1-4,%3 \n" "jl 49f \n" // 8 pixel loop. diff --git a/source/row_win.cc b/source/row_win.cc index 88bc808bc..832c4fd78 100644 --- a/source/row_win.cc +++ b/source/row_win.cc @@ -2059,65 +2059,6 @@ void MirrorRowUV_SSSE3(const uint8* src, uint8* dst_u, uint8* dst_v, } #endif // HAS_MIRRORROW_UV_SSSE3 -#ifdef HAS_ADDROW_SSE2 -// dst and width aligned to 16 -__declspec(naked) __declspec(align(16)) -void AddRow_SSE2(const uint8* src, uint16* dst, int width) { -__asm { - mov eax, [esp + 4] // src - mov edx, [esp + 8] // dst - mov ecx, [esp + 12] // width - pxor xmm4, xmm4 - - align 16 - convertloop: - movdqu xmm2, [eax] // read 16 bytes - lea eax, [eax + 16] - movdqa xmm0, [edx] // read first 8 words - movdqa xmm1, [edx + 16] // read next 8 words - movdqa xmm3, xmm2 - punpcklbw xmm2, xmm4 - punpckhbw xmm3, xmm4 - paddusw xmm0, xmm2 // add 16 words - paddusw xmm1, xmm3 - sub ecx, 16 - movdqa [edx], xmm0 // store 16 words - movdqa [edx + 16], xmm1 - lea edx, [edx + 32] - jg convertloop - ret - } -} - -__declspec(naked) __declspec(align(16)) -void SubRow_SSE2(const uint8* src, uint16* dst, int width) { -__asm { - mov eax, [esp + 4] // src - mov edx, [esp + 8] // dst - mov ecx, [esp + 12] // width - pxor xmm4, xmm4 - - align 16 - convertloop: - movdqu xmm2, [eax] // read 16 bytes - lea eax, [eax + 16] - movdqa xmm0, [edx] // read first 8 words - movdqa xmm1, [edx + 16] // read next 8 words - movdqa xmm3, xmm2 - punpcklbw xmm2, xmm4 - punpckhbw xmm3, xmm4 - psubusw xmm0, xmm2 // sub 16 words - psubusw xmm1, xmm3 - sub ecx, 16 - movdqa [edx], xmm0 // store 16 words - movdqa [edx + 16], xmm1 - lea edx, [edx + 32] - jg convertloop - ret - } -} -#endif // HAS_ADDROW_SSE2 - #ifdef HAS_SPLITUV_SSE2 __declspec(naked) __declspec(align(16)) void SplitUV_SSE2(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int pix) {