mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
picture_csp_enc.c: remove SafeInitSharpYuv
thread safety was internalized in:
782ed48c
sharpyuv,SharpYuvInit: add mutex protection when available
Change-Id: I2877e7bb78bf89ad7504c33d04b22952c0c0a968
This commit is contained in:
parent
6af8845a8f
commit
e7c805cfad
@ -172,21 +172,6 @@ static const int kMinDimensionIterativeConversion = 4;
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Main function
|
// 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,
|
static int PreprocessARGB(const uint8_t* r_ptr,
|
||||||
const uint8_t* g_ptr,
|
const uint8_t* g_ptr,
|
||||||
const uint8_t* b_ptr,
|
const uint8_t* b_ptr,
|
||||||
@ -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,
|
static int ImportYUVAFromRGBA(const uint8_t* r_ptr,
|
||||||
const uint8_t* g_ptr,
|
const uint8_t* g_ptr,
|
||||||
const uint8_t* b_ptr,
|
const uint8_t* b_ptr,
|
||||||
@ -518,7 +505,7 @@ static int ImportYUVAFromRGBA(const uint8_t* r_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (use_iterative_conversion) {
|
if (use_iterative_conversion) {
|
||||||
SafeInitSharpYuv();
|
SharpYuvInit(VP8GetCPUInfo);
|
||||||
if (!PreprocessARGB(r_ptr, g_ptr, b_ptr, step, rgb_stride, picture)) {
|
if (!PreprocessARGB(r_ptr, g_ptr, b_ptr, step, rgb_stride, picture)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user