ref: d84d739ec88fb445a5d2d8af109642dba77c04c6
parent: 9ef09861cfb133e5a6947bb5d166eb72396c7b27
author: Martin Storsjö <martin@martin.st>
date: Thu Jun 26 10:38:35 EDT 2014
Hardwire functions set up in WelsInitFillingPredFuncs These are never overridden by any assembler optimized versions. (The assembler optimized intra predictor functions may use such optimized code internally anyway.) This avoids global writable data.
--- a/codec/encoder/core/inc/get_intra_predictor.h
+++ b/codec/encoder/core/inc/get_intra_predictor.h
@@ -165,7 +165,6 @@
}
#endif//__cplusplus
-void WelsInitFillingPredFuncs (const uint32_t kuiCpuFlag);
void WelsInitIntraPredFuncs (SWelsFuncPtrList* pFuncList, const uint32_t kuiCpuFlag);
}
--- a/codec/encoder/core/src/encoder.cpp
+++ b/codec/encoder/core/src/encoder.cpp
@@ -181,7 +181,6 @@
InitExpandPictureFunc (& (pFuncList->sExpandPicFunc), uiCpuFlag);
/* Intra_Prediction_fn*/
- WelsInitFillingPredFuncs (uiCpuFlag);
WelsInitIntraPredFuncs (pFuncList, uiCpuFlag);
/* ME func */
--- a/codec/encoder/core/src/get_intra_predictor.cpp
+++ b/codec/encoder/core/src/get_intra_predictor.cpp
@@ -65,27 +65,9 @@
ST64 (pPred + 8, LD64 (kuiSrc8));
}
-PFillingPred WelsFillingPred8to16;
-PFillingPred WelsFillingPred8x2to16;
-PFillingPred1to16 WelsFillingPred1to16;
-
-void WelsInitFillingPredFuncs (const uint32_t kuiCpuFlag) {
- WelsFillingPred8to16 = WelsFillingPred8to16_c;
- WelsFillingPred8x2to16 = WelsFillingPred8x2to16_c;
- WelsFillingPred1to16 = WelsFillingPred1to16_c;
-
-#if defined(X86_ASM)
- if (kuiCpuFlag & WELS_CPU_MMXEXT) {
- // WelsFillingPred8to16 = WelsFillingPred8to16_mmx;
- // WelsFillingPred8x2to16 = WelsFillingPred8x2to16_mmx;
- // WelsFillingPred1to16 = WelsFillingPred1to16_mmx;
- }
- if (kuiCpuFlag & WELS_CPU_SSE2) {
- // WelsFillingPred8x2to16 = WelsFillingPred8x2to16_sse2;
- // WelsFillingPred1to16 = WelsFillingPred1to16_sse2;
- }
-#endif//X86_ASM
-}
+#define WelsFillingPred8to16 WelsFillingPred8to16_c
+#define WelsFillingPred8x2to16 WelsFillingPred8x2to16_c
+#define WelsFillingPred1to16 WelsFillingPred1to16_c
--- a/test/encoder/EncUT_GetIntraPredictor.cpp
+++ b/test/encoder/EncUT_GetIntraPredictor.cpp
@@ -14,8 +14,6 @@
pRef[i] = rand() % 256;
const int32_t kkiStride = 0;
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredV_c (pPred, pRef, kkiStride);
for (int i = 0; i < 4; i++)
@@ -47,8 +45,6 @@
const uint8_t kuiV3[4] = {kuiH3, kuiH3, kuiH3, kuiH3};
const uint8_t kuiV4[4] = {kuiH4, kuiH4, kuiH4, kuiH4};
- const uint32_t kuiCpuFlag = 0;
-
ENFORCE_STACK_ALIGN_1D (uint8_t, uiV, 16, 16) // TobeCont'd about assign opt as follows
ST32 (&uiV[0], LD32 (kuiV1));
ST32 (&uiV[4], LD32 (kuiV2));
@@ -55,7 +51,6 @@
ST32 (&uiV[8], LD32 (kuiV3));
ST32 (&uiV[12], LD32 (kuiV4));
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredH_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
@@ -99,8 +94,6 @@
uiV[11] = uiV[14] = kuiDDL5;
uiV[15] = kuiDDL6;
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredDDL_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
@@ -133,8 +126,6 @@
uiV[2] = uiV[5] = uiV[8] = kuiDLT2;
uiV[3] = kuiDLT3;
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredDDLTop_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
@@ -190,8 +181,6 @@
uiV[8] = uiV[13] = kuiDDR5;
uiV[12] = kuiDDR6;
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredDDR_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
@@ -240,8 +229,6 @@
uiV[11] = kuiVL4;
uiV[15] = kuiVL9;
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredVL_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
@@ -285,8 +272,6 @@
uiV[6] = uiV[13] = kuiVLT6;
uiV[7] = uiV[14] = uiV[15] = kuiVLT7;
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredVLTop_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
@@ -340,8 +325,6 @@
uiV[8] = kuiVR8;
uiV[12] = kuiVR9;
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredVR_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
@@ -388,8 +371,6 @@
uiV[7] = uiV[9] = kuiHU5;
memset (&uiV[10], kuiL3, 6 * sizeof (uint8_t));
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredHU_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
@@ -444,8 +425,6 @@
uiV[12] = kuiHD8;
uiV[13] = kuiHD9;
- const uint32_t kuiCpuFlag = 0;
- WelsInitFillingPredFuncs (kuiCpuFlag);
WelsI4x4LumaPredHD_c (pPred, pRef, kiStride);
for (int i = 0; i < 4; i++)
--- a/test/encoder/EncUT_Sample.cpp
+++ b/test/encoder/EncUT_Sample.cpp
@@ -83,7 +83,6 @@
uint8_t* pDec = (uint8_t*)cMemoryAlign.WelsMalloc (iLineSizeDec << 5, "pDec");
uint8_t* pEnc = (uint8_t*)cMemoryAlign.WelsMalloc (iLineSizeEnc << 5, "pEnc");
uint8_t* pDst = (uint8_t*)cMemoryAlign.WelsMalloc (512, "pDst");
- WelsInitFillingPredFuncs (WELS_CPU_SSE2);
for (int i = 0; i < (iLineSizeDec << 5); i++)
pDec[i] = rand() % 256;
for (int i = 0; i < (iLineSizeEnc << 5); i++)