godot/thirdparty/libwebp/sharpyuv/sharpyuv_gamma.c

// Copyright 2022 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.
// -----------------------------------------------------------------------------
//
// Gamma correction utilities.

#include "sharpyuv/sharpyuv_gamma.h"

#include <assert.h>
#include <float.h>
#include <math.h>

#include "src/webp/types.h"

// Gamma correction compensates loss of resolution during chroma subsampling.
// Size of pre-computed table for converting from gamma to linear.
#define GAMMA_TO_LINEAR_TAB_BITS
#define GAMMA_TO_LINEAR_TAB_SIZE
static uint32_t kGammaToLinearTabS[GAMMA_TO_LINEAR_TAB_SIZE + 2];
#define LINEAR_TO_GAMMA_TAB_BITS
#define LINEAR_TO_GAMMA_TAB_SIZE
static uint32_t kLinearToGammaTabS[LINEAR_TO_GAMMA_TAB_SIZE + 2];

// -- GODOT start --
#if defined(_MSC_VER)
static const double kGammaF = 2.222222222222222;
#else
static const double kGammaF =;
#endif
// -- GODOT end --
#define GAMMA_TO_LINEAR_BITS

static volatile int kGammaTablesSOk =;
void SharpYuvInitGammaTables(void) {}

static WEBP_INLINE int Shift(int v, int shift) {}

static WEBP_INLINE uint32_t FixedPointInterpolation(int v, uint32_t* tab,
                                                    int tab_pos_shift_right,
                                                    int tab_value_shift) {}

static uint32_t ToLinearSrgb(uint16_t v, int bit_depth) {}

static uint16_t FromLinearSrgb(uint32_t value, int bit_depth) {}

////////////////////////////////////////////////////////////////////////////////

#define CLAMP(x, low, high)
#define MIN(a, b)
#define MAX(a, b)

static WEBP_INLINE float Roundf(float x) {}

static WEBP_INLINE float Powf(float base, float exp) {}

static WEBP_INLINE float Log10f(float x) {}

static float ToLinear709(float gamma) {}

static float FromLinear709(float linear) {}

static float ToLinear470M(float gamma) {}

static float FromLinear470M(float linear) {}

static float ToLinear470Bg(float gamma) {}

static float FromLinear470Bg(float linear) {}

static float ToLinearSmpte240(float gamma) {}

static float FromLinearSmpte240(float linear) {}

static float ToLinearLog100(float gamma) {}

static float FromLinearLog100(float linear) {}

static float ToLinearLog100Sqrt10(float gamma) {}

static float FromLinearLog100Sqrt10(float linear) {}

static float ToLinearIec61966(float gamma) {}

static float FromLinearIec61966(float linear) {}

static float ToLinearBt1361(float gamma) {}

static float FromLinearBt1361(float linear) {}

static float ToLinearPq(float gamma) {}

static float FromLinearPq(float linear) {}

static float ToLinearSmpte428(float gamma) {}

static float FromLinearSmpte428(float linear) {}

// Conversion in BT.2100 requires RGB info. Simplify to gamma correction here.
static float ToLinearHlg(float gamma) {}

static float FromLinearHlg(float linear) {}

uint32_t SharpYuvGammaToLinear(uint16_t v, int bit_depth,
                               SharpYuvTransferFunctionType transfer_type) {}

uint16_t SharpYuvLinearToGamma(uint32_t v, int bit_depth,
                               SharpYuvTransferFunctionType transfer_type) {}