shithub: openh264

Download patch

ref: 6412884211d7f7c7fa3b9fe9be8549a2ed7533ae
parent: 61117c85d86e8fc4f73c8fc48dc7ab51664cedd4
author: Martin Storsjö <[email protected]>
date: Fri Jan 10 18:36:13 EST 2014

Mark some read-only global tables const

--- a/codec/encoder/core/inc/encode_mb_aux.h
+++ b/codec/encoder/core/inc/encode_mb_aux.h
@@ -127,8 +127,8 @@
 }
 #endif//__cplusplus
 
-__align16 (extern int16_t, g_kiQuantInterFF[58][8]);
+__align16 (extern const int16_t, g_kiQuantInterFF[58][8]);
 #define g_iQuantIntraFF (g_kiQuantInterFF +6 )
-__align16 (extern int16_t, g_kiQuantMF[52][8]) ;
+__align16 (extern const int16_t, g_kiQuantMF[52][8]) ;
 }
 #endif//ENCODE_MB_AUX_H
--- a/codec/encoder/core/src/encode_mb_aux.cpp
+++ b/codec/encoder/core/src/encode_mb_aux.cpp
@@ -40,7 +40,7 @@
 #include "svc_encode_mb.h"
 namespace WelsSVCEnc {
 
-__align16 (int16_t, g_kiQuantInterFF[58][8]) = {
+__align16 (const int16_t, g_kiQuantInterFF[58][8]) = {
   /* 0*/ {   0,   1,   0,   1,   1,   1,   1,   1 },
   /* 1*/ {   0,   1,   0,   1,   1,   1,   1,   1 },
   /* 2*/ {   1,   1,   1,   1,   1,   1,   1,   1 },
@@ -104,7 +104,7 @@
 
 
 
-__align16 (int16_t, g_kiQuantMF[52][8]) = {
+__align16 (const int16_t, g_kiQuantMF[52][8]) = {
   /* 0*/	{26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486 },
   /* 1*/	{23832, 14980, 23832, 14980, 14980,  9320, 14980,  9320 },
   /* 2*/	{20164, 13108, 20164, 13108, 13108,  8388, 13108,  8388 },
--- a/codec/encoder/core/src/svc_encode_mb.cpp
+++ b/codec/encoder/core/src/svc_encode_mb.cpp
@@ -71,7 +71,8 @@
   uint8_t i, uiQp						    = pCurMb->uiLumaQp;
   uint32_t uiNoneZeroCount, uiNoneZeroCountMbAc				= 0, uiCountI16x16Dc;
 
-  int16_t* pMF = g_kiQuantMF[uiQp], *pFF	= g_iQuantIntraFF[uiQp];
+  const int16_t* pMF = g_kiQuantMF[uiQp];
+  const int16_t* pFF = g_iQuantIntraFF[uiQp];
 
   WelsDctMb (pRes,  pMbCache->SPicData.pEncMb[0], kiEncStride, pBestPred, pEncCtx->pFuncList->pfDctFourT4);
 
@@ -158,7 +159,8 @@
   uint8_t* pBestPred = pMbCache->pBestPredI4x4Blk4;
   int16_t* pBlock = pMbCache->pDct->iLumaBlock[uiI4x4Idx];
 
-  int16_t* pMF = g_kiQuantMF[uiQp], *pFF = g_iQuantIntraFF[uiQp];
+  const int16_t* pMF = g_kiQuantMF[uiQp];
+  const int16_t* pFF = g_iQuantIntraFF[uiQp];
 
   int32_t* pStrideEncBlockOffset = pEncCtx->pStrideTab->pStrideEncBlockOffset[pEncCtx->uiDependencyId];
   int32_t* pStrideDecBlockOffset = pEncCtx->pStrideTab->pStrideDecBlockOffset[pEncCtx->uiDependencyId][0 ==
@@ -193,7 +195,9 @@
   int32_t iSingleCtrMb		= 0, iSingleCtr8x8[4];
   int16_t* pBlock				= pMbCache->pDct->iLumaBlock[0];
   uint8_t uiQp					= pCurMb->uiLumaQp;
-  int16_t* pMF					= g_kiQuantMF[uiQp], *pFF = g_kiQuantInterFF[uiQp], aMax[16];
+  const int16_t* pMF = g_kiQuantMF[uiQp];
+  const int16_t* pFF = g_kiQuantInterFF[uiQp];
+  int16_t aMax[16];
   int32_t i, j, iNoneZeroCountMbDcAc	= 0, iNoneZeroCount = 0;
 
   for (i = 0; i < 4; i++) {
@@ -262,7 +266,8 @@
   int16_t* iChromaDc			= pMbCache->pDct->iChromaDc[iUV - 1], *pBlock = pMbCache->pDct->iChromaBlock[ (iUV - 1) << 2];
   int16_t aDct2x2[4], j, aMax[4];
   int32_t iSingleCtr8x8		= 0;
-  int16_t* pMF = g_kiQuantMF[kiQp], *pFF = g_kiQuantInterFF[ (!kiInterFlag) * 6 + kiQp];
+  const int16_t* pMF = g_kiQuantMF[kiQp];
+  const int16_t* pFF = g_kiQuantInterFF[ (!kiInterFlag) * 6 + kiQp];
 
   uiNoneZeroCountMbDc = pfQuantizationHadamard2x2 (pRes, pFF[0] << 1, pMF[0]>>1, aDct2x2, iChromaDc);
 
@@ -333,7 +338,8 @@
 
   int16_t* pBlock = pMbCache->pDct->iLumaBlock[0];
   uint16_t aMax[4], i, j;
-  int16_t* pMF = g_kiQuantMF[kuiQp], *pFF = g_kiQuantInterFF[kuiQp];
+  const int16_t* pMF = g_kiQuantMF[kuiQp];
+  const int16_t* pFF = g_kiQuantInterFF[kuiQp];
 
   for (i = 0; i < 4; i++) {
     pEncCtx->pFuncList->pfQuantizationFour4x4Max (pRes, pFF,  pMF, (int16_t*)aMax);
@@ -358,7 +364,8 @@
   const uint8_t kuiQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp +
                         pEncCtx->pCurDqLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset)];
 
-  int16_t* pMF = g_kiQuantMF[kuiQp], *pFF = g_kiQuantInterFF[kuiQp];
+  const int16_t* pMF = g_kiQuantMF[kuiQp];
+  const int16_t* pFF = g_kiQuantInterFF[kuiQp];
 
   if (pEncCtx->pFuncList->pfQuantizationHadamard2x2Skip (pRes, pFF[0] << 1, pMF[0]>>1))
     return FALSE;
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -675,11 +675,11 @@
 
 // 1st index: 0: for P pSlice; 1: for I pSlice;
 // 2nd index: 0: for non-dynamic pSlice; 1: for dynamic I pSlice;
-PWelsCodingSliceFunc	g_pWelsSliceCoding[2][2] = {
+const PWelsCodingSliceFunc	g_pWelsSliceCoding[2][2] = {
   { WelsCodePSlice, WelsCodePOverDynamicSlice },	// P SSlice
   { WelsISliceMdEnc, WelsISliceMdEncDynamic }	// I SSlice
 };
-PWelsSliceHeaderWriteFunc		g_pWelsWriteSliceHeader[2] = {	// 0: for base; 1: for ext;
+const PWelsSliceHeaderWriteFunc		g_pWelsWriteSliceHeader[2] = {	// 0: for base; 1: for ext;
   WelsSliceHeaderWrite,
   WelsSliceHeaderExtWrite
 };