shithub: openh264

Download patch

ref: 46220cfb3b08d564e804f68121e0de7a6912fecc
parent: 0ec686f7ec405ca3406fb120f3ee061907600d92
parent: 86c1f0d2c6aabb65b9278f76400bd151d4ff4997
author: HaiboZhu <[email protected]>
date: Tue May 17 06:51:18 EDT 2016

Merge pull request #2461 from HaiboZhu/Bugfix_remove_undefined_behavior_warning

Remove the undefined behavior waring in parse_cabac

--- a/codec/decoder/core/src/parse_mb_syn_cabac.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cabac.cpp
@@ -934,7 +934,8 @@
   } else if (iResProperty == CHROMA_DC_U || iResProperty == CHROMA_DC_V) {
     do {
       if (pSignificantMap[j] != 0)
-        sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (pSignificantMap[j] * pDeQuantMul[0]) >> 4 :
+        sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (int16_t) ((int64_t)pSignificantMap[j] *
+                                 (int64_t)pDeQuantMul[0] >> 4) :
                                  (pSignificantMap[j] * pDeQuantMul[0]);
       ++j;
     } while (j < 16);
@@ -941,7 +942,8 @@
   } else { //luma ac, chroma ac
     do {
       if (pSignificantMap[j] != 0)
-        sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (pSignificantMap[j] * pDeQuantMul[pScanTable[j]] >> 4) :
+        sTCoeff[pScanTable[j]] = pCtx->bUseScalingList ? (int16_t) ((int64_t)pSignificantMap[j] *
+                                 (int64_t)pDeQuantMul[pScanTable[j]] >> 4) :
                                  pSignificantMap[j] * pDeQuantMul[pScanTable[j] & 0x07];
       ++j;
     } while (j < 16);