shithub: openh264

Download patch

ref: 749bc4ea7e20312e312e48f14995b18668df13b6
parent: 0c326fa3026f78fa94ad5c0e6888f597341a5996
author: dongzhang <[email protected]>
date: Fri May 16 05:29:57 EDT 2014

Fix QP<18 dequant UT bug at encoder side
This should be UT for QP<12.

--- a/test/encoder/EncUT_DecodeMbAux.cpp
+++ b/test/encoder/EncUT_DecodeMbAux.cpp
@@ -63,17 +63,18 @@
 TEST(DecodeMbAuxTest, TestDequant_4x4_luma_dc) {
   short T[16],W[16];
   srand((uint32_t)time(NULL));
-  for(int i=0;i<16;i++) {
-    T[i]=rand()%256+1;
-    W[i]=T[i];
-  }
 
-  //TODO: QP<18 will cause case fail, need fix and enable the test afterwards
-  for (int qp=18;qp<52;qp++) {
+  for (int qp=0; qp<12; qp++) {
+    for(int i=0; i<16; i++) {
+        T[i]=rand()%256+1;
+        W[i]=T[i];
+    }
     WelsDequantLumaDc4x4(W,qp);
-    for(int i=0;i<16;i++)
-      EXPECT_EQ(((T[i]*g_kuiDequantCoeff[qp%6][0]+(1 << (1 -  qp / 6))))>>(2- qp / 6),W[i]);
-   }
+    for(int i=0; i<16; i++) {
+        T[i]= (((T[i]*g_kuiDequantCoeff[qp%6][0]+(1 << (1 -  qp / 6))))>>(2- qp / 6));
+        EXPECT_EQ(T[i],W[i]);
+    }
+  }
 }
 
 TEST(DecodeMbAuxTest, TestDequant_ihdm_4x4_c) {