shithub: openh264

Download patch

ref: ef0c3e2b910890aaa5a3749acd72f921569db138
parent: 5dbd3f01eacee7e7578155b4406f0544fc879eee
parent: da75e15b4abb985b11ac2fb86d76ba49f11781e2
author: huili2 <[email protected]>
date: Fri Jul 4 09:49:36 EDT 2014

Merge pull request #1075 from HaiboZhu/Debug_InvHadamard_Chroma

Debug for chroma inv-hadamard dequant mismatch error

--- a/codec/encoder/core/src/decode_mb_aux.cpp
+++ b/codec/encoder/core/src/decode_mb_aux.cpp
@@ -130,10 +130,10 @@
   const int16_t kiSumD = pDct[1] + pDct[3];
   const int16_t kiDelD =   pDct[1] -  pDct[3];
 
-  pDct[0] = (kiSumU + kiSumD) * kuiMF;
-  pDct[1] = (kiSumU  -  kiSumD) * kuiMF;
-  pDct[2] = (kiDelU   + kiDelD)   * kuiMF;
-  pDct[3] = (kiDelU   - kiDelD)   * kuiMF;
+  pDct[0] = ((kiSumU + kiSumD) * kuiMF) >> 1;
+  pDct[1] = ((kiSumU - kiSumD) * kuiMF) >> 1;
+  pDct[2] = ((kiDelU + kiDelD) * kuiMF) >> 1;
+  pDct[3] = ((kiDelU - kiDelD) * kuiMF) >> 1;
 }
 
 void WelsDequant4x4_c (int16_t* pRes, const uint16_t* kpMF) {
--- a/codec/encoder/core/src/svc_encode_mb.cpp
+++ b/codec/encoder/core/src/svc_encode_mb.cpp
@@ -304,7 +304,7 @@
   }
 
   if (uiNoneZeroCountMbDc > 0) {
-    WelsDequantIHadamard2x2Dc (aDct2x2, g_kuiDequantCoeff[kiQp][0] >> 1);
+    WelsDequantIHadamard2x2Dc (aDct2x2, g_kuiDequantCoeff[kiQp][0]);
     if (2 != (pCurMb->uiCbp >> 4))
       pCurMb->uiCbp |= (0x01 << 4) ;
     pRes[0]	= aDct2x2[0];
--- a/test/encoder/EncUT_DecodeMbAux.cpp
+++ b/test/encoder/EncUT_DecodeMbAux.cpp
@@ -156,10 +156,10 @@
   const int16_t iDelU =   pDct[0] -  pDct[2];
   const int16_t iSumD = pDct[1] + pDct[3];
   const int16_t iDelD =   pDct[1] -  pDct[3];
-  pDct[0] = (iSumU + iSumD) * iMF;
-  pDct[1] = (iSumU  -  iSumD) * iMF;
-  pDct[2] = (iDelU   + iDelD)   * iMF;
-  pDct[3] = (iDelU   -  iDelD)   * iMF;
+  pDct[0] = ((iSumU + iSumD) * iMF)>>1;
+  pDct[1] = ((iSumU - iSumD) * iMF)>>1;
+  pDct[2] = ((iDelU + iDelD) * iMF)>>1;
+  pDct[3] = ((iDelU - iDelD) * iMF)>>1;
 }
 TEST (DecodeMbAuxTest, WelsDequantIHadamard2x2Dc) {
   int16_t iDct[4], iRefDct[4];