Mark some read-only global tables const

This commit is contained in:
Martin Storsjö 2014-01-10 23:36:13 +02:00
parent 61117c85d8
commit 6412884211
4 changed files with 19 additions and 12 deletions

View File

@ -127,8 +127,8 @@ void WelsCopy16x16NotAligned_sse2 (uint8_t* Dst, int32_t iStrideD, uint8_t* Src
}
#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

View File

@ -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_kiQuantInterFF[58][8]) = {
__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 },

View File

@ -71,7 +71,8 @@ void WelsEncRecI16x16Y (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache) {
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 @@ void WelsEncRecI4x4Y (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache, uin
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 @@ void WelsEncInterY (SWelsFuncPtrList* pFuncList, SMB* pCurMb, SMbCache* pMbCache
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 @@ void WelsEncRecUV (SWelsFuncPtrList* pFuncList, SMB* pCurMb, SMbCache* pMbCac
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 @@ BOOL_T WelsTryPYskip (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache) {
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 @@ BOOL_T WelsTryPUVskip (sWelsEncCtx* pEncCtx, SMB* pCurMb, SMbCache* pMbCache,
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;

View File

@ -675,11 +675,11 @@ void WelsCodePOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice) {
// 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
};