mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
Make libsharpyuv self-contained by removing dependency on cpu.c
Change-Id: I2edac1afa38bfddf2a91e7829e38425bd3519feb
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
//
|
||||
// Author: Christian Duvivier (cduvivier@google.com)
|
||||
|
||||
#include "src/dsp/dsp.h"
|
||||
#include "src/dsp/cpu.h"
|
||||
|
||||
#if defined(WEBP_HAVE_NEON_RTCD)
|
||||
#include <stdio.h>
|
||||
|
@ -22,6 +22,11 @@
|
||||
#include "src/dsp/dsp.h"
|
||||
#include "src/dsp/lossless.h"
|
||||
#include "src/dsp/yuv.h"
|
||||
#include "src/dsp/cpu.h"
|
||||
|
||||
#if defined(WEBP_USE_THREAD) && !defined(_WIN32)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
// Uncomment to disable gamma-compression during RGB->U/V averaging
|
||||
#define USE_GAMMA_COMPRESSION
|
||||
@ -174,6 +179,21 @@ typedef uint16_t fixed_y_t; // unsigned type with extra SFIX precision for W
|
||||
//------------------------------------------------------------------------------
|
||||
// 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,
|
||||
@ -495,6 +515,7 @@ static int ImportYUVAFromRGBA(const uint8_t* r_ptr,
|
||||
}
|
||||
|
||||
if (use_iterative_conversion) {
|
||||
SafeInitSharpYuv();
|
||||
if (!PreprocessARGB(r_ptr, g_ptr, b_ptr, step, rgb_stride, picture)) {
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user