Commit 567244c0 authored by fbarchard@google.com's avatar fbarchard@google.com

minor fixups

BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/388001

git-svn-id: http://libyuv.googlecode.com/svn/trunk@169 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent e5f3fd4c
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 168 Version: 169
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ #ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 168 #define LIBYUV_VERSION 169
#endif // INCLUDE_LIBYUV_VERSION_H_ #endif // INCLUDE_LIBYUV_VERSION_H_
...@@ -28,10 +28,10 @@ extern "C" { ...@@ -28,10 +28,10 @@ extern "C" {
// hash seed of 5381 recommended. // hash seed of 5381 recommended.
uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed) { uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed) {
uint32 hash = seed; uint32 hash = seed;
if (len > 0) { if (count > 0) {
do { do {
hash = hash * 33 + *src++; hash = hash * 33 + *src++;
} while (--len); } while (--count);
} }
return hash; return hash;
} }
......
...@@ -966,12 +966,12 @@ int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2, ...@@ -966,12 +966,12 @@ int YUY2ToI420(const uint8* src_yuy2, int src_stride_yuy2,
#endif #endif
for (int y = 0; y < height - 1; y += 2) { for (int y = 0; y < height - 1; y += 2) {
YUY2ToUVRow(src_yuy2, src_stride_yuy2, dst_u, dst_v, width); 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, dst_y, width);
YUY2ToYRow(src_yuy2 + src_stride_yuy2, dst_y + dst_stride_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; 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) { if (height & 1) {
YUY2ToUVRow(src_yuy2, 0, dst_u, dst_v, width); YUY2ToUVRow(src_yuy2, 0, dst_u, dst_v, width);
...@@ -1018,12 +1018,12 @@ int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy, ...@@ -1018,12 +1018,12 @@ int UYVYToI420(const uint8* src_uyvy, int src_stride_uyvy,
#endif #endif
for (int y = 0; y < height - 1; y += 2) { for (int y = 0; y < height - 1; y += 2) {
UYVYToUVRow(src_uyvy, src_stride_uyvy, dst_u, dst_v, width); 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, dst_y, width);
UYVYToYRow(src_uyvy + src_stride_uyvy, dst_y + dst_stride_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; 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) { if (height & 1) {
UYVYToUVRow(src_uyvy, 0, dst_u, dst_v, width); UYVYToUVRow(src_uyvy, 0, dst_u, dst_v, width);
......
...@@ -20,6 +20,47 @@ ...@@ -20,6 +20,47 @@
namespace libyuv { 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) { TEST_F(libyuvTest, BenchmarkSumSquareError_C) {
const int max_width = 4096*3; const int max_width = 4096*3;
...@@ -27,8 +68,9 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_C) { ...@@ -27,8 +68,9 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_C) {
align_buffer_16(src_b, max_width) align_buffer_16(src_b, max_width)
MaskCpuFlags(kCpuInitialized); 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); ComputeSumSquareError(src_a, src_b, max_width);
}
MaskCpuFlags(-1); MaskCpuFlags(-1);
...@@ -44,8 +86,9 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_OPT) { ...@@ -44,8 +86,9 @@ TEST_F(libyuvTest, BenchmarkSumSquareError_OPT) {
align_buffer_16(src_a, max_width) align_buffer_16(src_a, max_width)
align_buffer_16(src_b, 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); ComputeSumSquareError(src_a, src_b, max_width);
}
EXPECT_EQ(0, 0); EXPECT_EQ(0, 0);
......
...@@ -27,7 +27,7 @@ TEST_F(libyuvTest, TestLinuxNeon) { ...@@ -27,7 +27,7 @@ TEST_F(libyuvTest, TestLinuxNeon) {
} }
TEST_F(libyuvTest, TestVersion) { TEST_F(libyuvTest, TestVersion) {
EXPECT_GE(159,LIBYUV_VERSION); EXPECT_GE(LIBYUV_VERSION, 169);
} }
} // namespace libyuv } // namespace libyuv
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment