diff --git a/README.chromium b/README.chromium index 6871e2dc4..fea4da177 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 168 +Version: 169 License: BSD License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 44c514802..447a05bee 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 168 +#define LIBYUV_VERSION 169 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/compare.cc b/source/compare.cc index dbb576cbf..44c08661c 100644 --- a/source/compare.cc +++ b/source/compare.cc @@ -28,10 +28,10 @@ extern "C" { // hash seed of 5381 recommended. uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed) { uint32 hash = seed; - if (len > 0) { + if (count > 0) { do { hash = hash * 33 + *src++; - } while (--len); + } while (--count); } return hash; } diff --git a/source/planar_functions.cc b/source/planar_functions.cc index 2def26bf7..76b404999 100644 --- a/source/planar_functions.cc +++ b/source/planar_functions.cc @@ -966,12 +966,12 @@ int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2, #endif for (int y = 0; y < height - 1; y += 2) { YUY2ToUVRow(src_yuy2, src_stride_yuy2, dst_u, dst_v, width); - dst_u += dst_stride_u; - dst_v += dst_stride_v; YUY2ToYRow(src_yuy2, dst_y, width); YUY2ToYRow(src_yuy2 + src_stride_yuy2, dst_y + dst_stride_y, width); - dst_y += dst_stride_y * 2; src_yuy2 += src_stride_yuy2 * 2; + dst_y += dst_stride_y * 2; + dst_u += dst_stride_u; + dst_v += dst_stride_v; } if (height & 1) { YUY2ToUVRow(src_yuy2, 0, dst_u, dst_v, width); @@ -1018,12 +1018,12 @@ int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy, #endif for (int y = 0; y < height - 1; y += 2) { UYVYToUVRow(src_uyvy, src_stride_uyvy, dst_u, dst_v, width); - dst_u += dst_stride_u; - dst_v += dst_stride_v; UYVYToYRow(src_uyvy, dst_y, width); UYVYToYRow(src_uyvy + src_stride_uyvy, dst_y + dst_stride_y, width); - dst_y += dst_stride_y * 2; src_uyvy += src_stride_uyvy * 2; + dst_y += dst_stride_y * 2; + dst_u += dst_stride_u; + dst_v += dst_stride_v; } if (height & 1) { UYVYToUVRow(src_uyvy, 0, dst_u, dst_v, width); diff --git a/unit_test/compare_test.cc b/unit_test/compare_test.cc index 654b47937..4430b0e06 100644 --- a/unit_test/compare_test.cc +++ b/unit_test/compare_test.cc @@ -20,6 +20,47 @@ namespace libyuv { +// hash seed of 5381 recommended. +static uint32 ReferenceHashDjb2(const uint8* src, uint64 count, uint32 seed) { + uint32 hash = seed; + if (count > 0) { + do { + hash = hash * 33 + *src++; + } while (--count); + } + return hash; +} + +TEST_F(libyuvTest, TestDjb2) { + const int kMaxTest = 2049; + + align_buffer_16(src_a, kMaxTest) + for (int i = 0; i < kMaxTest; ++i) { + src_a[i] = i; + } + for (int i = 0; i < kMaxTest; ++i) { + uint32 h1 = HashDjb2(src_a, kMaxTest, 5381); + uint32 h2 = ReferenceHashDjb2(src_a, kMaxTest, 5381); + EXPECT_EQ(h1, h2); + } + free_aligned_buffer_16(src_a) +} + +TEST_F(libyuvTest, BenchmakDjb2) { + const int kMaxTest = 1280 * 720; + + align_buffer_16(src_a, kMaxTest) + for (int i = 0; i < kMaxTest; ++i) { + src_a[i] = i; + } + uint32 h2 = ReferenceHashDjb2(src_a, kMaxTest, 5381); + for (int i = 0; i < _benchmark_iterations; ++i) { + uint32 h1 = HashDjb2(src_a, kMaxTest, 5381); + EXPECT_EQ(h1, h2); + } + free_aligned_buffer_16(src_a) +} + TEST_F(libyuvTest, BenchmarkSumSquareError_C) { const int max_width = 4096*3; @@ -27,8 +68,9 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_C) { align_buffer_16(src_b, max_width) MaskCpuFlags(kCpuInitialized); - for (int i = 0; i < _benchmark_iterations; ++i) + for (int i = 0; i < _benchmark_iterations; ++i) { ComputeSumSquareError(src_a, src_b, max_width); + } MaskCpuFlags(-1); @@ -44,8 +86,9 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_OPT) { align_buffer_16(src_a, max_width) align_buffer_16(src_b, max_width) - for (int i = 0; i < _benchmark_iterations; ++i) + for (int i = 0; i < _benchmark_iterations; ++i) { ComputeSumSquareError(src_a, src_b, max_width); + } EXPECT_EQ(0, 0); diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc index 10e52b066..0914132d9 100644 --- a/unit_test/cpu_test.cc +++ b/unit_test/cpu_test.cc @@ -27,7 +27,7 @@ TEST_F(libyuvTest, TestLinuxNeon) { } TEST_F(libyuvTest, TestVersion) { - EXPECT_GE(159,LIBYUV_VERSION); + EXPECT_GE(LIBYUV_VERSION, 169); } } // namespace libyuv