Path: blob/master/3rdparty/libwebp/src/dsp/lossless.c
16348 views
// Copyright 2012 Google Inc. All Rights Reserved.1//2// Use of this source code is governed by a BSD-style license3// that can be found in the COPYING file in the root of the source4// tree. An additional intellectual property rights grant can be found5// in the file PATENTS. All contributing project authors may6// be found in the AUTHORS file in the root of the source tree.7// -----------------------------------------------------------------------------8//9// Image transforms and color space conversion methods for lossless decoder.10//11// Authors: Vikas Arora ([email protected])12// Jyrki Alakuijala ([email protected])13// Urvang Joshi ([email protected])1415#include "src/dsp/dsp.h"1617#include <assert.h>18#include <math.h>19#include <stdlib.h>20#include "src/dec/vp8li_dec.h"21#include "src/utils/endian_inl_utils.h"22#include "src/dsp/lossless.h"23#include "src/dsp/lossless_common.h"2425#define MAX_DIFF_COST (1e30f)2627//------------------------------------------------------------------------------28// Image transforms.2930static WEBP_INLINE uint32_t Average2(uint32_t a0, uint32_t a1) {31return (((a0 ^ a1) & 0xfefefefeu) >> 1) + (a0 & a1);32}3334static WEBP_INLINE uint32_t Average3(uint32_t a0, uint32_t a1, uint32_t a2) {35return Average2(Average2(a0, a2), a1);36}3738static WEBP_INLINE uint32_t Average4(uint32_t a0, uint32_t a1,39uint32_t a2, uint32_t a3) {40return Average2(Average2(a0, a1), Average2(a2, a3));41}4243static WEBP_INLINE uint32_t Clip255(uint32_t a) {44if (a < 256) {45return a;46}47// return 0, when a is a negative integer.48// return 255, when a is positive.49return ~a >> 24;50}5152static WEBP_INLINE int AddSubtractComponentFull(int a, int b, int c) {53return Clip255(a + b - c);54}5556static WEBP_INLINE uint32_t ClampedAddSubtractFull(uint32_t c0, uint32_t c1,57uint32_t c2) {58const int a = AddSubtractComponentFull(c0 >> 24, c1 >> 24, c2 >> 24);59const int r = AddSubtractComponentFull((c0 >> 16) & 0xff,60(c1 >> 16) & 0xff,61(c2 >> 16) & 0xff);62const int g = AddSubtractComponentFull((c0 >> 8) & 0xff,63(c1 >> 8) & 0xff,64(c2 >> 8) & 0xff);65const int b = AddSubtractComponentFull(c0 & 0xff, c1 & 0xff, c2 & 0xff);66return ((uint32_t)a << 24) | (r << 16) | (g << 8) | b;67}6869static WEBP_INLINE int AddSubtractComponentHalf(int a, int b) {70return Clip255(a + (a - b) / 2);71}7273static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1,74uint32_t c2) {75const uint32_t ave = Average2(c0, c1);76const int a = AddSubtractComponentHalf(ave >> 24, c2 >> 24);77const int r = AddSubtractComponentHalf((ave >> 16) & 0xff, (c2 >> 16) & 0xff);78const int g = AddSubtractComponentHalf((ave >> 8) & 0xff, (c2 >> 8) & 0xff);79const int b = AddSubtractComponentHalf((ave >> 0) & 0xff, (c2 >> 0) & 0xff);80return ((uint32_t)a << 24) | (r << 16) | (g << 8) | b;81}8283// gcc <= 4.9 on ARM generates incorrect code in Select() when Sub3() is84// inlined.85#if defined(__arm__) && LOCAL_GCC_VERSION <= 0x40986# define LOCAL_INLINE __attribute__ ((noinline))87#else88# define LOCAL_INLINE WEBP_INLINE89#endif9091static LOCAL_INLINE int Sub3(int a, int b, int c) {92const int pb = b - c;93const int pa = a - c;94return abs(pb) - abs(pa);95}9697#undef LOCAL_INLINE9899static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) {100const int pa_minus_pb =101Sub3((a >> 24) , (b >> 24) , (c >> 24) ) +102Sub3((a >> 16) & 0xff, (b >> 16) & 0xff, (c >> 16) & 0xff) +103Sub3((a >> 8) & 0xff, (b >> 8) & 0xff, (c >> 8) & 0xff) +104Sub3((a ) & 0xff, (b ) & 0xff, (c ) & 0xff);105return (pa_minus_pb <= 0) ? a : b;106}107108//------------------------------------------------------------------------------109// Predictors110111static uint32_t Predictor0_C(uint32_t left, const uint32_t* const top) {112(void)top;113(void)left;114return ARGB_BLACK;115}116static uint32_t Predictor1_C(uint32_t left, const uint32_t* const top) {117(void)top;118return left;119}120static uint32_t Predictor2_C(uint32_t left, const uint32_t* const top) {121(void)left;122return top[0];123}124static uint32_t Predictor3_C(uint32_t left, const uint32_t* const top) {125(void)left;126return top[1];127}128static uint32_t Predictor4_C(uint32_t left, const uint32_t* const top) {129(void)left;130return top[-1];131}132static uint32_t Predictor5_C(uint32_t left, const uint32_t* const top) {133const uint32_t pred = Average3(left, top[0], top[1]);134return pred;135}136static uint32_t Predictor6_C(uint32_t left, const uint32_t* const top) {137const uint32_t pred = Average2(left, top[-1]);138return pred;139}140static uint32_t Predictor7_C(uint32_t left, const uint32_t* const top) {141const uint32_t pred = Average2(left, top[0]);142return pred;143}144static uint32_t Predictor8_C(uint32_t left, const uint32_t* const top) {145const uint32_t pred = Average2(top[-1], top[0]);146(void)left;147return pred;148}149static uint32_t Predictor9_C(uint32_t left, const uint32_t* const top) {150const uint32_t pred = Average2(top[0], top[1]);151(void)left;152return pred;153}154static uint32_t Predictor10_C(uint32_t left, const uint32_t* const top) {155const uint32_t pred = Average4(left, top[-1], top[0], top[1]);156return pred;157}158static uint32_t Predictor11_C(uint32_t left, const uint32_t* const top) {159const uint32_t pred = Select(top[0], left, top[-1]);160return pred;161}162static uint32_t Predictor12_C(uint32_t left, const uint32_t* const top) {163const uint32_t pred = ClampedAddSubtractFull(left, top[0], top[-1]);164return pred;165}166static uint32_t Predictor13_C(uint32_t left, const uint32_t* const top) {167const uint32_t pred = ClampedAddSubtractHalf(left, top[0], top[-1]);168return pred;169}170171GENERATE_PREDICTOR_ADD(Predictor0_C, PredictorAdd0_C)172static void PredictorAdd1_C(const uint32_t* in, const uint32_t* upper,173int num_pixels, uint32_t* out) {174int i;175uint32_t left = out[-1];176for (i = 0; i < num_pixels; ++i) {177out[i] = left = VP8LAddPixels(in[i], left);178}179(void)upper;180}181GENERATE_PREDICTOR_ADD(Predictor2_C, PredictorAdd2_C)182GENERATE_PREDICTOR_ADD(Predictor3_C, PredictorAdd3_C)183GENERATE_PREDICTOR_ADD(Predictor4_C, PredictorAdd4_C)184GENERATE_PREDICTOR_ADD(Predictor5_C, PredictorAdd5_C)185GENERATE_PREDICTOR_ADD(Predictor6_C, PredictorAdd6_C)186GENERATE_PREDICTOR_ADD(Predictor7_C, PredictorAdd7_C)187GENERATE_PREDICTOR_ADD(Predictor8_C, PredictorAdd8_C)188GENERATE_PREDICTOR_ADD(Predictor9_C, PredictorAdd9_C)189GENERATE_PREDICTOR_ADD(Predictor10_C, PredictorAdd10_C)190GENERATE_PREDICTOR_ADD(Predictor11_C, PredictorAdd11_C)191GENERATE_PREDICTOR_ADD(Predictor12_C, PredictorAdd12_C)192GENERATE_PREDICTOR_ADD(Predictor13_C, PredictorAdd13_C)193194//------------------------------------------------------------------------------195196// Inverse prediction.197static void PredictorInverseTransform_C(const VP8LTransform* const transform,198int y_start, int y_end,199const uint32_t* in, uint32_t* out) {200const int width = transform->xsize_;201if (y_start == 0) { // First Row follows the L (mode=1) mode.202PredictorAdd0_C(in, NULL, 1, out);203PredictorAdd1_C(in + 1, NULL, width - 1, out + 1);204in += width;205out += width;206++y_start;207}208209{210int y = y_start;211const int tile_width = 1 << transform->bits_;212const int mask = tile_width - 1;213const int tiles_per_row = VP8LSubSampleSize(width, transform->bits_);214const uint32_t* pred_mode_base =215transform->data_ + (y >> transform->bits_) * tiles_per_row;216217while (y < y_end) {218const uint32_t* pred_mode_src = pred_mode_base;219int x = 1;220// First pixel follows the T (mode=2) mode.221PredictorAdd2_C(in, out - width, 1, out);222// .. the rest:223while (x < width) {224const VP8LPredictorAddSubFunc pred_func =225VP8LPredictorsAdd[((*pred_mode_src++) >> 8) & 0xf];226int x_end = (x & ~mask) + tile_width;227if (x_end > width) x_end = width;228pred_func(in + x, out + x - width, x_end - x, out + x);229x = x_end;230}231in += width;232out += width;233++y;234if ((y & mask) == 0) { // Use the same mask, since tiles are squares.235pred_mode_base += tiles_per_row;236}237}238}239}240241// Add green to blue and red channels (i.e. perform the inverse transform of242// 'subtract green').243void VP8LAddGreenToBlueAndRed_C(const uint32_t* src, int num_pixels,244uint32_t* dst) {245int i;246for (i = 0; i < num_pixels; ++i) {247const uint32_t argb = src[i];248const uint32_t green = ((argb >> 8) & 0xff);249uint32_t red_blue = (argb & 0x00ff00ffu);250red_blue += (green << 16) | green;251red_blue &= 0x00ff00ffu;252dst[i] = (argb & 0xff00ff00u) | red_blue;253}254}255256static WEBP_INLINE int ColorTransformDelta(int8_t color_pred,257int8_t color) {258return ((int)color_pred * color) >> 5;259}260261static WEBP_INLINE void ColorCodeToMultipliers(uint32_t color_code,262VP8LMultipliers* const m) {263m->green_to_red_ = (color_code >> 0) & 0xff;264m->green_to_blue_ = (color_code >> 8) & 0xff;265m->red_to_blue_ = (color_code >> 16) & 0xff;266}267268void VP8LTransformColorInverse_C(const VP8LMultipliers* const m,269const uint32_t* src, int num_pixels,270uint32_t* dst) {271int i;272for (i = 0; i < num_pixels; ++i) {273const uint32_t argb = src[i];274const uint32_t green = argb >> 8;275const uint32_t red = argb >> 16;276int new_red = red & 0xff;277int new_blue = argb & 0xff;278new_red += ColorTransformDelta(m->green_to_red_, green);279new_red &= 0xff;280new_blue += ColorTransformDelta(m->green_to_blue_, green);281new_blue += ColorTransformDelta(m->red_to_blue_, new_red);282new_blue &= 0xff;283dst[i] = (argb & 0xff00ff00u) | (new_red << 16) | (new_blue);284}285}286287// Color space inverse transform.288static void ColorSpaceInverseTransform_C(const VP8LTransform* const transform,289int y_start, int y_end,290const uint32_t* src, uint32_t* dst) {291const int width = transform->xsize_;292const int tile_width = 1 << transform->bits_;293const int mask = tile_width - 1;294const int safe_width = width & ~mask;295const int remaining_width = width - safe_width;296const int tiles_per_row = VP8LSubSampleSize(width, transform->bits_);297int y = y_start;298const uint32_t* pred_row =299transform->data_ + (y >> transform->bits_) * tiles_per_row;300301while (y < y_end) {302const uint32_t* pred = pred_row;303VP8LMultipliers m = { 0, 0, 0 };304const uint32_t* const src_safe_end = src + safe_width;305const uint32_t* const src_end = src + width;306while (src < src_safe_end) {307ColorCodeToMultipliers(*pred++, &m);308VP8LTransformColorInverse(&m, src, tile_width, dst);309src += tile_width;310dst += tile_width;311}312if (src < src_end) { // Left-overs using C-version.313ColorCodeToMultipliers(*pred++, &m);314VP8LTransformColorInverse(&m, src, remaining_width, dst);315src += remaining_width;316dst += remaining_width;317}318++y;319if ((y & mask) == 0) pred_row += tiles_per_row;320}321}322323// Separate out pixels packed together using pixel-bundling.324// We define two methods for ARGB data (uint32_t) and alpha-only data (uint8_t).325#define COLOR_INDEX_INVERSE(FUNC_NAME, F_NAME, STATIC_DECL, TYPE, BIT_SUFFIX, \326GET_INDEX, GET_VALUE) \327static void F_NAME(const TYPE* src, const uint32_t* const color_map, \328TYPE* dst, int y_start, int y_end, int width) { \329int y; \330for (y = y_start; y < y_end; ++y) { \331int x; \332for (x = 0; x < width; ++x) { \333*dst++ = GET_VALUE(color_map[GET_INDEX(*src++)]); \334} \335} \336} \337STATIC_DECL void FUNC_NAME(const VP8LTransform* const transform, \338int y_start, int y_end, const TYPE* src, \339TYPE* dst) { \340int y; \341const int bits_per_pixel = 8 >> transform->bits_; \342const int width = transform->xsize_; \343const uint32_t* const color_map = transform->data_; \344if (bits_per_pixel < 8) { \345const int pixels_per_byte = 1 << transform->bits_; \346const int count_mask = pixels_per_byte - 1; \347const uint32_t bit_mask = (1 << bits_per_pixel) - 1; \348for (y = y_start; y < y_end; ++y) { \349uint32_t packed_pixels = 0; \350int x; \351for (x = 0; x < width; ++x) { \352/* We need to load fresh 'packed_pixels' once every */ \353/* 'pixels_per_byte' increments of x. Fortunately, pixels_per_byte */ \354/* is a power of 2, so can just use a mask for that, instead of */ \355/* decrementing a counter. */ \356if ((x & count_mask) == 0) packed_pixels = GET_INDEX(*src++); \357*dst++ = GET_VALUE(color_map[packed_pixels & bit_mask]); \358packed_pixels >>= bits_per_pixel; \359} \360} \361} else { \362VP8LMapColor##BIT_SUFFIX(src, color_map, dst, y_start, y_end, width); \363} \364}365366COLOR_INDEX_INVERSE(ColorIndexInverseTransform_C, MapARGB_C, static,367uint32_t, 32b, VP8GetARGBIndex, VP8GetARGBValue)368COLOR_INDEX_INVERSE(VP8LColorIndexInverseTransformAlpha, MapAlpha_C, ,369uint8_t, 8b, VP8GetAlphaIndex, VP8GetAlphaValue)370371#undef COLOR_INDEX_INVERSE372373void VP8LInverseTransform(const VP8LTransform* const transform,374int row_start, int row_end,375const uint32_t* const in, uint32_t* const out) {376const int width = transform->xsize_;377assert(row_start < row_end);378assert(row_end <= transform->ysize_);379switch (transform->type_) {380case SUBTRACT_GREEN:381VP8LAddGreenToBlueAndRed(in, (row_end - row_start) * width, out);382break;383case PREDICTOR_TRANSFORM:384PredictorInverseTransform_C(transform, row_start, row_end, in, out);385if (row_end != transform->ysize_) {386// The last predicted row in this iteration will be the top-pred row387// for the first row in next iteration.388memcpy(out - width, out + (row_end - row_start - 1) * width,389width * sizeof(*out));390}391break;392case CROSS_COLOR_TRANSFORM:393ColorSpaceInverseTransform_C(transform, row_start, row_end, in, out);394break;395case COLOR_INDEXING_TRANSFORM:396if (in == out && transform->bits_ > 0) {397// Move packed pixels to the end of unpacked region, so that unpacking398// can occur seamlessly.399// Also, note that this is the only transform that applies on400// the effective width of VP8LSubSampleSize(xsize_, bits_). All other401// transforms work on effective width of xsize_.402const int out_stride = (row_end - row_start) * width;403const int in_stride = (row_end - row_start) *404VP8LSubSampleSize(transform->xsize_, transform->bits_);405uint32_t* const src = out + out_stride - in_stride;406memmove(src, out, in_stride * sizeof(*src));407ColorIndexInverseTransform_C(transform, row_start, row_end, src, out);408} else {409ColorIndexInverseTransform_C(transform, row_start, row_end, in, out);410}411break;412}413}414415//------------------------------------------------------------------------------416// Color space conversion.417418static int is_big_endian(void) {419static const union {420uint16_t w;421uint8_t b[2];422} tmp = { 1 };423return (tmp.b[0] != 1);424}425426void VP8LConvertBGRAToRGB_C(const uint32_t* src,427int num_pixels, uint8_t* dst) {428const uint32_t* const src_end = src + num_pixels;429while (src < src_end) {430const uint32_t argb = *src++;431*dst++ = (argb >> 16) & 0xff;432*dst++ = (argb >> 8) & 0xff;433*dst++ = (argb >> 0) & 0xff;434}435}436437void VP8LConvertBGRAToRGBA_C(const uint32_t* src,438int num_pixels, uint8_t* dst) {439const uint32_t* const src_end = src + num_pixels;440while (src < src_end) {441const uint32_t argb = *src++;442*dst++ = (argb >> 16) & 0xff;443*dst++ = (argb >> 8) & 0xff;444*dst++ = (argb >> 0) & 0xff;445*dst++ = (argb >> 24) & 0xff;446}447}448449void VP8LConvertBGRAToRGBA4444_C(const uint32_t* src,450int num_pixels, uint8_t* dst) {451const uint32_t* const src_end = src + num_pixels;452while (src < src_end) {453const uint32_t argb = *src++;454const uint8_t rg = ((argb >> 16) & 0xf0) | ((argb >> 12) & 0xf);455const uint8_t ba = ((argb >> 0) & 0xf0) | ((argb >> 28) & 0xf);456#if (WEBP_SWAP_16BIT_CSP == 1)457*dst++ = ba;458*dst++ = rg;459#else460*dst++ = rg;461*dst++ = ba;462#endif463}464}465466void VP8LConvertBGRAToRGB565_C(const uint32_t* src,467int num_pixels, uint8_t* dst) {468const uint32_t* const src_end = src + num_pixels;469while (src < src_end) {470const uint32_t argb = *src++;471const uint8_t rg = ((argb >> 16) & 0xf8) | ((argb >> 13) & 0x7);472const uint8_t gb = ((argb >> 5) & 0xe0) | ((argb >> 3) & 0x1f);473#if (WEBP_SWAP_16BIT_CSP == 1)474*dst++ = gb;475*dst++ = rg;476#else477*dst++ = rg;478*dst++ = gb;479#endif480}481}482483void VP8LConvertBGRAToBGR_C(const uint32_t* src,484int num_pixels, uint8_t* dst) {485const uint32_t* const src_end = src + num_pixels;486while (src < src_end) {487const uint32_t argb = *src++;488*dst++ = (argb >> 0) & 0xff;489*dst++ = (argb >> 8) & 0xff;490*dst++ = (argb >> 16) & 0xff;491}492}493494static void CopyOrSwap(const uint32_t* src, int num_pixels, uint8_t* dst,495int swap_on_big_endian) {496if (is_big_endian() == swap_on_big_endian) {497const uint32_t* const src_end = src + num_pixels;498while (src < src_end) {499const uint32_t argb = *src++;500WebPUint32ToMem(dst, BSwap32(argb));501dst += sizeof(argb);502}503} else {504memcpy(dst, src, num_pixels * sizeof(*src));505}506}507508void VP8LConvertFromBGRA(const uint32_t* const in_data, int num_pixels,509WEBP_CSP_MODE out_colorspace, uint8_t* const rgba) {510switch (out_colorspace) {511case MODE_RGB:512VP8LConvertBGRAToRGB(in_data, num_pixels, rgba);513break;514case MODE_RGBA:515VP8LConvertBGRAToRGBA(in_data, num_pixels, rgba);516break;517case MODE_rgbA:518VP8LConvertBGRAToRGBA(in_data, num_pixels, rgba);519WebPApplyAlphaMultiply(rgba, 0, num_pixels, 1, 0);520break;521case MODE_BGR:522VP8LConvertBGRAToBGR(in_data, num_pixels, rgba);523break;524case MODE_BGRA:525CopyOrSwap(in_data, num_pixels, rgba, 1);526break;527case MODE_bgrA:528CopyOrSwap(in_data, num_pixels, rgba, 1);529WebPApplyAlphaMultiply(rgba, 0, num_pixels, 1, 0);530break;531case MODE_ARGB:532CopyOrSwap(in_data, num_pixels, rgba, 0);533break;534case MODE_Argb:535CopyOrSwap(in_data, num_pixels, rgba, 0);536WebPApplyAlphaMultiply(rgba, 1, num_pixels, 1, 0);537break;538case MODE_RGBA_4444:539VP8LConvertBGRAToRGBA4444(in_data, num_pixels, rgba);540break;541case MODE_rgbA_4444:542VP8LConvertBGRAToRGBA4444(in_data, num_pixels, rgba);543WebPApplyAlphaMultiply4444(rgba, num_pixels, 1, 0);544break;545case MODE_RGB_565:546VP8LConvertBGRAToRGB565(in_data, num_pixels, rgba);547break;548default:549assert(0); // Code flow should not reach here.550}551}552553//------------------------------------------------------------------------------554555VP8LProcessDecBlueAndRedFunc VP8LAddGreenToBlueAndRed;556VP8LPredictorAddSubFunc VP8LPredictorsAdd[16];557VP8LPredictorFunc VP8LPredictors[16];558559// exposed plain-C implementations560VP8LPredictorAddSubFunc VP8LPredictorsAdd_C[16];561VP8LPredictorFunc VP8LPredictors_C[16];562563VP8LTransformColorInverseFunc VP8LTransformColorInverse;564565VP8LConvertFunc VP8LConvertBGRAToRGB;566VP8LConvertFunc VP8LConvertBGRAToRGBA;567VP8LConvertFunc VP8LConvertBGRAToRGBA4444;568VP8LConvertFunc VP8LConvertBGRAToRGB565;569VP8LConvertFunc VP8LConvertBGRAToBGR;570571VP8LMapARGBFunc VP8LMapColor32b;572VP8LMapAlphaFunc VP8LMapColor8b;573574extern void VP8LDspInitSSE2(void);575extern void VP8LDspInitNEON(void);576extern void VP8LDspInitMIPSdspR2(void);577extern void VP8LDspInitMSA(void);578579#define COPY_PREDICTOR_ARRAY(IN, OUT) do { \580(OUT)[0] = IN##0_C; \581(OUT)[1] = IN##1_C; \582(OUT)[2] = IN##2_C; \583(OUT)[3] = IN##3_C; \584(OUT)[4] = IN##4_C; \585(OUT)[5] = IN##5_C; \586(OUT)[6] = IN##6_C; \587(OUT)[7] = IN##7_C; \588(OUT)[8] = IN##8_C; \589(OUT)[9] = IN##9_C; \590(OUT)[10] = IN##10_C; \591(OUT)[11] = IN##11_C; \592(OUT)[12] = IN##12_C; \593(OUT)[13] = IN##13_C; \594(OUT)[14] = IN##0_C; /* <- padding security sentinels*/ \595(OUT)[15] = IN##0_C; \596} while (0);597598WEBP_DSP_INIT_FUNC(VP8LDspInit) {599COPY_PREDICTOR_ARRAY(Predictor, VP8LPredictors)600COPY_PREDICTOR_ARRAY(Predictor, VP8LPredictors_C)601COPY_PREDICTOR_ARRAY(PredictorAdd, VP8LPredictorsAdd)602COPY_PREDICTOR_ARRAY(PredictorAdd, VP8LPredictorsAdd_C)603604#if !WEBP_NEON_OMIT_C_CODE605VP8LAddGreenToBlueAndRed = VP8LAddGreenToBlueAndRed_C;606607VP8LTransformColorInverse = VP8LTransformColorInverse_C;608609VP8LConvertBGRAToRGBA = VP8LConvertBGRAToRGBA_C;610VP8LConvertBGRAToRGB = VP8LConvertBGRAToRGB_C;611VP8LConvertBGRAToBGR = VP8LConvertBGRAToBGR_C;612#endif613614VP8LConvertBGRAToRGBA4444 = VP8LConvertBGRAToRGBA4444_C;615VP8LConvertBGRAToRGB565 = VP8LConvertBGRAToRGB565_C;616617VP8LMapColor32b = MapARGB_C;618VP8LMapColor8b = MapAlpha_C;619620// If defined, use CPUInfo() to overwrite some pointers with faster versions.621if (VP8GetCPUInfo != NULL) {622#if defined(WEBP_USE_SSE2)623if (VP8GetCPUInfo(kSSE2)) {624VP8LDspInitSSE2();625}626#endif627#if defined(WEBP_USE_MIPS_DSP_R2)628if (VP8GetCPUInfo(kMIPSdspR2)) {629VP8LDspInitMIPSdspR2();630}631#endif632#if defined(WEBP_USE_MSA)633if (VP8GetCPUInfo(kMSA)) {634VP8LDspInitMSA();635}636#endif637}638639#if defined(WEBP_USE_NEON)640if (WEBP_NEON_OMIT_C_CODE ||641(VP8GetCPUInfo != NULL && VP8GetCPUInfo(kNEON))) {642VP8LDspInitNEON();643}644#endif645646assert(VP8LAddGreenToBlueAndRed != NULL);647assert(VP8LTransformColorInverse != NULL);648assert(VP8LConvertBGRAToRGBA != NULL);649assert(VP8LConvertBGRAToRGB != NULL);650assert(VP8LConvertBGRAToBGR != NULL);651assert(VP8LConvertBGRAToRGBA4444 != NULL);652assert(VP8LConvertBGRAToRGB565 != NULL);653assert(VP8LMapColor32b != NULL);654assert(VP8LMapColor8b != NULL);655}656#undef COPY_PREDICTOR_ARRAY657658//------------------------------------------------------------------------------659660661