godot/thirdparty/libwebp/src/dsp/yuv_sse2.c

// Copyright 2014 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
// -----------------------------------------------------------------------------
//
// YUV->RGB conversion functions
//
// Author: Skal ([email protected])

#include "src/dsp/yuv.h"

#if defined(WEBP_USE_SSE2)

#include <stdlib.h>
#include <emmintrin.h>

#include "src/dsp/common_sse2.h"
#include "src/utils/utils.h"

//-----------------------------------------------------------------------------
// Convert spans of 32 pixels to various RGB formats for the fancy upsampler.

// These constants are 14b fixed-point version of ITU-R BT.601 constants.
// R = (19077 * y             + 26149 * v - 14234) >> 6
// G = (19077 * y -  6419 * u - 13320 * v +  8708) >> 6
// B = (19077 * y + 33050 * u             - 17685) >> 6
static void ConvertYUV444ToRGB_SSE2(const __m128i* const Y0,
                                    const __m128i* const U0,
                                    const __m128i* const V0,
                                    __m128i* const R,
                                    __m128i* const G,
                                    __m128i* const B) {}

// Load the bytes into the *upper* part of 16b words. That's "<< 8", basically.
static WEBP_INLINE __m128i Load_HI_16_SSE2(const uint8_t* src) {}

// Load and replicate the U/V samples
static WEBP_INLINE __m128i Load_UV_HI_8_SSE2(const uint8_t* src) {}

// Convert 32 samples of YUV444 to R/G/B
static void YUV444ToRGB_SSE2(const uint8_t* const y,
                             const uint8_t* const u,
                             const uint8_t* const v,
                             __m128i* const R, __m128i* const G,
                             __m128i* const B) {}

// Convert 32 samples of YUV420 to R/G/B
static void YUV420ToRGB_SSE2(const uint8_t* const y,
                             const uint8_t* const u,
                             const uint8_t* const v,
                             __m128i* const R, __m128i* const G,
                             __m128i* const B) {}

// Pack R/G/B/A results into 32b output.
static WEBP_INLINE void PackAndStore4_SSE2(const __m128i* const R,
                                           const __m128i* const G,
                                           const __m128i* const B,
                                           const __m128i* const A,
                                           uint8_t* const dst) {}

// Pack R/G/B/A results into 16b output.
static WEBP_INLINE void PackAndStore4444_SSE2(const __m128i* const R,
                                              const __m128i* const G,
                                              const __m128i* const B,
                                              const __m128i* const A,
                                              uint8_t* const dst) {}

// Pack R/G/B results into 16b output.
static WEBP_INLINE void PackAndStore565_SSE2(const __m128i* const R,
                                             const __m128i* const G,
                                             const __m128i* const B,
                                             uint8_t* const dst) {}

// Pack the planar buffers
// rrrr... rrrr... gggg... gggg... bbbb... bbbb....
// triplet by triplet in the output buffer rgb as rgbrgbrgbrgb ...
static WEBP_INLINE void PlanarTo24b_SSE2(__m128i* const in0, __m128i* const in1,
                                         __m128i* const in2, __m128i* const in3,
                                         __m128i* const in4, __m128i* const in5,
                                         uint8_t* const rgb) {}

void VP8YuvToRgba32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v,
                         uint8_t* dst) {}

void VP8YuvToBgra32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v,
                         uint8_t* dst) {}

void VP8YuvToArgb32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v,
                         uint8_t* dst) {}

void VP8YuvToRgba444432_SSE2(const uint8_t* y, const uint8_t* u,
                             const uint8_t* v, uint8_t* dst) {}

void VP8YuvToRgb56532_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v,
                           uint8_t* dst) {}

void VP8YuvToRgb32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v,
                        uint8_t* dst) {}

void VP8YuvToBgr32_SSE2(const uint8_t* y, const uint8_t* u, const uint8_t* v,
                        uint8_t* dst) {}

//-----------------------------------------------------------------------------
// Arbitrary-length row conversion functions

static void YuvToRgbaRow_SSE2(const uint8_t* y,
                              const uint8_t* u, const uint8_t* v,
                              uint8_t* dst, int len) {}

static void YuvToBgraRow_SSE2(const uint8_t* y,
                              const uint8_t* u, const uint8_t* v,
                              uint8_t* dst, int len) {}

