redo nv12 crop unittest with expect eq
BUG=334
TESTED=crop
R=tpsiaki@google.com
Review URL: https://webrtc-codereview.appspot.com/16129004
git-svn-id: http://libyuv.googlecode.com/svn/trunk@1037 16f28f9a-4ce2-e073-06de-1de4eb20be90
diff --git a/README.chromium b/README.chromium
index 65936a1..38eb699 100644
--- a/README.chromium
+++ b/README.chromium
@@ -1,6 +1,6 @@
Name: libyuv
URL: http://code.google.com/p/libyuv/
-Version: 1035
+Version: 1037
License: BSD
License File: LICENSE
diff --git a/include/libyuv/version.h b/include/libyuv/version.h
index 6534a39..ca1e7c8 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 1035
+#define LIBYUV_VERSION 1037
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc
index 2f47761..d70a479 100644
--- a/unit_test/convert_test.cc
+++ b/unit_test/convert_test.cc
@@ -118,7 +118,7 @@
} \
} \
} \
- EXPECT_LE(max_diff, 0); \
+ EXPECT_EQ(0, max_diff); \
for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \
for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \
int abs_diff = \
@@ -1167,8 +1167,8 @@
const int kDestWidth = benchmark_width_;
const int kDestHeight = benchmark_height_ - crop_y * 2;;
const int sample_size = kWidth * kHeight +
- SUBSAMPLE(kWidth, SUBSAMP_X) *
- SUBSAMPLE(kHeight, SUBSAMP_Y) * 2;
+ SUBSAMPLE(kWidth, SUBSAMP_X) *
+ SUBSAMPLE(kHeight, SUBSAMP_Y) * 2;
align_buffer_64(src_y, sample_size);
uint8* src_uv = src_y + kWidth * kHeight;
@@ -1192,7 +1192,7 @@
for (int i = 0; i < kHeight; ++i)
for (int j = 0; j < kWidth; ++j)
src_y[(i * kWidth) + j] = (random() & 0xff);
- for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_X); ++i) {
+ for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) {
for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) {
src_uv[(i * SUBSAMPLE(kWidth, SUBSAMP_X)) + j * 2 + 0] =
(random() & 0xff);
@@ -1227,44 +1227,23 @@
kDestWidth, kDestHeight,
libyuv::kRotate0, libyuv::FOURCC_NV12);
- int max_diff = 0;
for (int i = 0; i < kDestHeight; ++i) {
for (int j = 0; j < kDestWidth; ++j) {
- int abs_diff =
- abs(static_cast<int>(dst_y[i * kWidth + j]) -
- static_cast<int>(dst_y_2[i * kWidth + j]));
- if (abs_diff > max_diff) {
- max_diff = abs_diff;
- }
+ EXPECT_EQ(dst_y[i * kWidth + j], dst_y_2[i * kWidth + j]);
}
}
- EXPECT_LE(max_diff, 0);
for (int i = 0; i < SUBSAMPLE(kDestHeight, SUBSAMP_Y); ++i) {
for (int j = 0; j < SUBSAMPLE(kDestWidth, SUBSAMP_X); ++j) {
- int abs_diff =
- abs(static_cast<int>(dst_u[i *
- SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]) -
- static_cast<int>(dst_u_2[i *
- SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]));
- if (abs_diff > max_diff) {
- max_diff = abs_diff;
- }
+ EXPECT_EQ(dst_u[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j],
+ dst_u_2[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]);
}
}
- EXPECT_LE(max_diff, 0);
for (int i = 0; i < SUBSAMPLE(kDestHeight, SUBSAMP_Y); ++i) {
for (int j = 0; j < SUBSAMPLE(kDestWidth, SUBSAMP_X); ++j) {
- int abs_diff =
- abs(static_cast<int>(dst_v[i *
- SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]) -
- static_cast<int>(dst_v_2[i *
- SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]));
- if (abs_diff > max_diff) {
- max_diff = abs_diff;
- }
+ EXPECT_EQ(dst_v[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j],
+ dst_v_2[i * SUBSAMPLE(kDestWidth, SUBSAMP_X) + j]);
}
}
- EXPECT_LE(max_diff, 0);
free_aligned_buffer_64(dst_y);
free_aligned_buffer_64(dst_u);
free_aligned_buffer_64(dst_v);