godot/thirdparty/basis_universal/encoder/basisu_etc.cpp

// basis_etc.cpp
// Copyright (C) 2019-2021 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.
#include "basisu_etc.h"

#if BASISU_SUPPORT_SSE
#define CPPSPMD_NAME
#include "basisu_kernels_declares.h"
#endif

#define BASISU_DEBUG_ETC_ENCODER
#define BASISU_DEBUG_ETC_ENCODER_DEEPER

namespace basisu
{
	const int8_t g_etc2_eac_tables[16][8] =;

	const int8_t g_etc2_eac_tables8[16][8] =;
		
	// Given an ETC1 diff/inten_table/selector, and an 8-bit desired color, this table encodes the best packed_color in the low byte, and the abs error in the high byte.
	static uint16_t g_etc1_inverse_lookup[2 * 8 * 4][256];      // [ diff/inten_table/selector][desired_color ]

	// g_color8_to_etc_block_config[color][table_index] = Supplies for each 8-bit color value a list of packed ETC1 diff/intensity table/selectors/packed_colors that map to that color.
	// To pack: diff | (inten << 1) | (selector << 4) | (packed_c << 8)
	static const uint16_t g_etc1_color8_to_etc_block_config_0_255[2][33] =;

	// Really only [254][11].
	static const uint16_t g_etc1_color8_to_etc_block_config_1_to_254[254][12] =;

	static uint32_t etc1_decode_value(uint32_t diff, uint32_t inten, uint32_t selector, uint32_t packed_c)
	{}

	void pack_etc1_solid_color_init()
	{}

	// Packs solid color blocks efficiently using a set of small precomputed tables.
	// For random 888 inputs, MSE results are better than Erricson's ETC1 packer in "slow" mode ~9.5% of the time, is slightly worse only ~.01% of the time, and is equal the rest of the time.
	uint64_t pack_etc1_block_solid_color(etc_block& block, const uint8_t* pColor)
	{}
	
	const uint32_t BASISU_ETC1_CLUSTER_FIT_ORDER_TABLE_SIZE =;

	static const struct {} g_cluster_fit_order_tab[BASISU_ETC1_CLUSTER_FIT_ORDER_TABLE_SIZE] =;
		
	const int g_etc1_inten_tables[cETC1IntenModifierValues][cETC1SelectorValues] =;

	const uint8_t g_etc1_to_selector_index[cETC1SelectorValues] =;
	const uint8_t g_selector_index_to_etc1[cETC1SelectorValues] =;

	// [flip][subblock][pixel_index]
	const etc_coord2 g_etc1_pixel_coords[2][2][8] =;

	// [flip][subblock][pixel_index]
	const uint32_t g_etc1_pixel_indices[2][2][8] =;

	uint16_t etc_block::pack_color5(const color_rgba& color, bool scaled, uint32_t bias)
	{}

	uint16_t etc_block::pack_color5(uint32_t r, uint32_t g, uint32_t b, bool scaled, uint32_t bias)
	{}

	color_rgba etc_block::unpack_color5(uint16_t packed_color5, bool scaled, uint32_t alpha)
	{}

	void etc_block::unpack_color5(color_rgba& result, uint16_t packed_color5, bool scaled)
	{}

	void etc_block::unpack_color5(uint32_t& r, uint32_t& g, uint32_t& b, uint16_t packed_color5, bool scaled)
	{}

	bool etc_block::unpack_color5(color_rgba& result, uint16_t packed_color5, uint16_t packed_delta3, bool scaled, uint32_t alpha)
	{}

	bool etc_block::unpack_color5(uint32_t& r, uint32_t& g, uint32_t& b, uint16_t packed_color5, uint16_t packed_delta3, bool scaled, uint32_t alpha)
	{}

	uint16_t etc_block::pack_delta3(const color_rgba_i16& color)
	{}

	uint16_t etc_block::pack_delta3(int r, int g, int b)
	{}

	color_rgba_i16 etc_block::unpack_delta3(uint16_t packed_delta3)
	{}

	void etc_block::unpack_delta3(int& r, int& g, int& b, uint16_t packed_delta3)
	{}

	uint16_t etc_block::pack_color4(const color_rgba& color, bool scaled, uint32_t bias)
	{}

	uint16_t etc_block::pack_color4(uint32_t r, uint32_t g, uint32_t b, bool scaled, uint32_t bias)
	{}

	color_rgba etc_block::unpack_color4(uint16_t packed_color4, bool scaled, uint32_t alpha)
	{}

	void etc_block::unpack_color4(uint32_t& r, uint32_t& g, uint32_t& b, uint16_t packed_color4, bool scaled)
	{}

	void etc_block::get_diff_subblock_colors(color_rgba* pDst, uint16_t packed_color5, uint32_t table_idx)
	{}

	bool etc_block::get_diff_subblock_colors(color_rgba* pDst, uint16_t packed_color5, uint16_t packed_delta3, uint32_t table_idx)
	{}

	void etc_block::get_abs_subblock_colors(color_rgba* pDst, uint16_t packed_color4, uint32_t table_idx)
	{}
		
	bool unpack_etc1(const etc_block& block, color_rgba *pDst, bool preserve_alpha)
	{}

	inline int extend_6_to_8(uint32_t n)
	{}

	inline int extend_7_to_8(uint32_t n)
	{}

	inline int extend_4_to_8(uint32_t n)
	{}
		
	uint64_t etc_block::evaluate_etc1_error(const color_rgba* pBlock_pixels, bool perceptual, int subblock_index) const
	{}

	void etc_block::get_subblock_pixels(color_rgba* pPixels, int subblock_index) const
	{}
								
	bool etc1_optimizer::compute()
	{}

	void etc1_optimizer::refine_solution(uint32_t max_refinement_trials)
	{}

	void etc1_optimizer::compute_internal_neighborhood(int scan_r, int scan_g, int scan_b)
	{}

	void etc1_optimizer::compute_internal_cluster_fit(uint32_t total_perms_to_try)
	{}

	void etc1_optimizer::init(const params& params, results& result)
	{}

	// Return false if we've probably already tried this solution, true if we have definitely not.
	bool etc1_optimizer::check_for_redundant_solution(const etc1_solution_coordinates& coords)
	{}
		
	static uint8_t g_eval_dist_tables[8][256] =;

	bool etc1_optimizer::evaluate_solution_slow(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution)
	{}

	bool etc1_optimizer::evaluate_solution_fast(const etc1_solution_coordinates& coords, potential_solution& trial_solution, potential_solution* pBest_solution)
	{}

	uint64_t pack_eac_a8(pack_eac_a8_results& results, const uint8_t* pPixels, uint32_t num_pixels, uint32_t base_search_rad, uint32_t mul_search_rad, uint32_t table_mask)
	{}

	void pack_eac_a8(eac_a8_block* pBlock, const uint8_t* pPixels, uint32_t base_search_rad, uint32_t mul_search_rad, uint32_t table_mask)
	{}

} // namespace basisu