shithub: openh264

Download patch

ref: e0ba5cd9f3fe49cb9e3ed0cc5ccf91e4eeabb977
parent: ba7dca89d5c2a566a43b6bec2c3f2755a0e4bb90
author: Haibo Zhu <[email protected]>
date: Wed Jul 2 19:36:44 EDT 2014

Debug for Chroma InvHadamard Dequant 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];