shithub: openh264

Download patch

ref: eb7cdf2bda97f6b8cbadc5cb5bbffe4863de683d
parent: 4aa22da81287317578fb01c36d0c5d026b12d442
author: Martin Storsjö <[email protected]>
date: Sun Jun 29 10:20:40 EDT 2014

Rename some decoder tables to match the name used in the encoder

--- a/codec/decoder/core/inc/mb_cache.h
+++ b/codec/decoder/core/inc/mb_cache.h
@@ -58,9 +58,9 @@
 ////////////////////////mapping scan index////////////////////////
 
 // for data sharing cross modules and try to reduce size of binary generated
-extern const uint8_t g_kuiMbNonZeroCountIdx[24];
+extern const uint8_t g_kuiMbCountScan4Idx[24];
 extern const uint8_t g_kuiCache30ScanIdx[16];
-extern const uint8_t g_kuiCacheNzcScanIdx[24];
+extern const uint8_t g_kuiCache48CountScan4Idx[24];
 
 extern const uint8_t g_kuiScan4[16];
 
--- a/codec/decoder/core/inc/wels_common_basis.h
+++ b/codec/decoder/core/inc/wels_common_basis.h
@@ -41,7 +41,7 @@
 
 // for data sharing cross modules and try to reduce size of binary generated
 
-extern const uint8_t g_kuiChromaQp[52];
+extern const uint8_t g_kuiChromaQpTable[52];
 
 /*common use table*/
 extern const uint8_t g_kuiScan8[24];
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -149,7 +149,7 @@
   WelsChromaDcIdct (pCurLayer->pScaledTCoeff[iMbXy] + 320);	// 320 = 16*16 + 16*4
 
   for (i = 0; i < 16; i++) { //luma
-    iIndex = g_kuiMbNonZeroCountIdx[i];
+    iIndex = g_kuiMbCountScan4Idx[i];
     if (pCurLayer->pNzc[iMbXy][iIndex]) {
       iOffset = ((iIndex >> 2) << 2) * iStrideL + ((iIndex % 4) << 2);
       pCtx->pIdctResAddPredFunc (pDstY + iOffset, iStrideL, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4));
@@ -157,13 +157,13 @@
   }
 
   for (i = 0; i < 4; i++) { //chroma
-    iIndex = g_kuiMbNonZeroCountIdx[i + 16]; //Cb
+    iIndex = g_kuiMbCountScan4Idx[i + 16]; //Cb
     if (pCurLayer->pNzc[iMbXy][iIndex] || * (pCurLayer->pScaledTCoeff[iMbXy] + ((i + 16) << 4))) {
       iOffset = (((iIndex - 16) >> 2) << 2) * iStrideC + (((iIndex - 16) % 4) << 2);
       pCtx->pIdctResAddPredFunc (pDstU + iOffset, iStrideC, pCurLayer->pScaledTCoeff[iMbXy] + ((i + 16) << 4));
     }
 
-    iIndex = g_kuiMbNonZeroCountIdx[i + 20]; //Cr
+    iIndex = g_kuiMbCountScan4Idx[i + 20]; //Cr
     if (pCurLayer->pNzc[iMbXy][iIndex] || * (pCurLayer->pScaledTCoeff[iMbXy] + ((i + 20) << 4))) {
       iOffset = (((iIndex - 18) >> 2) << 2) * iStrideC + (((iIndex - 18) % 4) << 2);
       pCtx->pIdctResAddPredFunc (pDstV + iOffset, iStrideC , pCurLayer->pScaledTCoeff[iMbXy] + ((i + 20) << 4));
@@ -553,7 +553,7 @@
 
   if (pCurLayer->pCbp[iMbXy] == 0 && IS_INTRA4x4 (pCurLayer->pMbType[iMbXy])) {
     pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
-    pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQp[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] +
+    pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] +
                                   pSliceHeader->pPps->iChromaQpIndexOffset, 0, 51)];
 
   }
@@ -582,7 +582,7 @@
       return ERR_INFO_INVALID_QP;
     }
     pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy];
-    pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQp[WELS_CLIP3 (pSlice->iLastMbQp + pSliceHeader->pPps->iChromaQpIndexOffset, 0,
+    pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + pSliceHeader->pPps->iChromaQpIndexOffset, 0,
                                   51)];
 
 
@@ -622,8 +622,8 @@
             iIndex++;
           }
         } else {
-          ST16 (&pNonZeroCount[g_kuiCacheNzcScanIdx[ (iId8x8 << 2)]], 0);
-          ST16 (&pNonZeroCount[g_kuiCacheNzcScanIdx[ (iId8x8 << 2) + 2]], 0);
+          ST16 (&pNonZeroCount[g_kuiCache48CountScan4Idx[ (iId8x8 << 2)]], 0);
+          ST16 (&pNonZeroCount[g_kuiCache48CountScan4Idx[ (iId8x8 << 2) + 2]], 0);
         }
       }
       ST32A4 (&pNzc[0], LD32 (&pNonZeroCount[1 + 8 * 1]));
@@ -857,7 +857,7 @@
   ST32A4 (&pNzc[20], 0);
   if (pCurLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurLayer->pMbType[iMbXy]) && !IS_I_BL (pCurLayer->pMbType[iMbXy])) {
     pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
-    pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQp[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] +
+    pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] +
                                   pSliceHeader->pPps->iChromaQpIndexOffset, 0, 51)];
   }
 
@@ -885,7 +885,7 @@
       return ERR_INFO_INVALID_QP;
     }
     pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy];
