From 752cb9e057c8c36a251810e57f98f195196fedc6 Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Wed, 14 Nov 2012 05:46:56 +0000 Subject: [PATCH] Some minor fixes for yuy2, r12 register, mask on any function. BUG=none TEST=none Review URL: https://webrtc-codereview.appspot.com/936023 git-svn-id: http://libyuv.googlecode.com/svn/trunk@489 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/version.h | 2 +- source/convert.cc | 53 --------------------------------------- source/row_any.cc | 2 +- source/row_common.cc | 2 +- source/row_neon.cc | 9 ++++--- source/scale_argb.cc | 1 - unit_test/convert_test.cc | 4 +-- 8 files changed, 11 insertions(+), 64 deletions(-) diff --git a/README.chromium b/README.chromium index 1b1e21f8f..cb7a1e694 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 488 +Version: 489 License: BSD License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 90056fe4e..9ca848155 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 488 +#define LIBYUV_VERSION 489 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/convert.cc b/source/convert.cc index d527fe601..dcadcb6a0 100644 --- a/source/convert.cc +++ b/source/convert.cc @@ -579,59 +579,6 @@ int Q420ToI420(const uint8* src_y, int src_stride_y, return 0; } -// Test if over reading on source is safe. -// TODO(fbarchard): Find more efficient solution to safely do odd sizes. -// Macros to control read policy, from slowest to fastest: -// READSAFE_NEVER - disables read ahead on systems with strict memory reads -// READSAFE_ODDHEIGHT - last row of odd height done with C. -// This policy assumes that the caller handles the last row of an odd height -// image using C. -// READSAFE_PAGE - enable read ahead within same page. -// A page is 4096 bytes. When reading ahead, if the last pixel is near the -// end the page, and a read spans the page into the next page, a memory -// exception can occur if that page has not been allocated, or is a guard -// page. This setting ensures the overread is within the same page. -// READSAFE_ALWAYS - enables read ahead on systems without memory exceptions -// or where buffers are padded by 64 bytes. - -#if defined(HAS_RGB24TOARGBROW_SSSE3) || \ - defined(HAS_RGB24TOARGBROW_SSSE3) || \ - defined(HAS_RAWTOARGBROW_SSSE3) || \ - defined(HAS_RGB565TOARGBROW_SSE2) || \ - defined(HAS_ARGB1555TOARGBROW_SSE2) || \ - defined(HAS_ARGB4444TOARGBROW_SSE2) - -#define READSAFE_ODDHEIGHT - -static bool TestReadSafe(const uint8* src_yuy2, int src_stride_yuy2, - int width, int height, int bpp, int overread) { - if (width > kMaxStride) { - return false; - } -#if defined(READSAFE_ALWAYS) - return true; -#elif defined(READSAFE_NEVER) - return false; -#elif defined(READSAFE_ODDHEIGHT) - if (!(width & 15) || - (src_stride_yuy2 >= 0 && (height & 1) && width * bpp >= overread)) { - return true; - } - return false; -#elif defined(READSAFE_PAGE) - if (src_stride_yuy2 >= 0) { - src_yuy2 += (height - 1) * src_stride_yuy2; - } - uintptr_t last_adr = (uintptr_t)(src_yuy2) + width * bpp - 1; - uintptr_t last_read_adr = last_adr + overread - 1; - if (((last_adr ^ last_read_adr) & ~4095) == 0) { - return true; - } - return false; -#endif -} -#endif - // Convert YUY2 to I420. LIBYUV_API int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2, diff --git a/source/row_any.cc b/source/row_any.cc index 1b29777b1..472683c08 100644 --- a/source/row_any.cc +++ b/source/row_any.cc @@ -282,7 +282,7 @@ UV422ANY(UYVYToUV422Row_Any_SSE2, UYVYToUV422Row_Unaligned_SSE2, #endif #ifdef HAS_YUY2TOUV422ROW_NEON UV422ANY(ARGBToUV444Row_Any_NEON, ARGBToUV444Row_NEON, - ARGBToUV444Row_C, 4, 8, 0) + ARGBToUV444Row_C, 4, 7, 0) UV422ANY(ARGBToUV422Row_Any_NEON, ARGBToUV422Row_NEON, ARGBToUV422Row_C, 4, 15, 1) UV422ANY(ARGBToUV411Row_Any_NEON, ARGBToUV411Row_NEON, diff --git a/source/row_common.cc b/source/row_common.cc index 3927af461..ea2c05456 100644 --- a/source/row_common.cc +++ b/source/row_common.cc @@ -517,7 +517,7 @@ void ARGBToUV422Row_C(const uint8* src_argb, dst_u += 1; dst_v += 1; } - if ((width & 3) == 1) { + if (width & 1) { uint8 ab = src_argb[0]; uint8 ag = src_argb[1]; uint8 ar = src_argb[2]; diff --git a/source/row_neon.cc b/source/row_neon.cc index 3cb5dab5d..566352c90 100644 --- a/source/row_neon.cc +++ b/source/row_neon.cc @@ -906,16 +906,17 @@ void MirrorRow_NEON(const uint8* src, uint8* dst, int width) { #endif // HAS_MIRRORROW_NEON #ifdef HAS_MIRRORUVROW_NEON -void MirrorUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width) { +void MirrorUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, + int width) { asm volatile ( // Start at end of source row. - "mov r3, #-16 \n" + "mov r12, #-16 \n" "add %0, %0, %3, lsl #1 \n" "sub %0, #16 \n" ".p2align 2 \n" "1: \n" - "vld2.8 {d0, d1}, [%0], r3 \n" // src -= 16 + "vld2.8 {d0, d1}, [%0], r12 \n" // src -= 16 "subs %3, #8 \n" // 8 pixels per loop. "vrev64.8 q0, q0 \n" "vst1.8 {d0}, [%1]! \n" // dst += 8 @@ -926,7 +927,7 @@ void MirrorUVRow_NEON(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width "+r"(dst_v), // %2 "+r"(width) // %3 : - : "memory", "cc", "r3", "q0" + : "memory", "cc", "r12", "q0" ); } #endif // HAS_MIRRORUVROW_NEON diff --git a/source/scale_argb.cc b/source/scale_argb.cc index 62184b41c..792ce6ade 100644 --- a/source/scale_argb.cc +++ b/source/scale_argb.cc @@ -710,7 +710,6 @@ void ScaleARGBFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr, , "xmm0", "xmm1", "xmm2", "xmm5" #endif ); - } #endif // defined(__x86_64__) || defined(__i386__) diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index 6b47f36e5..29b9c46d7 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -823,8 +823,8 @@ TESTATOB(RGB24, 3, 3, 1, ARGB, 4, 4, 1, 0) TESTATOB(RGB565, 2, 2, 1, ARGB, 4, 4, 1, 0) TESTATOB(ARGB1555, 2, 2, 1, ARGB, 4, 4, 1, 0) TESTATOB(ARGB4444, 2, 2, 1, ARGB, 4, 4, 1, 0) -TESTATOB(YUY2, 2, 4, 1, ARGB, 4, 4, 1, 14) -TESTATOB(UYVY, 2, 4, 1, ARGB, 4, 4, 1, 14) +TESTATOB(YUY2, 2, 4, 1, ARGB, 4, 4, 1, 4) +TESTATOB(UYVY, 2, 4, 1, ARGB, 4, 4, 1, 4) TESTATOB(BayerBGGR, 1, 2, 2, ARGB, 4, 4, 1, 0) TESTATOB(BayerRGGB, 1, 2, 2, ARGB, 4, 4, 1, 0) TESTATOB(BayerGBRG, 1, 2, 2, ARGB, 4, 4, 1, 0)