From 0cbbdde3d55ccfe581ad2ca1b2a4bf7caf752d3a Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Thu, 11 Oct 2012 20:53:05 +0000 Subject: [PATCH] memset v210 destination buffer to 0 to attempt valgrind fix. BUG=91 TEST=I420ToV210 Review URL: https://webrtc-codereview.appspot.com/872008 git-svn-id: http://libyuv.googlecode.com/svn/trunk@407 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/cpu_id.h | 2 +- include/libyuv/version.h | 2 +- source/convert.cc | 2 +- unit_test/planar_test.cc | 15 ++++++++++----- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.chromium b/README.chromium index e9d0882b9..30eaf6e54 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 406 +Version: 407 License: BSD License File: LICENSE diff --git a/include/libyuv/cpu_id.h b/include/libyuv/cpu_id.h index 0914f1d23..87bbd4ded 100644 --- a/include/libyuv/cpu_id.h +++ b/include/libyuv/cpu_id.h @@ -46,8 +46,8 @@ int ArmCpuCaps(const char* cpuinfo_name); // Detect CPU has SSE2 etc. // Test_flag parameter should be one of kCpuHas constants above. // returns non-zero if instruction set is detected +LIBYUV_API extern int cpu_info_; static __inline int TestCpuFlag(int test_flag) { - LIBYUV_API extern int cpu_info_; return (cpu_info_ ? cpu_info_ : InitCpuFlags()) & test_flag; } diff --git a/include/libyuv/version.h b/include/libyuv/version.h index bce1a0f61..d2bccdfd4 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 406 +#define LIBYUV_VERSION 407 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/convert.cc b/source/convert.cc index 0f21b03fa..b672ad5a0 100644 --- a/source/convert.cc +++ b/source/convert.cc @@ -765,7 +765,7 @@ static void V210ToUYVYRow_C(const uint8* src_v210, uint8* dst_uyvy, int width) { // Convert V210 to I420. // V210 is 10 bit version of UYVY. 16 bytes to store 6 pixels. -// With is multiple of 48. +// Width is multiple of 48 pixels = 128 bytes. LIBYUV_API int V210ToI420(const uint8* src_v210, int src_stride_v210, uint8* dst_y, int dst_stride_y, diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index 677148340..288593eea 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -143,15 +143,20 @@ TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \ align_buffer_16(src_v, kWidth / SUBSAMP_X * kHeight / SUBSAMP_Y); \ align_buffer_16(dst_argb_c, kStrideB * kHeight); \ align_buffer_16(dst_argb_opt, kStrideB * kHeight); \ + memset(dst_argb_c, 0, kStrideB * kHeight); \ + memset(dst_argb_opt, 0, kStrideB * kHeight); \ srandom(time(NULL)); \ - for (int i = 0; i < kHeight; ++i) \ - for (int j = 0; j < kWidth; ++j) \ + 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 < kHeight / SUBSAMP_Y; ++i) \ + } \ + } \ + for (int i = 0; i < kHeight / SUBSAMP_Y; ++i) { \ for (int j = 0; j < kWidth / SUBSAMP_X; ++j) { \ src_u[(i * kWidth / SUBSAMP_X) + j] = (random() & 0xff); \ src_v[(i * kWidth / SUBSAMP_X) + j] = (random() & 0xff); \ } \ + } \ MaskCpuFlags(kCpuInitialized); \ FMT_PLANAR##To##FMT_B(src_y, kWidth, \ src_u, kWidth / SUBSAMP_X, \ @@ -208,9 +213,9 @@ TESTPLANARTOB(I422, 2, 1, ABGR, 4, 4) TESTPLANARTOB(I422, 2, 1, RGBA, 4, 4) TESTPLANARTOB(I411, 4, 1, ARGB, 4, 4) TESTPLANARTOB(I444, 1, 1, ARGB, 4, 4) +TESTPLANARTOB(I420, 2, 2, V210, 16 / 6, 128) TESTPLANARTOB(I420, 2, 2, YUY2, 2, 4) TESTPLANARTOB(I420, 2, 2, UYVY, 2, 4) -TESTPLANARTOB(I420, 2, 2, V210, 16 / 6, 128) TESTPLANARTOB(I420, 2, 2, I400, 1, 1) TESTPLANARTOB(I420, 2, 2, BayerBGGR, 1, 1) TESTPLANARTOB(I420, 2, 2, BayerRGGB, 1, 1) @@ -372,11 +377,11 @@ TESTATOPLANAR(ARGB4444, 2, I420, 2, 2) TESTATOPLANAR(ARGB, 4, I422, 2, 1) // TESTATOPLANAR(ARGB, 4, I444, 1, 1) // TODO(fbarchard): Implement and test 411 and 444 +TESTATOPLANAR(V210, 16 / 6, I420, 2, 2) TESTATOPLANAR(YUY2, 2, I420, 2, 2) TESTATOPLANAR(UYVY, 2, I420, 2, 2) TESTATOPLANAR(YUY2, 2, I422, 2, 1) TESTATOPLANAR(UYVY, 2, I422, 2, 1) -TESTATOPLANAR(V210, 16 / 6, I420, 2, 2) TESTATOPLANAR(I400, 1, I420, 2, 2) TESTATOPLANAR(BayerBGGR, 1, I420, 2, 2) TESTATOPLANAR(BayerRGGB, 1, I420, 2, 2)