]> granicus.if.org Git - libvpx/commitdiff
change to properly account for coef scaling in unit tests
authorYaowu Xu <yaowu@google.com>
Fri, 24 Aug 2012 16:59:49 +0000 (09:59 -0700)
committerYaowu Xu <yaowu@google.com>
Fri, 24 Aug 2012 17:11:15 +0000 (10:11 -0700)
The transform functions in experimental branch absorbed a scaling
factor of 4 to allow quantization steps closer to unit quantizer.
This commit added scaling code in between forward and inverse
transform to properly account for the scaling factor.

Change-Id: I9a573ddc1ffa74973b34800a5da1a56dbabe0949

test/fdct4x4_test.cc
test/fdct8x8_test.cc

index d88ed8df67a350a265f67e25dc0ca0ed2ece47e0..3bce41a41820436a59a09df6ba8bc91052aef86e 100644 (file)
@@ -107,6 +107,19 @@ TEST(Vp8FdctTest, RoundTripErrorCheck) {
     // to test optimized versions of this function.
     const int pitch = 8;
     vp8_short_fdct4x4_c(test_input_block, test_temp_block, pitch);
+
+    for (int j = 0; j < 16; ++j) {
+        if(test_temp_block[j] > 0) {
+          test_temp_block[j] += 2;
+          test_temp_block[j] /= 4;
+          test_temp_block[j] *= 4;
+        } else {
+          test_temp_block[j] -= 2;
+          test_temp_block[j] /= 4;
+          test_temp_block[j] *= 4;
+        }
+    }
+
     // Because the bitstream is not frozen yet, use the idct in the codebase.
     vp8_short_idct4x4llm_c(test_temp_block, test_output_block, pitch);
 
@@ -118,7 +131,6 @@ TEST(Vp8FdctTest, RoundTripErrorCheck) {
       total_error += error;
     }
   }
-
   EXPECT_GE(1, max_error)
       << "Error: FDCT/IDCT has an individual roundtrip error > 1";
 
index 28b6afb0cd0db70c94235431dbf6c4cc56cb4b8e..068d98e10a5e5eede4fbda37ab72812d56a1a50e 100644 (file)
@@ -101,6 +101,17 @@ TEST(VP8Fdct8x8Test, RoundTripErrorCheck) {
 
     const int pitch = 16;
     vp8_short_fdct8x8_c(test_input_block, test_temp_block, pitch);
+    for (int j = 0; j < 64; ++j){
+        if(test_temp_block[j] > 0) {
+          test_temp_block[j] += 2;
+          test_temp_block[j] /= 4;
+          test_temp_block[j] *= 4;
+        } else {
+          test_temp_block[j] -= 2;
+          test_temp_block[j] /= 4;
+          test_temp_block[j] *= 4;
+        }
+    }
     vp8_short_idct8x8_c(test_temp_block, test_output_block, pitch);
 
     for (int j = 0; j < 64; ++j) {