#include "basisu_bc7enc.h"
#ifdef _DEBUG
#define BC7ENC_CHECK_OVERALL_ERROR …
#else
#define BC7ENC_CHECK_OVERALL_ERROR …
#endif
usingnamespacebasist;
namespace basisu
{
static inline color_quad_u8 *color_quad_u8_set_clamped(color_quad_u8 *pRes, int32_t r, int32_t g, int32_t b, int32_t a) { … }
static inline color_quad_u8 *color_quad_u8_set(color_quad_u8 *pRes, int32_t r, int32_t g, int32_t b, int32_t a) { … }
static inline bc7enc_bool color_quad_u8_notequals(const color_quad_u8 *pLHS, const color_quad_u8 *pRHS) { … }
static inline bc7enc_vec4F*vec4F_set_scalar(bc7enc_vec4F*pV, float x) { … }
static inline bc7enc_vec4F*vec4F_set(bc7enc_vec4F*pV, float x, float y, float z, float w) { … }
static inline bc7enc_vec4F*vec4F_saturate_in_place(bc7enc_vec4F*pV) { … }
static inline bc7enc_vec4F vec4F_saturate(const bc7enc_vec4F*pV) { … }
static inline bc7enc_vec4F vec4F_from_color(const color_quad_u8 *pC) { … }
static inline bc7enc_vec4F vec4F_add(const bc7enc_vec4F*pLHS, const bc7enc_vec4F*pRHS) { … }
static inline bc7enc_vec4F vec4F_sub(const bc7enc_vec4F*pLHS, const bc7enc_vec4F*pRHS) { … }
static inline float vec4F_dot(const bc7enc_vec4F*pLHS, const bc7enc_vec4F*pRHS) { … }
static inline bc7enc_vec4F vec4F_mul(const bc7enc_vec4F*pLHS, float s) { … }
static inline bc7enc_vec4F* vec4F_normalize_in_place(bc7enc_vec4F*pV) { … }
const float g_bc7_weights1x[2 * 4] = …;
const float g_bc7_weights2x[4 * 4] = …;
const float g_bc7_weights3x[8 * 4] = …;
const float g_bc7_weights4x[16 * 4] = …;
const float g_astc_weights4x[16 * 4] = …;
const float g_astc_weights5x[32 * 4] = …;
const float g_astc_weights_3levelsx[3 * 4] = …;
static endpoint_err g_bc7_mode_1_optimal_endpoints[256][2];
static const uint32_t BC7ENC_MODE_1_OPTIMAL_INDEX = …;
static endpoint_err g_astc_4bit_3bit_optimal_endpoints[256];
static const uint32_t BC7ENC_ASTC_4BIT_3BIT_OPTIMAL_INDEX = …;
static endpoint_err g_astc_4bit_2bit_optimal_endpoints[256];
static const uint32_t BC7ENC_ASTC_4BIT_2BIT_OPTIMAL_INDEX = …;
static endpoint_err g_astc_range7_2bit_optimal_endpoints[256];
static const uint32_t BC7ENC_ASTC_RANGE7_2BIT_OPTIMAL_INDEX = …;
static endpoint_err g_astc_range13_4bit_optimal_endpoints[256];
static const uint32_t BC7ENC_ASTC_RANGE13_4BIT_OPTIMAL_INDEX = …;
static endpoint_err g_astc_range13_2bit_optimal_endpoints[256];
static const uint32_t BC7ENC_ASTC_RANGE13_2BIT_OPTIMAL_INDEX = …;
static endpoint_err g_astc_range11_5bit_optimal_endpoints[256];
static const uint32_t BC7ENC_ASTC_RANGE11_5BIT_OPTIMAL_INDEX = …;
astc_quant_bin g_astc_sorted_order_unquant[BC7ENC_TOTAL_ASTC_RANGES][256];
static uint8_t g_astc_nearest_sorted_index[BC7ENC_TOTAL_ASTC_RANGES][256];
static void astc_init()
{ … }
static inline uint32_t astc_interpolate_linear(uint32_t l, uint32_t h, uint32_t w)
{ … }
void bc7enc_compress_block_init()
{ … }
static void compute_least_squares_endpoints_rgba(uint32_t N, const uint8_t *pSelectors, const bc7enc_vec4F* pSelector_weights, bc7enc_vec4F* pXl, bc7enc_vec4F* pXh, const color_quad_u8 *pColors)
{ … }
static void compute_least_squares_endpoints_rgb(uint32_t N, const uint8_t *pSelectors, const bc7enc_vec4F*pSelector_weights, bc7enc_vec4F*pXl, bc7enc_vec4F*pXh, const color_quad_u8 *pColors)
{ … }
static inline color_quad_u8 scale_color(const color_quad_u8* pC, const color_cell_compressor_params* pParams)
{ … }
static inline uint64_t compute_color_distance_rgb(const color_quad_u8 *pE1, const color_quad_u8 *pE2, bc7enc_bool perceptual, const uint32_t weights[4])
{ … }
static inline uint64_t compute_color_distance_rgba(const color_quad_u8 *pE1, const color_quad_u8 *pE2, bc7enc_bool perceptual, const uint32_t weights[4])
{ … }
static uint64_t pack_mode1_to_one_color(const color_cell_compressor_params *pParams, color_cell_compressor_results *pResults, uint32_t r, uint32_t g, uint32_t b, uint8_t *pSelectors)
{ … }
static uint64_t pack_astc_4bit_3bit_to_one_color(const color_cell_compressor_params *pParams, color_cell_compressor_results *pResults, uint32_t r, uint32_t g, uint32_t b, uint8_t *pSelectors)
{ … }
static uint64_t pack_astc_4bit_2bit_to_one_color_rgba(const color_cell_compressor_params *pParams, color_cell_compressor_results *pResults, uint32_t r, uint32_t g, uint32_t b, uint32_t a, uint8_t *pSelectors)
{ … }
static uint64_t pack_astc_range7_2bit_to_one_color(const color_cell_compressor_params *pParams, color_cell_compressor_results *pResults, uint32_t r, uint32_t g, uint32_t b, uint8_t *pSelectors)
{ … }
static uint64_t pack_astc_range13_2bit_to_one_color(const color_cell_compressor_params *pParams, color_cell_compressor_results *pResults, uint32_t r, uint32_t g, uint32_t b, uint8_t *pSelectors)
{ … }
static uint64_t pack_astc_range11_5bit_to_one_color(const color_cell_compressor_params* pParams, color_cell_compressor_results* pResults, uint32_t r, uint32_t g, uint32_t b, uint8_t* pSelectors)
{ … }
static uint64_t evaluate_solution(const color_quad_u8 *pLow, const color_quad_u8 *pHigh, const uint32_t pbits[2], const color_cell_compressor_params *pParams, color_cell_compressor_results *pResults)
{ … }
static bool areDegenerateEndpoints(color_quad_u8* pTrialMinColor, color_quad_u8* pTrialMaxColor, const bc7enc_vec4F* pXl, const bc7enc_vec4F* pXh)
{ … }
static void fixDegenerateEndpoints(uint32_t mode, color_quad_u8 *pTrialMinColor, color_quad_u8 *pTrialMaxColor, const bc7enc_vec4F*pXl, const bc7enc_vec4F*pXh, uint32_t iscale, int flags)
{ … }
static uint64_t find_optimal_solution(uint32_t mode, bc7enc_vec4F xl, bc7enc_vec4F xh, const color_cell_compressor_params *pParams, color_cell_compressor_results *pResults)
{ … }
void check_best_overall_error(const color_cell_compressor_params *pParams, color_cell_compressor_results *pResults)
{ … }
static bool is_solid_rgb(const color_cell_compressor_params *pParams, uint32_t &r, uint32_t &g, uint32_t &b)
{ … }
static bool is_solid_rgba(const color_cell_compressor_params *pParams, uint32_t &r, uint32_t &g, uint32_t &b, uint32_t &a)
{ … }
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 color_quad_u8* pPixels,
uint64_t best_err_so_far, const uint32_t weights[4])
{ … }
}