mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
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
This commit is contained in:
parent
e5f3fd4cc8
commit
567244c003
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 168
|
||||
Version: 169
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -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_
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ TEST_F(libyuvTest, TestLinuxNeon) {
|
||||
}
|
||||
|
||||
TEST_F(libyuvTest, TestVersion) {
|
||||
EXPECT_GE(159,LIBYUV_VERSION);
|
||||
EXPECT_GE(LIBYUV_VERSION, 169);
|
||||
}
|
||||
|
||||
} // namespace libyuv
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user