godot/thirdparty/basis_universal/encoder/basisu_etc.h

// basis_etc.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 "../transcoder/basisu.h"
#include "basisu_enc.h"

namespace basisu
{
	enum etc_constants
	{};
	
	extern const int g_etc1_inten_tables[cETC1IntenModifierValues][cETC1SelectorValues];
	extern const uint8_t g_etc1_to_selector_index[cETC1SelectorValues];
	extern const uint8_t g_selector_index_to_etc1[cETC1SelectorValues];

	struct etc_coord2
	{};
	extern const etc_coord2 g_etc1_pixel_coords[2][2][8]; // [flipped][subblock][subblock_pixel]
	extern const uint32_t g_etc1_pixel_indices[2][2][8]; // [flipped][subblock][subblock_pixel]

	struct etc_block
	{};
		
	etc_block_vec;

	// Returns false if the unpack fails (could be bogus data or ETC2)
	bool unpack_etc1(const etc_block& block, color_rgba *pDst, bool preserve_alpha = false);
		
	enum basis_etc_quality
	{};

	struct basis_etc1_pack_params
	{};

	struct etc1_solution_coordinates
	{};

	class etc1_optimizer
	{};

	struct pack_etc1_block_context
	{};
	
	void pack_etc1_solid_color_init();
	uint64_t pack_etc1_block_solid_color(etc_block& block, const uint8_t* pColor);

	// ETC EAC
	extern const int8_t g_etc2_eac_tables[16][8];
	extern const int8_t g_etc2_eac_tables8[16][8];

	const uint32_t ETC2_EAC_MIN_VALUE_SELECTOR =, ETC2_EAC_MAX_VALUE_SELECTOR =;

	struct eac_a8_block
	{};

	struct etc2_rgba_block
	{};

	struct pack_eac_a8_results
	{};

	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 = UINT32_MAX);
	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 = UINT32_MAX);
		
} // namespace basisu