mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
move static initialization of WebPYUV444Converters[] to the Init function.
Split initialization of YUV444Converters[] out of Upsamplers init. update test for NULL function pointers Change-Id: I9603f54250f90c85a12ffbecfd6c59e9b06c47e0
This commit is contained in:
parent
49911d4df2
commit
e6c4b52f28
@ -516,6 +516,7 @@ static int InitRGBRescaler(const VP8Io* const io, WebPDecParams* const p) {
|
|||||||
io->mb_w, 2 * out_width, io->mb_h, 2 * out_height,
|
io->mb_w, 2 * out_width, io->mb_h, 2 * out_height,
|
||||||
work + 2 * work_size);
|
work + 2 * work_size);
|
||||||
p->emit = EmitRescaledRGB;
|
p->emit = EmitRescaledRGB;
|
||||||
|
WebPInitYUV444Converters();
|
||||||
|
|
||||||
if (has_alpha) {
|
if (has_alpha) {
|
||||||
WebPRescalerInit(&p->scaler_a, io->mb_w, io->mb_h,
|
WebPRescalerInit(&p->scaler_a, io->mb_w, io->mb_h,
|
||||||
|
@ -243,6 +243,8 @@ extern WebPYUV444Converter WebPYUV444Converters[/* MODE_LAST */];
|
|||||||
void WebPInitUpsamplers(void);
|
void WebPInitUpsamplers(void);
|
||||||
// Must be called before using WebPSamplers[]
|
// Must be called before using WebPSamplers[]
|
||||||
void WebPInitSamplers(void);
|
void WebPInitSamplers(void);
|
||||||
|
// Must be called before using WebPYUV444Converters[]
|
||||||
|
void WebPInitYUV444Converters(void);
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Utilities for processing transparent channel.
|
// Utilities for processing transparent channel.
|
||||||
|
@ -169,19 +169,31 @@ YUV444_FUNC(Yuv444ToRgb565, VP8YuvToRgb565, 2)
|
|||||||
|
|
||||||
#undef YUV444_FUNC
|
#undef YUV444_FUNC
|
||||||
|
|
||||||
WebPYUV444Converter WebPYUV444Converters[MODE_LAST] = {
|
WebPYUV444Converter WebPYUV444Converters[MODE_LAST];
|
||||||
Yuv444ToRgb, // MODE_RGB
|
|
||||||
Yuv444ToRgba, // MODE_RGBA
|
extern void WebPInitYUV444ConvertersMIPSdspR2(void);
|
||||||
Yuv444ToBgr, // MODE_BGR
|
|
||||||
Yuv444ToBgra, // MODE_BGRA
|
void WebPInitYUV444Converters(void) {
|
||||||
Yuv444ToArgb, // MODE_ARGB
|
WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb;
|
||||||
Yuv444ToRgba4444, // MODE_RGBA_4444
|
WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba;
|
||||||
Yuv444ToRgb565, // MODE_RGB_565
|
WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr;
|
||||||
Yuv444ToRgba, // MODE_rgbA
|
WebPYUV444Converters[MODE_BGRA] = Yuv444ToBgra;
|
||||||
Yuv444ToBgra, // MODE_bgrA
|
WebPYUV444Converters[MODE_ARGB] = Yuv444ToArgb;
|
||||||
Yuv444ToArgb, // MODE_Argb
|
WebPYUV444Converters[MODE_RGBA_4444] = Yuv444ToRgba4444;
|
||||||
Yuv444ToRgba4444 // MODE_rgbA_4444
|
WebPYUV444Converters[MODE_RGB_565] = Yuv444ToRgb565;
|
||||||
};
|
WebPYUV444Converters[MODE_rgbA] = Yuv444ToRgba;
|
||||||
|
WebPYUV444Converters[MODE_bgrA] = Yuv444ToBgra;
|
||||||
|
WebPYUV444Converters[MODE_Argb] = Yuv444ToArgb;
|
||||||
|
WebPYUV444Converters[MODE_rgbA_4444] = Yuv444ToRgba4444;
|
||||||
|
|
||||||
|
if (VP8GetCPUInfo != NULL) {
|
||||||
|
#if defined(WEBP_USE_MIPS_DSP_R2)
|
||||||
|
if (VP8GetCPUInfo(kMIPSdspR2)) {
|
||||||
|
WebPInitYUV444ConvertersMIPSdspR2();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Main calls
|
// Main calls
|
||||||
@ -216,16 +228,13 @@ void WebPInitUpsamplers(void) {
|
|||||||
WebPInitUpsamplersNEON();
|
WebPInitUpsamplersNEON();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif // FANCY_UPSAMPLING
|
|
||||||
|
|
||||||
if (VP8GetCPUInfo != NULL) {
|
|
||||||
#if defined(WEBP_USE_MIPS_DSP_R2)
|
#if defined(WEBP_USE_MIPS_DSP_R2)
|
||||||
if (VP8GetCPUInfo(kMIPSdspR2)) {
|
if (VP8GetCPUInfo(kMIPSdspR2)) {
|
||||||
WebPInitUpsamplersMIPSdspR2();
|
WebPInitUpsamplersMIPSdspR2();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif // FANCY_UPSAMPLING
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -213,9 +213,33 @@ UPSAMPLE_FUNC(UpsampleRgb565LinePair, YuvToRgb565, 2)
|
|||||||
|
|
||||||
#endif // FANCY_UPSAMPLING
|
#endif // FANCY_UPSAMPLING
|
||||||
|
|
||||||
|
#endif // WEBP_USE_MIPS_DSP_R2
|
||||||
|
|
||||||
|
extern void WebPInitUpsamplersMIPSdspR2(void);
|
||||||
|
|
||||||
|
void WebPInitUpsamplersMIPSdspR2(void) {
|
||||||
|
#if defined(WEBP_USE_MIPS_DSP_R2)
|
||||||
|
#ifdef FANCY_UPSAMPLING
|
||||||
|
WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair;
|
||||||
|
WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair;
|
||||||
|
WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair;
|
||||||
|
WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair;
|
||||||
|
WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair;
|
||||||
|
WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair;
|
||||||
|
WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair;
|
||||||
|
WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair;
|
||||||
|
WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair;
|
||||||
|
WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair;
|
||||||
|
WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair;
|
||||||
|
#endif // FANCY_UPSAMPLING
|
||||||
|
#endif // WEBP_USE_MIPS_DSP_R2
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// YUV444 converter
|
// YUV444 converter
|
||||||
|
|
||||||
|
#if defined(WEBP_USE_MIPS_DSP_R2)
|
||||||
|
|
||||||
#define YUV444_FUNC(FUNC_NAME, FUNC, XSTEP) \
|
#define YUV444_FUNC(FUNC_NAME, FUNC, XSTEP) \
|
||||||
static void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \
|
static void FUNC_NAME(const uint8_t* y, const uint8_t* u, const uint8_t* v, \
|
||||||
uint8_t* dst, int len) { \
|
uint8_t* dst, int len) { \
|
||||||
@ -235,25 +259,10 @@ YUV444_FUNC(Yuv444ToRgb565, YuvToRgb565, 2)
|
|||||||
|
|
||||||
#endif // WEBP_USE_MIPS_DSP_R2
|
#endif // WEBP_USE_MIPS_DSP_R2
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
extern void WebPInitYUV444ConvertersMIPSdspR2(void);
|
||||||
|
|
||||||
extern void WebPInitUpsamplersMIPSdspR2(void);
|
void WebPInitYUV444ConvertersMIPSdspR2(void) {
|
||||||
|
|
||||||
void WebPInitUpsamplersMIPSdspR2(void) {
|
|
||||||
#if defined(WEBP_USE_MIPS_DSP_R2)
|
#if defined(WEBP_USE_MIPS_DSP_R2)
|
||||||
#ifdef FANCY_UPSAMPLING
|
|
||||||
WebPUpsamplers[MODE_RGB] = UpsampleRgbLinePair;
|
|
||||||
WebPUpsamplers[MODE_RGBA] = UpsampleRgbaLinePair;
|
|
||||||
WebPUpsamplers[MODE_BGR] = UpsampleBgrLinePair;
|
|
||||||
WebPUpsamplers[MODE_BGRA] = UpsampleBgraLinePair;
|
|
||||||
WebPUpsamplers[MODE_ARGB] = UpsampleArgbLinePair;
|
|
||||||
WebPUpsamplers[MODE_RGBA_4444] = UpsampleRgba4444LinePair;
|
|
||||||
WebPUpsamplers[MODE_RGB_565] = UpsampleRgb565LinePair;
|
|
||||||
WebPUpsamplers[MODE_rgbA] = UpsampleRgbaLinePair;
|
|
||||||
WebPUpsamplers[MODE_bgrA] = UpsampleBgraLinePair;
|
|
||||||
WebPUpsamplers[MODE_Argb] = UpsampleArgbLinePair;
|
|
||||||
WebPUpsamplers[MODE_rgbA_4444] = UpsampleRgba4444LinePair;
|
|
||||||
#endif // FANCY_UPSAMPLING
|
|
||||||
WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb;
|
WebPYUV444Converters[MODE_RGB] = Yuv444ToRgb;
|
||||||
WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba;
|
WebPYUV444Converters[MODE_RGBA] = Yuv444ToRgba;
|
||||||
WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr;
|
WebPYUV444Converters[MODE_BGR] = Yuv444ToBgr;
|
||||||
|
Loading…
Reference in New Issue
Block a user