mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
valgrind fix to CropNV12 unittest. round crop amount to multiple of 2 so UV will be an even number.
BUG=350 TESTED=drmemory out\debug\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*CropNV12 R=harryjin@google.com Review URL: https://webrtc-codereview.appspot.com/14159004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@1050 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
bf24367476
commit
77564a9323
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1049
|
||||
Version: 1050
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1049
|
||||
#define LIBYUV_VERSION 1050
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||
|
||||
@ -66,7 +66,7 @@ TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
srandom(time(NULL)); \
|
||||
for (int i = 0; i < kHeight; ++i) \
|
||||
for (int j = 0; j < kWidth; ++j) \
|
||||
src_y[(i * kWidth) + j + OFF] = (random() & 0xff); \
|
||||
src_y[i * kWidth + j + OFF] = (random() & 0xff); \
|
||||
for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \
|
||||
for (int j = 0; j < SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \
|
||||
src_u[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \
|
||||
@ -203,7 +203,7 @@ TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
srandom(time(NULL)); \
|
||||
for (int i = 0; i < kHeight; ++i) \
|
||||
for (int j = 0; j < kWidth; ++j) \
|
||||
src_y[(i * kWidth) + j + OFF] = (random() & 0xff); \
|
||||
src_y[i * kWidth + j + OFF] = (random() & 0xff); \
|
||||
for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \
|
||||
for (int j = 0; j < SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \
|
||||
src_u[(i * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \
|
||||
@ -316,7 +316,7 @@ TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
|
||||
srandom(time(NULL)); \
|
||||
for (int i = 0; i < kHeight; ++i) \
|
||||
for (int j = 0; j < kWidth; ++j) \
|
||||
src_y[(i * kWidth) + j + OFF] = (random() & 0xff); \
|
||||
src_y[i * kWidth + j + OFF] = (random() & 0xff); \
|
||||
for (int i = 0; i < SUBSAMPLE(kHeight, SRC_SUBSAMP_Y); ++i) { \
|
||||
for (int j = 0; j < 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X); ++j) { \
|
||||
src_uv[(i * 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X)) + j + OFF] = \
|
||||
@ -538,10 +538,10 @@ TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \
|
||||
srandom(time(NULL)); \
|
||||
for (int i = 0; i < kHeight; ++i) \
|
||||
for (int j = 0; j < kWidth; ++j) \
|
||||
src_y[(i * kWidth) + j + OFF] = (random() & 0xff); \
|
||||
src_y[i * kWidth + j + OFF] = (random() & 0xff); \
|
||||
for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \
|
||||
for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X) * 2; ++j) { \
|
||||
src_uv[(i * SUBSAMPLE(kWidth, SUBSAMP_X)) * 2 + j + OFF] = \
|
||||
src_uv[i * SUBSAMPLE(kWidth, SUBSAMP_X) * 2 + j + OFF] = \
|
||||
(random() & 0xff); \
|
||||
} \
|
||||
} \
|
||||
@ -1163,7 +1163,7 @@ TEST_F(libyuvTest, CropNV12) {
|
||||
const int kWidth = benchmark_width_;
|
||||
const int kHeight = benchmark_height_;
|
||||
const int crop_y =
|
||||
(benchmark_height_ - (benchmark_height_ * 360 / 480)) / 2;
|
||||
((benchmark_height_ - (benchmark_height_ * 360 / 480)) / 2 + 1) & ~1;
|
||||
const int kDestWidth = benchmark_width_;
|
||||
const int kDestHeight = benchmark_height_ - crop_y * 2;;
|
||||
const int sample_size = kWidth * kHeight +
|
||||
@ -1189,16 +1189,12 @@ TEST_F(libyuvTest, CropNV12) {
|
||||
SUBSAMPLE(kDestHeight, SUBSAMP_Y));
|
||||
|
||||
srandom(time(NULL));
|
||||
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_Y); ++i) {
|
||||
for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) {
|
||||
src_uv[(i * SUBSAMPLE(kWidth, SUBSAMP_X)) + j * 2 + 0] =
|
||||
(random() & 0xff);
|
||||
src_uv[(i * SUBSAMPLE(kWidth, SUBSAMP_X)) + j * 2 + 1] =
|
||||
(random() & 0xff);
|
||||
for (int i = 0; i < kHeight * kWidth; ++i) {
|
||||
src_y[i] = (random() & 0xff);
|
||||
}
|
||||
for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y) *
|
||||
SUBSAMPLE(kWidth, SUBSAMP_X) * 2; ++i) {
|
||||
src_uv[i] = (random() & 0xff);
|
||||
}
|
||||
memset(dst_y, 1, kDestWidth * kDestHeight);
|
||||
memset(dst_u, 2, SUBSAMPLE(kDestWidth, SUBSAMP_X) *
|
||||
@ -1211,13 +1207,6 @@ TEST_F(libyuvTest, CropNV12) {
|
||||
memset(dst_v_2, 3, SUBSAMPLE(kDestWidth, SUBSAMP_X) *
|
||||
SUBSAMPLE(kDestHeight, SUBSAMP_Y));
|
||||
|
||||
NV12ToI420(src_y + crop_y * kWidth, kWidth,
|
||||
src_uv + (crop_y / 2) * kWidth, kWidth,
|
||||
dst_y, kDestWidth,
|
||||
dst_u, SUBSAMPLE(kDestWidth, SUBSAMP_X),
|
||||
dst_v, SUBSAMPLE(kDestWidth, SUBSAMP_X),
|
||||
kDestWidth, kDestHeight);
|
||||
|
||||
ConvertToI420(src_y, sample_size,
|
||||
dst_y_2, kDestWidth,
|
||||
dst_u_2, SUBSAMPLE(kDestWidth, SUBSAMP_X),
|
||||
@ -1227,6 +1216,13 @@ TEST_F(libyuvTest, CropNV12) {
|
||||
kDestWidth, kDestHeight,
|
||||
libyuv::kRotate0, libyuv::FOURCC_NV12);
|
||||
|
||||
NV12ToI420(src_y + crop_y * kWidth, kWidth,
|
||||
src_uv + (crop_y / 2) * kWidth, kWidth,
|
||||
dst_y, kDestWidth,
|
||||
dst_u, SUBSAMPLE(kDestWidth, SUBSAMP_X),
|
||||
dst_v, SUBSAMPLE(kDestWidth, SUBSAMP_X),
|
||||
kDestWidth, kDestHeight);
|
||||
|
||||
for (int i = 0; i < kDestHeight; ++i) {
|
||||
for (int j = 0; j < kDestWidth; ++j) {
|
||||
EXPECT_EQ(dst_y[i * kWidth + j], dst_y_2[i * kWidth + j]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user