From 1d93ddec19939d07b20c4e3fb0da20df1d33874a Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 19 Mar 2015 20:47:57 -0700 Subject: [PATCH] dsp/lossless*.c: rework WEBP_USE_ ifdef add a dummy init rather than repeating the '#ifdef WEBP_USE_...' pattern. Change-Id: If8b4459556e6bfaa36ef046f66520558b9444fc2 --- src/dsp/lossless_mips32.c | 11 +++++++---- src/dsp/lossless_mips_dsp_r2.c | 12 +++++++----- src/dsp/lossless_neon.c | 13 +++++++------ src/dsp/lossless_sse2.c | 15 ++++++++------- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/dsp/lossless_mips32.c b/src/dsp/lossless_mips32.c index 268222ea..49e1909c 100644 --- a/src/dsp/lossless_mips32.c +++ b/src/dsp/lossless_mips32.c @@ -396,15 +396,12 @@ static void HistogramAdd(const VP8LHistogram* const a, #undef ADD_TO_OUT #undef ASM_START -#endif // WEBP_USE_MIPS32 - //------------------------------------------------------------------------------ // Entry point extern void VP8LDspInitMIPS32(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitMIPS32(void) { -#if defined(WEBP_USE_MIPS32) VP8LFastSLog2Slow = FastSLog2Slow; VP8LFastLog2Slow = FastLog2Slow; VP8LExtraCost = ExtraCost; @@ -412,5 +409,11 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitMIPS32(void) { VP8LHuffmanCostCount = HuffmanCostCount; VP8LHuffmanCostCombinedCount = HuffmanCostCombinedCount; VP8LHistogramAdd = HistogramAdd; -#endif // WEBP_USE_MIPS32 } + +#else // !WEBP_USE_MIPS32 + +extern void VP8LDspInitMIPS32(void); +WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitMIPS32(void) {} + +#endif // WEBP_USE_MIPS32 diff --git a/src/dsp/lossless_mips_dsp_r2.c b/src/dsp/lossless_mips_dsp_r2.c index 48975670..5399292a 100644 --- a/src/dsp/lossless_mips_dsp_r2.c +++ b/src/dsp/lossless_mips_dsp_r2.c @@ -885,14 +885,12 @@ static void ConvertBGRAToBGR(const uint32_t* src, ); } -#endif // WEBP_USE_MIPS_DSP_R2 - //------------------------------------------------------------------------------ +// Entry point extern void VP8LDspInitMIPSdspR2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitMIPSdspR2(void) { -#if defined(WEBP_USE_MIPS_DSP_R2) VP8LMapColor32b = MapARGB; VP8LMapColor8b = MapAlpha; VP8LPredictors[5] = Predictor5; @@ -915,7 +913,11 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitMIPSdspR2(void) { VP8LConvertBGRAToRGBA4444 = ConvertBGRAToRGBA4444; VP8LConvertBGRAToRGB565 = ConvertBGRAToRGB565; VP8LConvertBGRAToBGR = ConvertBGRAToBGR; -#endif // WEBP_USE_MIPS_DSP_R2 } -//------------------------------------------------------------------------------ +#else // !WEBP_USE_MIPS_DSP_R2 + +extern void VP8LDspInitMIPSdspR2(void); +WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitMIPSdspR2(void) {} + +#endif // WEBP_USE_MIPS_DSP_R2 diff --git a/src/dsp/lossless_neon.c b/src/dsp/lossless_neon.c index e404646a..e544dee9 100644 --- a/src/dsp/lossless_neon.c +++ b/src/dsp/lossless_neon.c @@ -324,14 +324,12 @@ static void AddGreenToBlueAndRed(uint32_t* argb_data, int num_pixels) { #endif // WEBP_USE_INTRINSICS -#endif // WEBP_USE_NEON - //------------------------------------------------------------------------------ +// Entry point extern void VP8LDspInitNEON(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitNEON(void) { -#if defined(WEBP_USE_NEON) VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA; VP8LConvertBGRAToBGR = ConvertBGRAToBGR; VP8LConvertBGRAToRGB = ConvertBGRAToRGB; @@ -350,8 +348,11 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitNEON(void) { VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed; #endif - -#endif // WEBP_USE_NEON } -//------------------------------------------------------------------------------ +#else // !WEBP_USE_NEON + +extern void VP8LDspInitNEON(void); +WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitNEON(void) {} + +#endif // WEBP_USE_NEON diff --git a/src/dsp/lossless_sse2.c b/src/dsp/lossless_sse2.c index 565344e3..c80216ff 100644 --- a/src/dsp/lossless_sse2.c +++ b/src/dsp/lossless_sse2.c @@ -13,9 +13,8 @@ #include "./dsp.h" -#include - #if defined(WEBP_USE_SSE2) +#include #include #include "./lossless.h" @@ -499,14 +498,12 @@ static void HistogramAdd(const VP8LHistogram* const a, } } -#endif // WEBP_USE_SSE2 - //------------------------------------------------------------------------------ +// Entry point extern void VP8LDspInitSSE2(void); WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitSSE2(void) { -#if defined(WEBP_USE_SSE2) VP8LPredictors[5] = Predictor5; VP8LPredictors[6] = Predictor6; VP8LPredictors[7] = Predictor7; @@ -529,7 +526,11 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitSSE2(void) { VP8LConvertBGRAToBGR = ConvertBGRAToBGR; VP8LHistogramAdd = HistogramAdd; -#endif // WEBP_USE_SSE2 } -//------------------------------------------------------------------------------ +#else // !WEBP_USE_SSE2 + +extern void VP8LDspInitSSE2(void); +WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInitSSE2(void) {} + +#endif // WEBP_USE_SSE2