shithub: libvpx

Download patch

ref: b0e5775ebc1df5b1dedc7702bd420cc8679b1014
parent: 519d9f3e16a9e78efe4f04d4fe94643dc3f54a51
author: James Zern <jzern@google.com>
date: Thu May 2 08:29:34 EDT 2013

convolve_test: remove unnecessary memset

input_ is filled with random values just afterward.
the size was wrong anyway as input_ is allocated with memalign so
sizeof(input_)==sizeof(uint8_t*)

Change-Id: I014b832ac60960cd22b6f369dbc9fd648d4055b5

--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -173,10 +173,9 @@
   static void SetUpTestCase() {
     // Force input_ to be unaligned, output to be 16 byte aligned.
     input_ = reinterpret_cast<uint8_t*>(
-        vpx_memalign(kDataAlignment, kOuterBlockSize * kOuterBlockSize + 1))
-        + 1;
+        vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + 1;
     output_ = reinterpret_cast<uint8_t*>(
-        vpx_memalign(kDataAlignment, kOuterBlockSize * kOuterBlockSize));
+        vpx_memalign(kDataAlignment, kOutputBufferSize));
   }
 
   static void TearDownTestCase() {
@@ -192,6 +191,8 @@
     static const int kInputStride = kOuterBlockSize;
     static const int kOutputStride = kOuterBlockSize;
     static const int kMaxDimension = 64;
+    static const int kInputBufferSize = kOuterBlockSize * kOuterBlockSize;
+    static const int kOutputBufferSize = kOuterBlockSize * kOuterBlockSize;
 
     int Width() const { return GET_PARAM(0); }
     int Height() const { return GET_PARAM(1); }
@@ -210,9 +211,8 @@
 
     virtual void SetUp() {
       UUT_ = GET_PARAM(2);
-      memset(input_, 0, sizeof(input_));
       /* Set up guard blocks for an inner block cetered in the outer block */
-      for (int i = 0; i < kOuterBlockSize * kOuterBlockSize; ++i) {
+      for (int i = 0; i < kOutputBufferSize; ++i) {
         if (IsIndexInBorder(i))
           output_[i] = 255;
         else
@@ -220,12 +220,12 @@
       }
 
       ::libvpx_test::ACMRandom prng;
-      for (int i = 0; i < kOuterBlockSize * kOuterBlockSize; ++i)
+      for (int i = 0; i < kInputBufferSize; ++i)
         input_[i] = prng.Rand8Extremes();
     }
 
     void CheckGuardBlocks() {
-      for (int i = 0; i < kOuterBlockSize * kOuterBlockSize; ++i) {
+      for (int i = 0; i < kOutputBufferSize; ++i) {
         if (IsIndexInBorder(i))
           EXPECT_EQ(255, output_[i]);
       }