godot/thirdparty/astcenc/astcenc_color_unquantize.cpp

// SPDX-License-Identifier: Apache-2.0
// ----------------------------------------------------------------------------
// Copyright 2011-2023 Arm Limited
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at:
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
// ----------------------------------------------------------------------------

#include <utility>

/**
 * @brief Functions for color unquantization.
 */

#include "astcenc_internal.h"

/**
 * @brief Un-blue-contract a color.
 *
 * This function reverses any applied blue contraction.
 *
 * @param input   The input color that has been blue-contracted.
 *
 * @return The uncontracted color.
 */
static ASTCENC_SIMD_INLINE vint4 uncontract_color(
	vint4 input
) {}

void rgba_delta_unpack(
	vint4 input0,
	vint4 input1,
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an LDR RGB color that uses delta encoding.
 *
 * Output alpha set to 255.
 *
 * @param      input0    The packed endpoint 0 color.
 * @param      input1    The packed endpoint 1 color deltas.
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void rgb_delta_unpack(
	vint4 input0,
	vint4 input1,
	vint4& output0,
	vint4& output1
) {}

void rgba_unpack(
	vint4 input0,
	vint4 input1,
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an LDR RGB color that uses direct encoding.
 *
 * Output alpha set to 255.
 *
 * @param      input0    The packed endpoint 0 color.
 * @param      input1    The packed endpoint 1 color.
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void rgb_unpack(
	vint4 input0,
	vint4 input1,
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an LDR RGBA color that uses scaled encoding.
 *
 * Note only the RGB channels use the scaled encoding, alpha uses direct.
 *
 * @param      input0    The packed endpoint 0 color.
 * @param      alpha1    The packed endpoint 1 alpha value.
 * @param      scale     The packed quantized scale.
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void rgb_scale_alpha_unpack(
	vint4 input0,
	uint8_t alpha1,
	uint8_t scale,
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an LDR RGB color that uses scaled encoding.
 *
 * Output alpha is 255.
 *
 * @param      input0    The packed endpoint 0 color.
 * @param      scale     The packed scale.
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void rgb_scale_unpack(
	vint4 input0,
	int scale,
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an LDR L color that uses direct encoding.
 *
 * Output alpha is 255.
 *
 * @param      input     The packed endpoints.
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void luminance_unpack(
	const uint8_t input[2],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an LDR L color that uses delta encoding.
 *
 * Output alpha is 255.
 *
 * @param      input     The packed endpoints (L0, L1).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void luminance_delta_unpack(
	const uint8_t input[2],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an LDR LA color that uses direct encoding.
 *
 * @param      input     The packed endpoints (L0, L1, A0, A1).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void luminance_alpha_unpack(
	const uint8_t input[4],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an LDR LA color that uses delta encoding.
 *
 * @param      input     The packed endpoints (L0, L1, A0, A1).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void luminance_alpha_delta_unpack(
	const uint8_t input[4],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an HDR RGB + offset encoding.
 *
 * @param      input     The packed endpoints (packed and modal).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void hdr_rgbo_unpack(
	const uint8_t input[4],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an HDR RGB direct encoding.
 *
 * @param      input     The packed endpoints (packed and modal).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void hdr_rgb_unpack(
	const uint8_t input[6],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an HDR RGB + LDR A direct encoding.
 *
 * @param      input     The packed endpoints (packed and modal).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void hdr_rgb_ldr_alpha_unpack(
	const uint8_t input[8],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an HDR L (small range) direct encoding.
 *
 * @param      input     The packed endpoints (packed and modal).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void hdr_luminance_small_range_unpack(
	const uint8_t input[2],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an HDR L (large range) direct encoding.
 *
 * @param      input     The packed endpoints (packed and modal).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void hdr_luminance_large_range_unpack(
	const uint8_t input[2],
	vint4& output0,
	vint4& output1
) {}

/**
 * @brief Unpack an HDR A direct encoding.
 *
 * @param      input     The packed endpoints (packed and modal).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void hdr_alpha_unpack(
	const uint8_t input[2],
	int& output0,
	int& output1
) {}

/**
 * @brief Unpack an HDR RGBA direct encoding.
 *
 * @param      input     The packed endpoints (packed and modal).
 * @param[out] output0   The unpacked endpoint 0 color.
 * @param[out] output1   The unpacked endpoint 1 color.
 */
static void hdr_rgb_hdr_alpha_unpack(
	const uint8_t input[8],
	vint4& output0,
	vint4& output1
) {}

/* See header for documentation. */
void unpack_color_endpoints(
	astcenc_profile decode_mode,
	int format,
	const uint8_t* input,
	bool& rgb_hdr,
	bool& alpha_hdr,
	vint4& output0,
	vint4& output1
) {}