diff --git a/README.chromium b/README.chromium index db6fd5cac..5c4393f8b 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 719 +Version: 720 License: BSD License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 0e13406e1..43bb9815a 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 719 +#define LIBYUV_VERSION 720 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/unit_test/scale_argb_test.cc b/unit_test/scale_argb_test.cc index dc44d3b60..7a4758594 100644 --- a/unit_test/scale_argb_test.cc +++ b/unit_test/scale_argb_test.cc @@ -26,25 +26,18 @@ static int ARGBTestFilter(int src_width, int src_height, int dst_width, int dst_height, FilterMode f, int benchmark_iterations) { const int b = 128; + int i, j; int src_argb_plane_size = (Abs(src_width) + b * 2) * (Abs(src_height) + b * 2) * 4; int src_stride_argb = (b * 2 + Abs(src_width)) * 4; align_buffer_64(src_argb, src_argb_plane_size) - memset(src_argb, 1, src_argb_plane_size); + srandom(time(NULL)); + MemRandomize(src_argb, src_argb_plane_size); int dst_argb_plane_size = (dst_width + b * 2) * (dst_height + b * 2) * 4; int dst_stride_argb = (b * 2 + dst_width) * 4; - srandom(time(NULL)); - - int i, j; - for (i = b; i < (Abs(src_height) + b); ++i) { - for (j = b; j < (Abs(src_width) + b) * 4; ++j) { - src_argb[(i * src_stride_argb) + j] = (random() & 0xff); - } - } - align_buffer_64(dst_argb_c, dst_argb_plane_size) align_buffer_64(dst_argb_opt, dst_argb_plane_size) memset(dst_argb_c, 2, dst_argb_plane_size); diff --git a/unit_test/scale_test.cc b/unit_test/scale_test.cc index c435a8491..769151aa2 100644 --- a/unit_test/scale_test.cc +++ b/unit_test/scale_test.cc @@ -25,6 +25,7 @@ static __inline int Abs(int v) { static int TestFilter(int src_width, int src_height, int dst_width, int dst_height, FilterMode f, int benchmark_iterations) { + int i, j; const int b = 128; int src_width_uv = (Abs(src_width) + 1) >> 1; int src_height_uv = (Abs(src_height) + 1) >> 1; @@ -38,6 +39,10 @@ static int TestFilter(int src_width, int src_height, align_buffer_page_end(src_y, src_y_plane_size) align_buffer_page_end(src_u, src_uv_plane_size) align_buffer_page_end(src_v, src_uv_plane_size) + srandom(time(NULL)); + MemRandomize(src_y, src_y_plane_size); + MemRandomize(src_u, src_uv_plane_size); + MemRandomize(src_v, src_uv_plane_size); int dst_width_uv = (dst_width + 1) >> 1; int dst_height_uv = (dst_height + 1) >> 1; @@ -48,22 +53,6 @@ static int TestFilter(int src_width, int src_height, int dst_stride_y = b * 2 + dst_width; int dst_stride_uv = b * 2 + dst_width_uv; - srandom(time(NULL)); - - int i, j; - for (i = b; i < (Abs(src_height) + b); ++i) { - for (j = b; j < (Abs(src_width) + b); ++j) { - src_y[(i * src_stride_y) + j] = (random() & 0xff); - } - } - - for (i = b; i < (src_height_uv + b); ++i) { - for (j = b; j < (src_width_uv + b); ++j) { - src_u[(i * src_stride_uv) + j] = (random() & 0xff); - src_v[(i * src_stride_uv) + j] = (random() & 0xff); - } - } - align_buffer_page_end(dst_y_c, dst_y_plane_size) align_buffer_page_end(dst_u_c, dst_uv_plane_size) align_buffer_page_end(dst_v_c, dst_uv_plane_size) @@ -71,25 +60,6 @@ static int TestFilter(int src_width, int src_height, align_buffer_page_end(dst_u_opt, dst_uv_plane_size) align_buffer_page_end(dst_v_opt, dst_uv_plane_size) - // Warm up both versions for consistent benchmarks. - MaskCpuFlags(0); // Disable all CPU optimization. - I420Scale(src_y + (src_stride_y * b) + b, src_stride_y, - src_u + (src_stride_uv * b) + b, src_stride_uv, - src_v + (src_stride_uv * b) + b, src_stride_uv, - src_width, src_height, - dst_y_c + (dst_stride_y * b) + b, dst_stride_y, - dst_u_c + (dst_stride_uv * b) + b, dst_stride_uv, - dst_v_c + (dst_stride_uv * b) + b, dst_stride_uv, - dst_width, dst_height, f); - MaskCpuFlags(-1); // Enable all CPU optimization. - I420Scale(src_y + (src_stride_y * b) + b, src_stride_y, - src_u + (src_stride_uv * b) + b, src_stride_uv, - src_v + (src_stride_uv * b) + b, src_stride_uv, - src_width, src_height, - dst_y_opt + (dst_stride_y * b) + b, dst_stride_y, - dst_u_opt + (dst_stride_uv * b) + b, dst_stride_uv, - dst_v_opt + (dst_stride_uv * b) + b, dst_stride_uv, - dst_width, dst_height, f); MaskCpuFlags(0); // Disable all CPU optimization. double c_time = get_time(); @@ -101,7 +71,6 @@ static int TestFilter(int src_width, int src_height, dst_u_c + (dst_stride_uv * b) + b, dst_stride_uv, dst_v_c + (dst_stride_uv * b) + b, dst_stride_uv, dst_width, dst_height, f); - c_time = (get_time() - c_time); MaskCpuFlags(-1); // Enable all CPU optimization. @@ -117,10 +86,11 @@ static int TestFilter(int src_width, int src_height, dst_width, dst_height, f); } opt_time = (get_time() - opt_time) / benchmark_iterations; - // Report performance of C vs OPT printf("filter %d - %8d us C - %8d us OPT\n", - f, static_cast(c_time * 1e6), static_cast(opt_time * 1e6)); + f, + static_cast(c_time * 1e6), + static_cast(opt_time * 1e6)); // C version may be a little off from the optimized. Order of // operations may introduce rounding somewhere. So do a difference diff --git a/unit_test/unit_test.h b/unit_test/unit_test.h index f797c8ca0..e81aea307 100644 --- a/unit_test/unit_test.h +++ b/unit_test/unit_test.h @@ -13,6 +13,8 @@ #include +#include "libyuv/basic_types.h" + #define align_buffer_64(var, size) \ uint8* var; \ uint8* var##_mem; \ @@ -59,6 +61,17 @@ static inline double get_time() { } #endif +static inline void MemRandomize(uint8* dst, int len) { + int i; + for (i = 0; i < len - 3; i += 4) { + *reinterpret_cast(dst) = random(); + dst += 4; + } + for (; i < len; ++i) { + *dst++ = random(); + } +} + class libyuvTest : public ::testing::Test { protected: libyuvTest();