dsp/cost*.c: rework WEBP_USE_<arch> ifdef

add a dummy init rather than repeating the '#ifdef WEBP_USE_...'
pattern.

Change-Id: Ie9bee5eaf9daebe0909ab1dda1cf1aa4ee1ef03e
This commit is contained in:
James Zern 2015-03-19 20:35:00 -07:00
parent 29fd6f90c0
commit 48e4ffd15e
3 changed files with 19 additions and 13 deletions

View File

@ -137,18 +137,19 @@ static void SetResidualCoeffs(const int16_t* const coeffs,
res->coeffs = coeffs; res->coeffs = coeffs;
} }
#endif // WEBP_USE_MIPS32
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Entry point // Entry point
extern void VP8EncDspCostInitMIPS32(void); extern void VP8EncDspCostInitMIPS32(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPS32(void) { WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPS32(void) {
#if defined(WEBP_USE_MIPS32)
VP8GetResidualCost = GetResidualCost; VP8GetResidualCost = GetResidualCost;
VP8SetResidualCoeffs = SetResidualCoeffs; VP8SetResidualCoeffs = SetResidualCoeffs;
#endif // WEBP_USE_MIPS32
} }
//------------------------------------------------------------------------------ #else // !WEBP_USE_MIPS32
extern void VP8EncDspCostInitMIPS32(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPS32(void) {}
#endif // WEBP_USE_MIPS32

View File

@ -91,17 +91,18 @@ static int GetResidualCost(int ctx0, const VP8Residual* const res) {
return cost; return cost;
} }
#endif // WEBP_USE_MIPS_DSP_R2
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Entry point // Entry point
extern void VP8EncDspCostInitMIPSdspR2(void); extern void VP8EncDspCostInitMIPSdspR2(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPSdspR2(void) { WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPSdspR2(void) {
#if defined(WEBP_USE_MIPS_DSP_R2)
VP8GetResidualCost = GetResidualCost; VP8GetResidualCost = GetResidualCost;
#endif // WEBP_USE_MIPS_DSP_R2
} }
//------------------------------------------------------------------------------ #else // !WEBP_USE_MIPS_DSP_R2
extern void VP8EncDspCostInitMIPSdspR2(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitMIPSdspR2(void) {}
#endif // WEBP_USE_MIPS_DSP_R2

View File

@ -106,7 +106,6 @@ static int GetResidualCostSSE2(int ctx0, const VP8Residual* const res) {
} }
return cost; return cost;
} }
#endif // WEBP_USE_SSE2
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Entry point // Entry point
@ -114,8 +113,13 @@ static int GetResidualCostSSE2(int ctx0, const VP8Residual* const res) {
extern void VP8EncDspCostInitSSE2(void); extern void VP8EncDspCostInitSSE2(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitSSE2(void) { WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitSSE2(void) {
#if defined(WEBP_USE_SSE2)
VP8SetResidualCoeffs = SetResidualCoeffsSSE2; VP8SetResidualCoeffs = SetResidualCoeffsSSE2;
VP8GetResidualCost = GetResidualCostSSE2; VP8GetResidualCost = GetResidualCostSSE2;
#endif // WEBP_USE_SSE2
} }
#else // !WEBP_USE_SSE2
extern void VP8EncDspCostInitSSE2(void);
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitSSE2(void) {}
#endif // WEBP_USE_SSE2