-    pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQp[WELS_CLIP3 (pSlice->iLastMbQp + pSliceHeader->pPps->iChromaQpIndexOffset, 0,
+    pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + pSliceHeader->pPps->iChromaQpIndexOffset, 0,
                                   51)];
 
     BsStartCavlc (pBs);
@@ -924,8 +924,8 @@
             iIndex++;
           }
         } else {
-          ST16 (&pNonZeroCount[g_kuiCacheNzcScanIdx[iId8x8 << 2]], 0);
-          ST16 (&pNonZeroCount[g_kuiCacheNzcScanIdx[ (iId8x8 << 2) + 2]], 0);
+          ST16 (&pNonZeroCount[g_kuiCache48CountScan4Idx[iId8x8 << 2]], 0);
+          ST16 (&pNonZeroCount[g_kuiCache48CountScan4Idx[ (iId8x8 << 2) + 2]], 0);
         }
       }
       ST32A4 (&pNzc[0], LD32 (&pNonZeroCount[1 + 8 * 1]));
@@ -1019,7 +1019,7 @@
     if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag ||
         (pNalCur->sNalHeaderExt.uiQualityId == 0 && pNalCur->sNalHeaderExt.uiDependencyId == 0)) {
       pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
-      pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQp[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] +
+      pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] +
                                     pSliceHeader->pPps->iChromaQpIndexOffset, 0, 51)];
     }
 
--- a/codec/decoder/core/src/decoder_data_tables.cpp
+++ b/codec/decoder/core/src/decoder_data_tables.cpp
@@ -41,7 +41,7 @@
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 //////non_zero_count[16+8] mapping scan index
-const uint8_t g_kuiMbNonZeroCountIdx[24] = {
+const uint8_t g_kuiMbCountScan4Idx[24] = {
   //  0   1 | 4  5      luma 8*8 block           non_zero_count[16+8]
   0,  1,  4,  5,   //  2   3 | 6  7        0  |  1                  0   1   2   3
   2,  3,  6,  7,   //---------------      ---------                 4   5   6   7
@@ -52,7 +52,7 @@
 };
 //cache element equal to 26
 
-const uint8_t g_kuiCacheNzcScanIdx[24] = {
+const uint8_t g_kuiCache48CountScan4Idx[24] = {
   /* Luma */
   9, 10, 17, 18,	// 1+1*8, 2+1*8, 1+2*8, 2+2*8,
   11, 12, 19, 20,	// 3+1*8, 4+1*8, 3+2*8, 4+2*8,
@@ -87,7 +87,7 @@
 
 // extern at wels_common_basis.h
 
-const uint8_t g_kuiChromaQp[52] = {
+const uint8_t g_kuiChromaQpTable[52] = {
   0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
   12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
   28, 29, 29, 30, 31, 32, 32, 33, 34, 34, 35, 35, 36, 36, 37, 37,
--- a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
@@ -687,11 +687,11 @@
   //////////////////////////////////////////////////////////////////////////
 
   if (bChroma) {
-    iCurNonZeroCacheIdx = g_kuiCacheNzcScanIdx[iIndex];
+    iCurNonZeroCacheIdx = g_kuiCache48CountScan4Idx[iIndex];
     nA = pNonZeroCountCache[iCurNonZeroCacheIdx - 1];
     nB = pNonZeroCountCache[iCurNonZeroCacheIdx - 8];
   } else { //luma
-    iCurNonZeroCacheIdx = g_kuiCacheNzcScanIdx[iIndex];
+    iCurNonZeroCacheIdx = g_kuiCache48CountScan4Idx[iIndex];
     nA = pNonZeroCountCache[iCurNonZeroCacheIdx - 1];
     nB = pNonZeroCountCache[iCurNonZeroCacheIdx - 8];
   }
--- a/codec/decoder/core/src/rec_mb.cpp
+++ b/codec/decoder/core/src/rec_mb.cpp
@@ -93,7 +93,7 @@
 
     pGetI4x4LumaPredFunc[uiMode] (pPredI4x4, iLumaStride);
 
-    if (pDqLayer->pNzc[iMBXY][g_kuiMbNonZeroCountIdx[i]]) {
+    if (pDqLayer->pNzc[iMBXY][g_kuiMbCountScan4Idx[i]]) {
       int16_t* pRSI4x4 = &pRS[i << 4];
       pIdctResAddPredFunc (pPredI4x4, iLumaStride, pRSI4x4);
     }
@@ -149,7 +149,7 @@
     int16_t* pRSI4x4 = pRS + (i << 4);
     uint8_t* pPredI4x4 = pPred + pBlockOffset[i];
 
-    if (pDqLayer->pNzc[iMBXY][g_kuiMbNonZeroCountIdx[i]] || pRSI4x4[0]) {
+    if (pDqLayer->pNzc[iMBXY][g_kuiMbCountScan4Idx[i]] || pRSI4x4[0]) {
       pIdctResAddPredFunc (pPredI4x4, iYStride, pRSI4x4);
     }
   }
@@ -454,7 +454,7 @@
         int16_t* pRSI4x4 = &pRS[j << 4];
         uint8_t* pPredI4x4 = pPred + pBlockOffset[j];
 
-        if (pDqLayer->pNzc[iMBXY][g_kuiMbNonZeroCountIdx[16 + (i << 2) + j]] || pRSI4x4[0]) {
+        if (pDqLayer->pNzc[iMBXY][g_kuiMbCountScan4Idx[16 + (i << 2) + j]] || pRSI4x4[0]) {
           pIdctResAddPredFunc (pPredI4x4, iChromaStride, pRSI4x4);
         }
       }