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

// Copyright 2011 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.
// -----------------------------------------------------------------------------
//
// SSE2 version of speed-critical encoding functions.
//
// Author: Christian Duvivier ([email protected])

#include "src/dsp/dsp.h"

#if defined(WEBP_USE_SSE2)
#include <assert.h>
#include <stdlib.h>  // for abs()
#include <emmintrin.h>

#include "src/dsp/common_sse2.h"
#include "src/enc/cost_enc.h"
#include "src/enc/vp8i_enc.h"

//------------------------------------------------------------------------------
// Transforms (Paragraph 14.4)

// Does one inverse transform.
static void ITransform_One_SSE2(const uint8_t* ref, const int16_t* in,
                                uint8_t* dst) {}

// Does two inverse transforms.
static void ITransform_Two_SSE2(const uint8_t* ref, const int16_t* in,
                                uint8_t* dst) {}

// Does one or two inverse transforms.
static void ITransform_SSE2(const uint8_t* ref, const int16_t* in, uint8_t* dst,
                            int do_two) {}

static void FTransformPass1_SSE2(const __m128i* const in01,
                                 const __m128i* const in23,
                                 __m128i* const out01,
                                 __m128i* const out32) {}

static void FTransformPass2_SSE2(const __m128i* const v01,
                                 const __m128i* const v32,
                                 int16_t* out) {}

static void FTransform_SSE2(const uint8_t* src, const uint8_t* ref,
                            int16_t* out) {}

static void FTransform2_SSE2(const uint8_t* src, const uint8_t* ref,
                             int16_t* out) {}

static void FTransformWHTRow_SSE2(const int16_t* const in, __m128i* const out) {}

static void FTransformWHT_SSE2(const int16_t* in, int16_t* out) {}

//------------------------------------------------------------------------------
// Compute susceptibility based on DCT-coeff histograms:
// the higher, the "easier" the macroblock is to compress.

static void CollectHistogram_SSE2(const uint8_t* ref, const uint8_t* pred,
                                  int start_block, int end_block,
                                  VP8Histogram* const histo) {}

//------------------------------------------------------------------------------
// Intra predictions

// helper for chroma-DC predictions
static WEBP_INLINE void Put8x8uv_SSE2(uint8_t v, uint8_t* dst) {}

static WEBP_INLINE void Put16_SSE2(uint8_t v, uint8_t* dst) {}

static WEBP_INLINE void Fill_SSE2(uint8_t* dst, int value, int size) {}

static WEBP_INLINE void VE8uv_SSE2(uint8_t* dst, const uint8_t* top) {}

static WEBP_INLINE void VE16_SSE2(uint8_t* dst, const uint8_t* top) {}

static WEBP_INLINE void VerticalPred_SSE2(uint8_t* dst,
                                          const uint8_t* top, int size) {}

static WEBP_INLINE void HE8uv_SSE2(uint8_t* dst, const uint8_t* left) {}

static WEBP_INLINE void HE16_SSE2(uint8_t* dst, const uint8_t* left) {}

static WEBP_INLINE void HorizontalPred_SSE2(uint8_t* dst,
                                            const uint8_t* left, int size) {}

static WEBP_INLINE void TM_SSE2(uint8_t* dst, const uint8_t* left,
                                const uint8_t* top, int size) {}

static WEBP_INLINE void TrueMotion_SSE2(uint8_t* dst, const uint8_t* left,
                                        const uint8_t* top, int size) {}

static WEBP_INLINE void DC8uv_SSE2(uint8_t* dst, const uint8_t* left,
                                   const uint8_t* top) {}

static WEBP_INLINE void DC8uvNoLeft_SSE2(uint8_t* dst, const uint8_t* top) {}

static WEBP_INLINE void DC8uvNoTop_SSE2(uint8_t* dst, const uint8_t* left) {}

static WEBP_INLINE void DC8uvNoTopLeft_SSE2(uint8_t* dst) {}

static WEBP_INLINE void DC8uvMode_SSE2(uint8_t* dst, const uint8_t* left,
                                       const uint8_t* top) {}

static WEBP_INLINE void DC16_SSE2(uint8_t* dst, const uint8_t* left,
                                  const uint8_t* top) {}

static WEBP_INLINE void DC16NoLeft_SSE2(uint8_t* dst, const uint8_t* top) {}

static WEBP_INLINE void DC16NoTop_SSE2(uint8_t* dst, const uint8_t* left) {}

static WEBP_INLINE void DC16NoTopLeft_SSE2(uint8_t* dst) {}

static WEBP_INLINE void DC16Mode_SSE2(uint8_t* dst, const uint8_t* left,
                                      const uint8_t* top) {}

//------------------------------------------------------------------------------
// 4x4 predictions

#define DST
#define AVG3
#define AVG2

