Skip to content

Commit

Permalink
picture_csp_enc.c: remove SafeInitSharpYuv
Browse files Browse the repository at this point in the history
thread safety was internalized in:
782ed48 sharpyuv,SharpYuvInit: add mutex protection when available

Change-Id: I2877e7bb78bf89ad7504c33d04b22952c0c0a968
  • Loading branch information
jzern committed Aug 12, 2022
1 parent 6af8845 commit e7c805c
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/enc/picture_csp_enc.c
Expand Up @@ -172,21 +172,6 @@ static const int kMinDimensionIterativeConversion = 4;
//------------------------------------------------------------------------------
// Main function

extern void SharpYuvInit(VP8CPUInfo cpu_info_func);

static void SafeInitSharpYuv(void) {
#if defined(WEBP_USE_THREAD) && !defined(_WIN32)
static pthread_mutex_t initsharpyuv_lock = PTHREAD_MUTEX_INITIALIZER;
if (pthread_mutex_lock(&initsharpyuv_lock)) return;
#endif

SharpYuvInit(VP8GetCPUInfo);

#if defined(WEBP_USE_THREAD) && !defined(_WIN32)
(void)pthread_mutex_unlock(&initsharpyuv_lock);
#endif
}

static int PreprocessARGB(const uint8_t* r_ptr,
const uint8_t* g_ptr,
const uint8_t* b_ptr,
Expand Down Expand Up @@ -483,6 +468,8 @@ static WEBP_INLINE void ConvertRowsToUV(const uint16_t* rgb,
}
}

extern void SharpYuvInit(VP8CPUInfo cpu_info_func);

static int ImportYUVAFromRGBA(const uint8_t* r_ptr,
const uint8_t* g_ptr,
const uint8_t* b_ptr,
Expand Down Expand Up @@ -518,7 +505,7 @@ static int ImportYUVAFromRGBA(const uint8_t* r_ptr,
}

if (use_iterative_conversion) {
SafeInitSharpYuv();
SharpYuvInit(VP8GetCPUInfo);
if (!PreprocessARGB(r_ptr, g_ptr, b_ptr, step, rgb_stride, picture)) {
return 0;
}
Expand Down

0 comments on commit e7c805c

Please sign in to comment.