godot/thirdparty/basis_universal/encoder/basisu_bc7enc.h

// File: basisu_bc7enc.h
// Copyright (C) 2019-2024 Binomial LLC. All Rights Reserved.
//
// 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.
#pragma once
#include "basisu_enc.h"
#include "../transcoder/basisu_transcoder_uastc.h"

namespace basisu
{

#define BC7ENC_MAX_PARTITIONS1
#define BC7ENC_MAX_UBER_LEVEL

	bc7enc_bool;

#define BC7ENC_TRUE
#define BC7ENC_FALSE
		
	bc7enc_vec4F;

	extern const float g_bc7_weights1x[2 * 4];
	extern const float g_bc7_weights2x[4 * 4];
	extern const float g_bc7_weights3x[8 * 4];
	extern const float g_bc7_weights4x[16 * 4];
	extern const float g_astc_weights4x[16 * 4];
	extern const float g_astc_weights5x[32 * 4];
	extern const float g_astc_weights_3levelsx[3 * 4];
			
	extern basist::astc_quant_bin g_astc_sorted_order_unquant[basist::BC7ENC_TOTAL_ASTC_RANGES][256]; // [sorted unquantized order]
	
	struct color_cell_compressor_params
	{};

	struct color_cell_compressor_results
	{};

	struct bc7enc_compress_block_params
	{};

	uint64_t color_cell_compression(uint32_t mode, const color_cell_compressor_params* pParams, color_cell_compressor_results* pResults, const bc7enc_compress_block_params* pComp_params);
		
	uint64_t color_cell_compression_est_astc(
		uint32_t num_weights, uint32_t num_comps, const uint32_t* pWeight_table,
		uint32_t num_pixels, const basist::color_quad_u8* pPixels,
		uint64_t best_err_so_far, const uint32_t weights[4]);
		
	inline void bc7enc_compress_block_params_init_linear_weights(bc7enc_compress_block_params* p)
	{}

	inline void bc7enc_compress_block_params_init_perceptual_weights(bc7enc_compress_block_params* p)
	{}

	inline void bc7enc_compress_block_params_init(bc7enc_compress_block_params* p)
	{}

	// bc7enc_compress_block_init() MUST be called before calling bc7enc_compress_block() (or you'll get artifacts).
	void bc7enc_compress_block_init();
				
} // namespace basisu