// We use the following 8b-arithmetic tricks:
//     (a + 2 * b + c + 2) >> 2 = (AC + b + 1) >> 1
//   where: AC = (a + c) >> 1 = [(a + c + 1) >> 1] - [(a^c) & 1]
// and:
//     (a + 2 * b + c + 2) >> 2 = (AB + BC + 1) >> 1 - (ab|bc)&lsb
//   where: AC = (a + b + 1) >> 1,   BC = (b + c + 1) >> 1
//   and ab = a ^ b, bc = b ^ c, lsb = (AC^BC)&1

static WEBP_INLINE void VE4_SSE2(uint8_t* dst,
                                 const uint8_t* top) {}

static WEBP_INLINE void HE4_SSE2(uint8_t* dst,
                                 const uint8_t* top) {}

static WEBP_INLINE void DC4_SSE2(uint8_t* dst, const uint8_t* top) {}

static WEBP_INLINE void LD4_SSE2(uint8_t* dst,
                                 const uint8_t* top) {}

static WEBP_INLINE void VR4_SSE2(uint8_t* dst,
                                 const uint8_t* top) {}

static WEBP_INLINE void VL4_SSE2(uint8_t* dst,
                                 const uint8_t* top) {}

static WEBP_INLINE void RD4_SSE2(uint8_t* dst,
                                 const uint8_t* top) {}

static WEBP_INLINE void HU4_SSE2(uint8_t* dst, const uint8_t* top) {}

static WEBP_INLINE void HD4_SSE2(uint8_t* dst, const uint8_t* top) {}

static WEBP_INLINE void TM4_SSE2(uint8_t* dst, const uint8_t* top) {}

#undef DST
#undef AVG3
#undef AVG2

//------------------------------------------------------------------------------
// luma 4x4 prediction

// Left samples are top[-5 .. -2], top_left is top[-1], top are
// located at top[0..3], and top right is top[4..7]
static void Intra4Preds_SSE2(uint8_t* dst, const uint8_t* top) {}

//------------------------------------------------------------------------------
// Chroma 8x8 prediction (paragraph 12.2)

static void IntraChromaPreds_SSE2(uint8_t* dst, const uint8_t* left,
                                  const uint8_t* top) {}

//------------------------------------------------------------------------------
// luma 16x16 prediction (paragraph 12.3)

static void Intra16Preds_SSE2(uint8_t* dst,
                              const uint8_t* left, const uint8_t* top) {}

//------------------------------------------------------------------------------
// Metric

static WEBP_INLINE void SubtractAndAccumulate_SSE2(const __m128i a,
                                                   const __m128i b,
                                                   __m128i* const sum) {}

static WEBP_INLINE int SSE_16xN_SSE2(const uint8_t* a, const uint8_t* b,
                                     int num_pairs) {}

static int SSE16x16_SSE2(const uint8_t* a, const uint8_t* b) {}

static int SSE16x8_SSE2(const uint8_t* a, const uint8_t* b) {}

#define LOAD_8x16b

static int SSE8x8_SSE2(const uint8_t* a, const uint8_t* b) {}
#undef LOAD_8x16b

static int SSE4x4_SSE2(const uint8_t* a, const uint8_t* b) {}

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

static void Mean16x4_SSE2(const uint8_t* ref, uint32_t dc[4]) {}

//------------------------------------------------------------------------------
// Texture distortion
//
// We try to match the spectral content (weighted) between source and
// reconstructed samples.

// Hadamard transform
// Returns the weighted sum of the absolute value of transformed coefficients.
// w[] contains a row-major 4 by 4 symmetric matrix.
static int TTransform_SSE2(const uint8_t* inA, const uint8_t* inB,
                           const uint16_t* const w) {}

static int Disto4x4_SSE2(const uint8_t* const a, const uint8_t* const b,
                         const uint16_t* const w) {}

static int Disto16x16_SSE2(const uint8_t* const a, const uint8_t* const b,
                           const uint16_t* const w) {}

//------------------------------------------------------------------------------
// Quantization
//

static WEBP_INLINE int DoQuantizeBlock_SSE2(int16_t in[16], int16_t out[16],
                                            const uint16_t* const sharpen,
                                            const VP8Matrix* const mtx) {}

static int QuantizeBlock_SSE2(int16_t in[16], int16_t out[16],
                              const VP8Matrix* const mtx) {}

static int QuantizeBlockWHT_SSE2(int16_t in[16], int16_t out[16],
                                 const VP8Matrix* const mtx) {}

static int Quantize2Blocks_SSE2(int16_t in[32], int16_t out[32],
                                const VP8Matrix* const mtx) {}

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

extern void VP8EncDspInitSSE2(void);

WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitSSE2(void) {}

#else  // !WEBP_USE_SSE2

WEBP_DSP_INIT_STUB(VP8EncDspInitSSE2)

#endif  // WEBP_USE_SSE2