static void YuvToArgbRow_SSE2(const uint8_t* y,
                              const uint8_t* u, const uint8_t* v,
                              uint8_t* dst, int len) {}

static void YuvToRgbRow_SSE2(const uint8_t* y,
                             const uint8_t* u, const uint8_t* v,
                             uint8_t* dst, int len) {}

static void YuvToBgrRow_SSE2(const uint8_t* y,
                             const uint8_t* u, const uint8_t* v,
                             uint8_t* dst, int len) {}

//------------------------------------------------------------------------------
// Entry point

extern void WebPInitSamplersSSE2(void);

WEBP_TSAN_IGNORE_FUNCTION void WebPInitSamplersSSE2(void) {}

//------------------------------------------------------------------------------
// RGB24/32 -> YUV converters

// Load eight 16b-words from *src.
#define LOAD_16(src)
// Store either 16b-words into *dst
#define STORE_16(V, dst)

// Function that inserts a value of the second half of the in buffer in between
// every two char of the first half.
static WEBP_INLINE void RGB24PackedToPlanarHelper_SSE2(
    const __m128i* const in /*in[6]*/, __m128i* const out /*out[6]*/) {}

// Unpack the 8b input rgbrgbrgbrgb ... as contiguous registers:
// rrrr... rrrr... gggg... gggg... bbbb... bbbb....
// Similar to PlanarTo24bHelper(), but in reverse order.
static WEBP_INLINE void RGB24PackedToPlanar_SSE2(
    const uint8_t* const rgb, __m128i* const out /*out[6]*/) {}

// Convert 8 packed ARGB to r[], g[], b[]
static WEBP_INLINE void RGB32PackedToPlanar_SSE2(const uint32_t* const argb,
                                                 __m128i* const rgb /*in[6]*/) {}

// This macro computes (RG * MULT_RG + GB * MULT_GB + ROUNDER) >> DESCALE_FIX
// It's a macro and not a function because we need to use immediate values with
// srai_epi32, e.g.
#define TRANSFORM

#define MK_CST_16
static WEBP_INLINE void ConvertRGBToY_SSE2(const __m128i* const R,
                                           const __m128i* const G,
                                           const __m128i* const B,
                                           __m128i* const Y) {}

static WEBP_INLINE void ConvertRGBToUV_SSE2(const __m128i* const R,
                                            const __m128i* const G,
                                            const __m128i* const B,
                                            __m128i* const U,
                                            __m128i* const V) {}

#undef MK_CST_16
#undef TRANSFORM

static void ConvertRGB24ToY_SSE2(const uint8_t* rgb, uint8_t* y, int width) {}

static void ConvertBGR24ToY_SSE2(const uint8_t* bgr, uint8_t* y, int width) {}

static void ConvertARGBToY_SSE2(const uint32_t* argb, uint8_t* y, int width) {}

// Horizontal add (doubled) of two 16b values, result is 16b.
// in: A | B | C | D | ... -> out: 2*(A+B) | 2*(C+D) | ...
static void HorizontalAddPack_SSE2(const __m128i* const A,
                                   const __m128i* const B,
                                   __m128i* const out) {}

static void ConvertARGBToUV_SSE2(const uint32_t* argb,
                                 uint8_t* u, uint8_t* v,
                                 int src_width, int do_store) {}

// Convert 16 packed ARGB 16b-values to r[], g[], b[]
static WEBP_INLINE void RGBA32PackedToPlanar_16b_SSE2(
    const uint16_t* const rgbx,
    __m128i* const r, __m128i* const g, __m128i* const b) {}

static void ConvertRGBA32ToUV_SSE2(const uint16_t* rgb,
                                   uint8_t* u, uint8_t* v, int width) {}

//------------------------------------------------------------------------------

extern void WebPInitConvertARGBToYUVSSE2(void);

WEBP_TSAN_IGNORE_FUNCTION void WebPInitConvertARGBToYUVSSE2(void) {}

#else  // !WEBP_USE_SSE2

WEBP_DSP_INIT_STUB(WebPInitSamplersSSE2)
WEBP_DSP_INIT_STUB(WebPInitConvertARGBToYUVSSE2)

#endif  // WEBP_USE_SSE2