ref: f02d0aa6677216b78d3e1150d82e237b5608a0a1
parent: 2c9f19474af5ee681dddcb88e02b14d5f9b283d8
parent: 6412884211d7f7c7fa3b9fe9be8549a2ed7533ae
author: Ethan Hugg <[email protected]>
date: Fri Jan 10 16:32:21 EST 2014
Merge pull request #137 from mstorsjo/const-global-tables 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
@@ -106,10 +106,10 @@
void WelsHadamardT4Dc_sse2 (int16_t* pLumaDc, int16_t* pDct);
int32_t WelsHadamardQuant2x2Skip_mmx (int16_t* pRes, int16_t iFF, int16_t iMF);
-void WelsQuant4x4_sse2 (int16_t* pDct, int16_t* pFF, int16_t* pMF);
-void WelsQuant4x4Dc_sse2 (int16_t* pDct, int16_t iFF, int16_t iMF);
-void WelsQuantFour4x4_sse2 (int16_t* pDct, int16_t* pFF, int16_t* pMF);
-void WelsQuantFour4x4Max_sse2 (int16_t* pDct, int16_t* pFF, int16_t* pMF, int16_t* pMax);
+void WelsQuant4x4_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF);
+void WelsQuant4x4Dc_sse2 (int16_t* pDct, const int16_t iFF, const int16_t iMF);
+void WelsQuantFour4x4_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF);
+void WelsQuantFour4x4Max_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax);
/****************************************************************************
@@ -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/inc/wels_func_ptr_def.h
+++ b/codec/encoder/core/inc/wels_func_ptr_def.h
@@ -61,8 +61,8 @@
typedef int32_t (*PCalculateSingleCtrFunc) (int16_t* pDct);
typedef void (*PTransformHadamard4x4Func) (int16_t* pLumaDc, int16_t* pDct);
-typedef void (*PQuantizationFunc) (int16_t* pDct, int16_t* pFF, int16_t* pMF);
-typedef void (*PQuantizationMaxFunc) (int16_t* pDct, int16_t* pFF, int16_t* pMF, int16_t* pMax);
+typedef void (*PQuantizationFunc) (int16_t* pDct, const int16_t* pFF, const int16_t* pMF);
+typedef void (*PQuantizationMaxFunc) (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax);
typedef void (*PQuantizationDcFunc) (int16_t* pDct, int16_t iFF, int16_t iMF);
typedef BOOL_T (*PQuantizationSkipFunc) (int16_t* pDct, int16_t iFF, int16_t iMF);
typedef int32_t (*PQuantizationHadamardFunc) (int16_t* pRes, const int16_t kiFF, int16_t iMF, int16_t* pDct,
--- 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 },
@@ -165,7 +165,7 @@
#define WELS_ABS_LC(a) ((iSign ^ (int32_t)(a)) - iSign)
#define NEW_QUANT(pDct, iFF, iMF) (((iFF)+ WELS_ABS_LC(pDct))*(iMF)) >>16
#define WELS_NEW_QUANT(pDct,iFF,iMF) WELS_ABS_LC(NEW_QUANT(pDct, iFF, iMF))
-void WelsQuant4x4_c (int16_t* pDct, int16_t* pFF, int16_t* pMF) {
+void WelsQuant4x4_c (int16_t* pDct, const int16_t* pFF, const int16_t* pMF) {
int32_t i, j, iSign;
for (i = 0; i < 16; i += 4) {
j = i & 0x07;
@@ -194,7 +194,7 @@
}
}
-void WelsQuantFour4x4_c (int16_t* pDct, int16_t* pFF, int16_t* pMF) {
+void WelsQuantFour4x4_c (int16_t* pDct, const int16_t* pFF, const int16_t* pMF) {
int32_t i, j, iSign;
for (i = 0; i < 64; i += 4) {
@@ -210,7 +210,7 @@
}
}
-void WelsQuantFour4x4Max_c (int16_t* pDct, int16_t* pFF, int16_t* pMF, int16_t* pMax) {
+void WelsQuantFour4x4Max_c (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax) {
int32_t i, j, k, iSign;
int16_t iMaxAbs;
for (k = 0; k < 4; k++) {
--- 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
};