mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 13:18:22 +01:00
move VP8GetCPUInfo declaration to cpu.c
This avoids defining a version in each translation unit when using __declspec(dllexport) which causes failures due to multiply defined symbols with clang-cl: lld-link: error: duplicate symbol: VP8GetCPUInfo >>> defined at CMakeFiles\webpdecode.dir\Debug\src\dec\alpha_dec.c.obj >>> defined at CMakeFiles\webpdsp.dir\Debug\src\dsp\dec_sse41.c.obj ... Bug: webp:607 Change-Id: I6cd1ee75b3db984aa513263a05516e867a64925d
This commit is contained in:
parent
916548c28c
commit
8151f388eb
@ -440,6 +440,7 @@ static int DoSharpArgbToYuv(const uint8_t* r_ptr, const uint8_t* g_ptr,
|
||||
// By default SharpYuvConvert calls it with SharpYuvGetCPUInfo. If needed,
|
||||
// users can declare it as extern and call it with an alternate VP8CPUInfo
|
||||
// function.
|
||||
extern VP8CPUInfo SharpYuvGetCPUInfo;
|
||||
SHARPYUV_EXTERN void SharpYuvInit(VP8CPUInfo cpu_info_func);
|
||||
void SharpYuvInit(VP8CPUInfo cpu_info_func) {
|
||||
static volatile VP8CPUInfo sharpyuv_last_cpuinfo_used =
|
||||
|
@ -72,6 +72,7 @@ void (*SharpYuvFilterRow)(const int16_t* A, const int16_t* B, int len,
|
||||
const uint16_t* best_y, uint16_t* out,
|
||||
int bit_depth);
|
||||
|
||||
extern VP8CPUInfo SharpYuvGetCPUInfo;
|
||||
extern void InitSharpYuvSSE2(void);
|
||||
extern void InitSharpYuvNEON(void);
|
||||
|
||||
|
@ -494,6 +494,8 @@ static int GetCoeffsAlt(VP8BitReader* const br,
|
||||
return 16;
|
||||
}
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
|
||||
WEBP_DSP_INIT_FUNC(InitGetCoeffs) {
|
||||
if (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kSlowSSSE3)) {
|
||||
GetCoeffs = GetCoeffsAlt;
|
||||
|
@ -425,6 +425,7 @@ void (*WebPAlphaReplace)(uint32_t* src, int length, uint32_t color);
|
||||
//------------------------------------------------------------------------------
|
||||
// Init function
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void WebPInitAlphaProcessingMIPSdspR2(void);
|
||||
extern void WebPInitAlphaProcessingSSE2(void);
|
||||
extern void WebPInitAlphaProcessingSSE41(void);
|
||||
|
@ -374,6 +374,7 @@ static void SetResidualCoeffs_C(const int16_t* const coeffs,
|
||||
VP8GetResidualCostFunc VP8GetResidualCost;
|
||||
VP8SetResidualCoeffsFunc VP8SetResidualCoeffs;
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void VP8EncDspCostInitMIPS32(void);
|
||||
extern void VP8EncDspCostInitMIPSdspR2(void);
|
||||
extern void VP8EncDspCostInitSSE2(void);
|
||||
|
@ -173,6 +173,7 @@ static int x86CPUInfo(CPUFeature feature) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
|
||||
VP8CPUInfo VP8GetCPUInfo = x86CPUInfo;
|
||||
#elif defined(WEBP_ANDROID_NEON) // NB: needs to be before generic NEON test.
|
||||
static int AndroidCPUInfo(CPUFeature feature) {
|
||||
@ -184,6 +185,7 @@ static int AndroidCPUInfo(CPUFeature feature) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
|
||||
VP8CPUInfo VP8GetCPUInfo = AndroidCPUInfo;
|
||||
#elif defined(EMSCRIPTEN) // also needs to be before generic NEON test
|
||||
// Use compile flags as an indicator of SIMD support instead of a runtime check.
|
||||
@ -208,6 +210,7 @@ static int wasmCPUInfo(CPUFeature feature) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
|
||||
VP8CPUInfo VP8GetCPUInfo = wasmCPUInfo;
|
||||
#elif defined(WEBP_HAVE_NEON)
|
||||
// In most cases this function doesn't check for NEON support (it's assumed by
|
||||
@ -236,6 +239,7 @@ static int armCPUInfo(CPUFeature feature) {
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
|
||||
VP8CPUInfo VP8GetCPUInfo = armCPUInfo;
|
||||
#elif defined(WEBP_USE_MIPS32) || defined(WEBP_USE_MIPS_DSP_R2) || \
|
||||
defined(WEBP_USE_MSA)
|
||||
@ -247,7 +251,9 @@ static int mipsCPUInfo(CPUFeature feature) {
|
||||
}
|
||||
|
||||
}
|
||||
WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
|
||||
VP8CPUInfo VP8GetCPUInfo = mipsCPUInfo;
|
||||
#else
|
||||
WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
|
||||
VP8CPUInfo VP8GetCPUInfo = NULL;
|
||||
#endif
|
||||
|
@ -242,16 +242,7 @@ typedef enum {
|
||||
kMSA
|
||||
} CPUFeature;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// returns true if the CPU supports the feature.
|
||||
typedef int (*VP8CPUInfo)(CPUFeature feature);
|
||||
WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // WEBP_DSP_CPU_H_
|
||||
|
@ -734,6 +734,7 @@ VP8SimpleFilterFunc VP8SimpleHFilter16i;
|
||||
void (*VP8DitherCombine8x8)(const uint8_t* dither, uint8_t* dst,
|
||||
int dst_stride);
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void VP8DspInitSSE2(void);
|
||||
extern void VP8DspInitSSE41(void);
|
||||
extern void VP8DspInitNEON(void);
|
||||
|
@ -732,6 +732,7 @@ VP8QuantizeBlockWHT VP8EncQuantizeBlockWHT;
|
||||
VP8BlockCopy VP8Copy4x4;
|
||||
VP8BlockCopy VP8Copy16x8;
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void VP8EncDspInitSSE2(void);
|
||||
extern void VP8EncDspInitSSE41(void);
|
||||
extern void VP8EncDspInitNEON(void);
|
||||
|
@ -233,6 +233,7 @@ static void GradientUnfilter_C(const uint8_t* prev, const uint8_t* in,
|
||||
WebPFilterFunc WebPFilters[WEBP_FILTER_LAST];
|
||||
WebPUnfilterFunc WebPUnfilters[WEBP_FILTER_LAST];
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void VP8FiltersInitMIPSdspR2(void);
|
||||
extern void VP8FiltersInitMSA(void);
|
||||
extern void VP8FiltersInitNEON(void);
|
||||
|
@ -588,6 +588,7 @@ VP8LConvertFunc VP8LConvertBGRAToBGR;
|
||||
VP8LMapARGBFunc VP8LMapColor32b;
|
||||
VP8LMapAlphaFunc VP8LMapColor8b;
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void VP8LDspInitSSE2(void);
|
||||
extern void VP8LDspInitSSE41(void);
|
||||
extern void VP8LDspInitNEON(void);
|
||||
|
@ -791,6 +791,7 @@ VP8LBundleColorMapFunc VP8LBundleColorMap;
|
||||
VP8LPredictorAddSubFunc VP8LPredictorsSub[16];
|
||||
VP8LPredictorAddSubFunc VP8LPredictorsSub_C[16];
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void VP8LEncDspInitSSE2(void);
|
||||
extern void VP8LEncDspInitSSE41(void);
|
||||
extern void VP8LEncDspInitNEON(void);
|
||||
|
@ -197,6 +197,7 @@ WebPRescalerImportRowFunc WebPRescalerImportRowShrink;
|
||||
WebPRescalerExportRowFunc WebPRescalerExportRowExpand;
|
||||
WebPRescalerExportRowFunc WebPRescalerExportRowShrink;
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void WebPRescalerDspInitSSE2(void);
|
||||
extern void WebPRescalerDspInitMIPS32(void);
|
||||
extern void WebPRescalerDspInitMIPSdspR2(void);
|
||||
|
@ -137,6 +137,7 @@ VP8SSIMGetClippedFunc VP8SSIMGetClipped;
|
||||
VP8AccumulateSSEFunc VP8AccumulateSSE;
|
||||
#endif
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void VP8SSIMDspInitSSE2(void);
|
||||
|
||||
WEBP_DSP_INIT_FUNC(VP8SSIMDspInit) {
|
||||
|
@ -215,6 +215,7 @@ static void EmptyYuv444Func(const uint8_t* y,
|
||||
|
||||
WebPYUV444Converter WebPYUV444Converters[MODE_LAST];
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void WebPInitYUV444ConvertersMIPSdspR2(void);
|
||||
extern void WebPInitYUV444ConvertersSSE2(void);
|
||||
extern void WebPInitYUV444ConvertersSSE41(void);
|
||||
|
@ -70,6 +70,7 @@ void WebPSamplerProcessPlane(const uint8_t* y, int y_stride,
|
||||
|
||||
WebPSamplerRowFunc WebPSamplers[MODE_LAST];
|
||||
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
extern void WebPInitSamplersSSE2(void);
|
||||
extern void WebPInitSamplersSSE41(void);
|
||||
extern void WebPInitSamplersMIPS32(void);
|
||||
|
@ -98,6 +98,7 @@ static int kLinearToGammaTab[GAMMA_TAB_SIZE + 1];
|
||||
static uint16_t kGammaToLinearTab[256];
|
||||
static volatile int kGammaTablesOk = 0;
|
||||
static void InitGammaTables(void);
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
|
||||
WEBP_DSP_INIT_FUNC(InitGammaTables) {
|
||||
if (!kGammaTablesOk) {
|
||||
|
@ -74,6 +74,11 @@ static WEBP_INLINE uint32_t Extract(uint32_t max_value,
|
||||
//------------------------------------------------------------------------------
|
||||
// Some functions to override VP8GetCPUInfo and disable some optimizations.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" VP8CPUInfo VP8GetCPUInfo;
|
||||
#else
|
||||
extern VP8CPUInfo VP8GetCPUInfo;
|
||||
#endif
|
||||
static VP8CPUInfo GetCPUInfo;
|
||||
|
||||
static WEBP_INLINE int GetCPUInfoNoSSE41(CPUFeature feature) {
|
||||
|
Loading…
Reference in New Issue
Block a user