Merge "multi-thread fix: lock each entry points with a static var"

This commit is contained in:
Pascal Massimino 2015-01-07 00:03:51 -08:00 committed by Gerrit Code Review
commit 9592053859
7 changed files with 40 additions and 1 deletions

View File

@ -347,7 +347,11 @@ extern void VP8FiltersInitMIPSdspR2(void);
extern void WebPInitAlphaProcessingMIPSdspR2(void);
extern void WebPInitAlphaProcessingSSE2(void);
static volatile VP8CPUInfo last_cpuinfo_used = (VP8CPUInfo)&last_cpuinfo_used;
WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessing(void) {
if (last_cpuinfo_used == VP8GetCPUInfo) return;
WebPMultARGBRow = WebPMultARGBRowC;
WebPMultRow = WebPMultRowC;
WebPApplyAlphaMultiply = ApplyAlphaMultiply;
@ -370,4 +374,5 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitAlphaProcessing(void) {
}
#endif
}
last_cpuinfo_used = VP8GetCPUInfo;
}

View File

@ -42,7 +42,11 @@ void (*VP8PackRGB)(const uint8_t*, const uint8_t*, const uint8_t*,
extern void VP8EncDspARGBInitMIPSdspR2(void);
extern void VP8EncDspARGBInitSSE2(void);
static volatile VP8CPUInfo last_cpuinfo_used = (VP8CPUInfo)&last_cpuinfo_used;
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspARGBInit(void) {
if (last_cpuinfo_used == VP8GetCPUInfo) return;
VP8PackARGB = PackARGB;
VP8PackRGB = PackRGB;
@ -59,4 +63,5 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspARGBInit(void) {
}
#endif
}
last_cpuinfo_used = VP8GetCPUInfo;
}

View File

@ -684,7 +684,11 @@ extern void VP8DspInitNEON(void);
extern void VP8DspInitMIPS32(void);
extern void VP8DspInitMIPSdspR2(void);
static volatile VP8CPUInfo last_cpuinfo_used = (VP8CPUInfo)&last_cpuinfo_used;
WEBP_TSAN_IGNORE_FUNCTION void VP8DspInit(void) {
if (last_cpuinfo_used == VP8GetCPUInfo) return;
VP8InitClipTables();
VP8TransformWHT = TransformWHT;
@ -749,5 +753,5 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8DspInit(void) {
}
#endif
}
last_cpuinfo_used = VP8GetCPUInfo;
}

View File

@ -727,7 +727,11 @@ extern void VP8EncDspInitNEON(void);
extern void VP8EncDspInitMIPS32(void);
extern void VP8EncDspInitMIPSdspR2(void);
static volatile VP8CPUInfo last_cpuinfo_used = (VP8CPUInfo)&last_cpuinfo_used;
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) {
if (last_cpuinfo_used == VP8GetCPUInfo) return;
VP8DspInit(); // common inverse transforms
InitTables();
@ -779,4 +783,5 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) {
}
#endif
}
last_cpuinfo_used = VP8GetCPUInfo;
}

View File

@ -1745,7 +1745,11 @@ extern void VP8LDspInitNEON(void);
extern void VP8LDspInitMIPS32(void);
extern void VP8LDspInitMIPSdspR2(void);
static volatile VP8CPUInfo last_cpuinfo_used = (VP8CPUInfo)&last_cpuinfo_used;
WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInit(void) {
if (last_cpuinfo_used == VP8GetCPUInfo) return;
memcpy(VP8LPredictors, kPredictorsC, sizeof(VP8LPredictors));
VP8LSubtractGreenFromBlueAndRed = VP8LSubtractGreenFromBlueAndRed_C;
@ -1797,6 +1801,7 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LDspInit(void) {
}
#endif
}
last_cpuinfo_used = VP8GetCPUInfo;
}
//------------------------------------------------------------------------------

View File

@ -173,7 +173,11 @@ WebPYUV444Converter WebPYUV444Converters[MODE_LAST];
extern WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444ConvertersMIPSdspR2(void);
static volatile VP8CPUInfo last_cpuinfo_used1 = (VP8CPUInfo)&last_cpuinfo_used1;
WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444Converters(void) {
if (last_cpuinfo_used1 == VP8GetCPUInfo) return;
WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb;
WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba;
WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr;
@ -193,6 +197,7 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitYUV444Converters(void) {
}
#endif
}
last_cpuinfo_used1 = VP8GetCPUInfo;
}
//------------------------------------------------------------------------------
@ -202,7 +207,11 @@ extern WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersSSE2(void);
extern WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersNEON(void);
extern WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplersMIPSdspR2(void);
static volatile VP8CPUInfo last_cpuinfo_used2 = (VP8CPUInfo)&last_cpuinfo_used2;
WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) {
if (last_cpuinfo_used2 == VP8GetCPUInfo) return;
#ifdef FANCY_UPSAMPLING
WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair;
WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair;
@ -235,6 +244,7 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitUpsamplers(void) {
#endif
}
#endif // FANCY_UPSAMPLING
last_cpuinfo_used2 = VP8GetCPUInfo;
}
//------------------------------------------------------------------------------

View File

@ -124,7 +124,11 @@ extern WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersSSE2(void);
extern WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersMIPS32(void);
extern WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersMIPSdspR2(void);
static volatile VP8CPUInfo last_cpuinfo_used = (VP8CPUInfo)&last_cpuinfo_used;
WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplers(void) {
if (last_cpuinfo_used == VP8GetCPUInfo) return;
WebPSamplers[MODE_RGB] = YuvToRgbRow;
WebPSamplers[MODE_RGBA] = YuvToRgbaRow;
WebPSamplers[MODE_BGR] = YuvToBgrRow;
@ -155,6 +159,7 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplers(void) {
}
#endif // WEBP_USE_MIPS_DSP_R2
}
last_cpuinfo_used = VP8GetCPUInfo;
}
//-----------------------------------------------------------------------------