From 95d845bd5b758b21f4949aa47fb39e03a552c8c2 Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Mon, 26 Nov 2012 19:10:35 +0000 Subject: [PATCH] benchmark only the opt version of rotate. BUG=155 TEST=sudo LIBYUV_REPEAT=1000 nice --5 ./libyuv_unittest --gtest_filter=*Rotate* Review URL: https://webrtc-codereview.appspot.com/939029 git-svn-id: http://libyuv.googlecode.com/svn/trunk@502 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/version.h | 2 +- source/scale.cc | 7 +++---- unit_test/rotate_argb_test.cc | 10 ++++------ 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/README.chromium b/README.chromium index 35f9d5efd..b811b8175 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 501 +Version: 502 License: BSD License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 3e03a74b5..5094c5801 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 501 +#define LIBYUV_VERSION 502 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/scale.cc b/source/scale.cc index d4ff9dbc5..f686dc67e 100644 --- a/source/scale.cc +++ b/source/scale.cc @@ -105,7 +105,6 @@ void ScaleFilterRows_NEON(uint8* dst_ptr, * */ - // Constants for SSSE3 code #elif !defined(YUV_DISABLE_ASM) && \ (defined(_M_IX86) || defined(__i386__) || defined(__x86_64__)) @@ -225,6 +224,7 @@ static void ScaleRowDown2_SSE2(const uint8* src_ptr, ptrdiff_t src_stride, ret } } + // Blends 32x2 rectangle to 16x1. // Alignment requirement: src_ptr 16 byte aligned, dst_ptr 16 byte aligned. __declspec(naked) __declspec(align(16)) @@ -299,6 +299,7 @@ static void ScaleRowDown2_Unaligned_SSE2(const uint8* src_ptr, ret } } + // Blends 32x2 rectangle to 16x1. // Alignment requirement: src_ptr 16 byte aligned, dst_ptr 16 byte aligned. __declspec(naked) __declspec(align(16)) @@ -1241,9 +1242,7 @@ static void ScaleFilterRows_Unaligned_SSSE3(uint8* dst_ptr, ret } } - #elif !defined(YUV_DISABLE_ASM) && (defined(__x86_64__) || defined(__i386__)) - // GCC versions of row functions are verbatim conversions from Visual C. // Generated using gcc disassembly on Visual C object file: // objdump -D yuvscaler.obj >yuvscaler.txt @@ -1313,6 +1312,7 @@ void ScaleRowDown2Int_SSE2(const uint8* src_ptr, ptrdiff_t src_stride, #endif ); } + static void ScaleRowDown2_Unaligned_SSE2(const uint8* src_ptr, ptrdiff_t src_stride, uint8* dst_ptr, int dst_width) { @@ -2569,7 +2569,6 @@ static void ScaleFilterRows_C(uint8* dst_ptr, int y0_fraction = 256 - y1_fraction; const uint8* src_ptr1 = src_ptr + src_stride; - for (int x = 0; x < dst_width - 1; x += 2) { dst_ptr[0] = (src_ptr[0] * y0_fraction + src_ptr1[0] * y1_fraction) >> 8; dst_ptr[1] = (src_ptr[1] * y0_fraction + src_ptr1[1] * y1_fraction) >> 8; diff --git a/unit_test/rotate_argb_test.cc b/unit_test/rotate_argb_test.cc index 67b017dc3..9cc3e4a95 100644 --- a/unit_test/rotate_argb_test.cc +++ b/unit_test/rotate_argb_test.cc @@ -56,12 +56,10 @@ static int ARGBTestRotate(int src_width, int src_height, MaskCpuFlags(0); // Disable all CPU optimization. double c_time = get_time(); - for (i = 0; i < runs; ++i) { - ARGBRotate(src_argb + (src_stride_argb * b) + b * 4, src_stride_argb, - dst_argb_c + (dst_stride_argb * b) + b * 4, dst_stride_argb, - src_width, src_height, mode); - } - c_time = (get_time() - c_time) / runs; + ARGBRotate(src_argb + (src_stride_argb * b) + b * 4, src_stride_argb, + dst_argb_c + (dst_stride_argb * b) + b * 4, dst_stride_argb, + src_width, src_height, mode); + c_time = (get_time() - c_time); MaskCpuFlags(-1); // Enable all CPU optimization. double opt_time = get_time();