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
This commit is contained in:
James Zern 2020-09-10 18:31:23 -07:00
parent 55a080e50a
commit cf847cba58
2 changed files with 9 additions and 9 deletions

View File

@ -494,13 +494,11 @@ static int GetCoeffsAlt(VP8BitReader* const br,
return 16; return 16;
} }
static WEBP_TSAN_IGNORE_FUNCTION void InitGetCoeffs(void) { WEBP_DSP_INIT_FUNC(InitGetCoeffs) {
if (GetCoeffs == NULL) { if (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kSlowSSSE3)) {
if (VP8GetCPUInfo != NULL && VP8GetCPUInfo(kSlowSSSE3)) { GetCoeffs = GetCoeffsAlt;
GetCoeffs = GetCoeffsAlt; } else {
} else { GetCoeffs = GetCoeffsFast;
GetCoeffs = GetCoeffsFast;
}
} }
} }

View File

@ -90,8 +90,9 @@ int WebPPictureHasTransparency(const WebPPicture* picture) {
static int kLinearToGammaTab[kGammaTabSize + 1]; static int kLinearToGammaTab[kGammaTabSize + 1];
static uint16_t kGammaToLinearTab[256]; static uint16_t kGammaToLinearTab[256];
static volatile int kGammaTablesOk = 0; static volatile int kGammaTablesOk = 0;
static void InitGammaTables(void);
static WEBP_TSAN_IGNORE_FUNCTION void InitGammaTables(void) { WEBP_DSP_INIT_FUNC(InitGammaTables) {
if (!kGammaTablesOk) { if (!kGammaTablesOk) {
int v; int v;
const double scale = (double)(1 << kGammaTabFix) / kGammaScale; const double scale = (double)(1 << kGammaTabFix) / kGammaScale;
@ -181,8 +182,9 @@ static uint32_t kLinearToGammaTabS[kGammaTabSize + 2];
#define GAMMA_TO_LINEAR_BITS 14 #define GAMMA_TO_LINEAR_BITS 14
static uint32_t kGammaToLinearTabS[MAX_Y_T + 1]; // size scales with Y_FIX static uint32_t kGammaToLinearTabS[MAX_Y_T + 1]; // size scales with Y_FIX
static volatile int kGammaTablesSOk = 0; 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 assert(2 * GAMMA_TO_LINEAR_BITS < 32); // we use uint32_t intermediate values
if (!kGammaTablesSOk) { if (!kGammaTablesSOk) {
int v; int v;