VP8LConvertFromBGRA: use conversion function pointers

Change-Id: I863b97119d7487e4eef337e5df69e1ae2a911d4c
This commit is contained in:
skal 2014-03-27 09:00:35 +01:00
parent 6d2f35273d
commit 514fc251df
2 changed files with 26 additions and 26 deletions

View File

@ -1405,17 +1405,17 @@ void VP8LConvertFromBGRA(const uint32_t* const in_data, int num_pixels,
WEBP_CSP_MODE out_colorspace, uint8_t* const rgba) { WEBP_CSP_MODE out_colorspace, uint8_t* const rgba) {
switch (out_colorspace) { switch (out_colorspace) {
case MODE_RGB: case MODE_RGB:
ConvertBGRAToRGB(in_data, num_pixels, rgba); VP8LConvertBGRAToRGB(in_data, num_pixels, rgba);
break; break;
case MODE_RGBA: case MODE_RGBA:
ConvertBGRAToRGBA(in_data, num_pixels, rgba); VP8LConvertBGRAToRGBA(in_data, num_pixels, rgba);
break; break;
case MODE_rgbA: case MODE_rgbA:
ConvertBGRAToRGBA(in_data, num_pixels, rgba); VP8LConvertBGRAToRGBA(in_data, num_pixels, rgba);
WebPApplyAlphaMultiply(rgba, 0, num_pixels, 1, 0); WebPApplyAlphaMultiply(rgba, 0, num_pixels, 1, 0);
break; break;
case MODE_BGR: case MODE_BGR:
ConvertBGRAToBGR(in_data, num_pixels, rgba); VP8LConvertBGRAToBGR(in_data, num_pixels, rgba);
break; break;
case MODE_BGRA: case MODE_BGRA:
CopyOrSwap(in_data, num_pixels, rgba, 1); CopyOrSwap(in_data, num_pixels, rgba, 1);
@ -1432,14 +1432,14 @@ void VP8LConvertFromBGRA(const uint32_t* const in_data, int num_pixels,
WebPApplyAlphaMultiply(rgba, 1, num_pixels, 1, 0); WebPApplyAlphaMultiply(rgba, 1, num_pixels, 1, 0);
break; break;
case MODE_RGBA_4444: case MODE_RGBA_4444:
ConvertBGRAToRGBA4444(in_data, num_pixels, rgba); VP8LConvertBGRAToRGBA4444(in_data, num_pixels, rgba);
break; break;
case MODE_rgbA_4444: case MODE_rgbA_4444:
ConvertBGRAToRGBA4444(in_data, num_pixels, rgba); VP8LConvertBGRAToRGBA4444(in_data, num_pixels, rgba);
WebPApplyAlphaMultiply4444(rgba, num_pixels, 1, 0); WebPApplyAlphaMultiply4444(rgba, num_pixels, 1, 0);
break; break;
case MODE_RGB_565: case MODE_RGB_565:
ConvertBGRAToRGB565(in_data, num_pixels, rgba); VP8LConvertBGRAToRGB565(in_data, num_pixels, rgba);
break; break;
default: default:
assert(0); // Code flow should not reach here. assert(0); // Code flow should not reach here.
@ -1694,10 +1694,10 @@ void VP8LDspInitSSE2(void) {
VP8LSelect = SelectSSE2; VP8LSelect = SelectSSE2;
VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRedSSE2; VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRedSSE2;
VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRedSSE2; VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRedSSE2;
VP8LConvertBGRAToRGBAFunc = ConvertBGRAToRGBASSE2; VP8LConvertBGRAToRGBA = ConvertBGRAToRGBASSE2;
VP8LConvertBGRAToRGBA4444Func = ConvertBGRAToRGBA4444SSE2; VP8LConvertBGRAToRGBA4444 = ConvertBGRAToRGBA4444SSE2;
VP8LConvertBGRAToRGB565Func = ConvertBGRAToRGB565SSE2; VP8LConvertBGRAToRGB565 = ConvertBGRAToRGB565SSE2;
VP8LConvertBGRAToBGRFunc = ConvertBGRAToBGRSSE2; VP8LConvertBGRAToBGR = ConvertBGRAToBGRSSE2;
} }
#endif // WEBP_USE_SSE2 #endif // WEBP_USE_SSE2
@ -1710,11 +1710,11 @@ VP8LPredSelectFunc VP8LSelect;
VP8LSubtractGreenFromBlueAndRedFunc VP8LSubtractGreenFromBlueAndRed; VP8LSubtractGreenFromBlueAndRedFunc VP8LSubtractGreenFromBlueAndRed;
VP8LAddGreenToBlueAndRedFunc VP8LAddGreenToBlueAndRed; VP8LAddGreenToBlueAndRedFunc VP8LAddGreenToBlueAndRed;
VP8LConvertFunc VP8LConvertBGRAToRGBFunc; VP8LConvertFunc VP8LConvertBGRAToRGB;
VP8LConvertFunc VP8LConvertBGRAToRGBAFunc; VP8LConvertFunc VP8LConvertBGRAToRGBA;
VP8LConvertFunc VP8LConvertBGRAToRGBA4444Func; VP8LConvertFunc VP8LConvertBGRAToRGBA4444;
VP8LConvertFunc VP8LConvertBGRAToRGB565Func; VP8LConvertFunc VP8LConvertBGRAToRGB565;
VP8LConvertFunc VP8LConvertBGRAToBGRFunc; VP8LConvertFunc VP8LConvertBGRAToBGR;
void VP8LDspInit(void) { void VP8LDspInit(void) {
VP8LClampedAddSubtractFull = ClampedAddSubtractFull; VP8LClampedAddSubtractFull = ClampedAddSubtractFull;
@ -1723,11 +1723,11 @@ void VP8LDspInit(void) {
VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed;
VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed; VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed;
VP8LConvertBGRAToRGBFunc = ConvertBGRAToRGB; VP8LConvertBGRAToRGB = ConvertBGRAToRGB;
VP8LConvertBGRAToRGBAFunc = ConvertBGRAToRGBA; VP8LConvertBGRAToRGBA = ConvertBGRAToRGBA;
VP8LConvertBGRAToRGBA4444Func = ConvertBGRAToRGBA4444; VP8LConvertBGRAToRGBA4444 = ConvertBGRAToRGBA4444;
VP8LConvertBGRAToRGB565Func = ConvertBGRAToRGB565; VP8LConvertBGRAToRGB565 = ConvertBGRAToRGB565;
VP8LConvertBGRAToBGRFunc = ConvertBGRAToBGR; VP8LConvertBGRAToBGR = ConvertBGRAToBGR;
// If defined, use CPUInfo() to overwrite some pointers with faster versions. // If defined, use CPUInfo() to overwrite some pointers with faster versions.
if (VP8GetCPUInfo != NULL) { if (VP8GetCPUInfo != NULL) {

View File

@ -41,11 +41,11 @@ extern VP8LAddGreenToBlueAndRedFunc VP8LAddGreenToBlueAndRed;
typedef void (*VP8LConvertFunc)(const uint32_t* src, int num_pixels, typedef void (*VP8LConvertFunc)(const uint32_t* src, int num_pixels,
uint8_t* dst); uint8_t* dst);
extern VP8LConvertFunc VP8LConvertBGRAToRGBFunc; extern VP8LConvertFunc VP8LConvertBGRAToRGB;
extern VP8LConvertFunc VP8LConvertBGRAToRGBAFunc; extern VP8LConvertFunc VP8LConvertBGRAToRGBA;
extern VP8LConvertFunc VP8LConvertBGRAToRGBA4444Func; extern VP8LConvertFunc VP8LConvertBGRAToRGBA4444;
extern VP8LConvertFunc VP8LConvertBGRAToRGB565Func; extern VP8LConvertFunc VP8LConvertBGRAToRGB565;
extern VP8LConvertFunc VP8LConvertBGRAToBGRFunc; extern VP8LConvertFunc VP8LConvertBGRAToBGR;
// Must be called before calling any of the above methods. // Must be called before calling any of the above methods.
void VP8LDspInit(void); void VP8LDspInit(void);