From cf847cba5845030fb906cff1006f37f4b28ca73a Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 10 Sep 2020 18:31:23 -0700 Subject: [PATCH] use WEBP_DSP_INIT_FUNC for Init{GammaTables*,GetCoeffs} this provides stronger synchronization when pthreads are available as was done in 'd77bf512 add WEBP_DSP_INIT / WEBP_DSP_INIT_FUNC' for the other init functions. Change-Id: I2ffe4e24454d276c2411ece34dca38d23d4756d5 --- src/dec/vp8_dec.c | 12 +++++------- src/enc/picture_csp_enc.c | 6 ++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dec/vp8_dec.c b/src/dec/vp8_dec.c index 57efb690..8f736974 100644 --- a/src/dec/vp8_dec.c +++ b/src/dec/vp8_dec.c @@ -494,13 +494,11 @@ static int GetCoeffsAlt(VP8BitReader* const br, return 16; } -static WEBP_TSAN_IGNORE_FUNCTION void InitGetCoeffs(void) { - if (GetCoeffs == NULL) { - if (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kSlowSSSE3)) { - GetCoeffs = GetCoeffsAlt; - } else { - GetCoeffs = GetCoeffsFast; - } +WEBP_DSP_INIT_FUNC(InitGetCoeffs) { + if (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kSlowSSSE3)) { + GetCoeffs = GetCoeffsAlt; + } else { + GetCoeffs = GetCoeffsFast; } } diff --git a/src/enc/picture_csp_enc.c b/src/enc/picture_csp_enc.c index 718e014e..368837b7 100644 --- a/src/enc/picture_csp_enc.c +++ b/src/enc/picture_csp_enc.c @@ -90,8 +90,9 @@ int WebPPictureHasTransparency(const WebPPicture* picture) { static int kLinearToGammaTab[kGammaTabSize + 1]; static uint16_t kGammaToLinearTab[256]; static volatile int kGammaTablesOk = 0; +static void InitGammaTables(void); -static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTables(void) { +WEBP_DSP_INIT_FUNC(InitGammaTables) { if (!kGammaTablesOk) { int v; const double scale = (double)(1 << kGammaTabFix) / kGammaScale; @@ -181,8 +182,9 @@ static uint32_t kLinearToGammaTabS[kGammaTabSize + 2]; #define GAMMA_TO_LINEAR_BITS 14 static uint32_t kGammaToLinearTabS[MAX_Y_T + 1]; // size scales with Y_FIX static volatile int kGammaTablesSOk = 0; +static void InitGammaTablesS(void); -static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTablesS(void) { +WEBP_DSP_INIT_FUNC(InitGammaTablesS) { assert(2 * GAMMA_TO_LINEAR_BITS < 32); // we use uint32_t intermediate values if (!kGammaTablesSOk) { int v;