// SPDX-License-Identifier: Apache-2.0 // ---------------------------------------------------------------------------- // Copyright 2011-2024 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. // ---------------------------------------------------------------------------- /** * @brief Functions to decompress a symbolic block. */ #include "astcenc_internal.h" #include <stdio.h> #include <assert.h> /** * @brief Compute the integer linear interpolation of two color endpoints. * * @param u8_mask The mask for lanes using decode_unorm8 rather than decode_f16. * @param color0 The endpoint0 color. * @param color1 The endpoint1 color. * @param weights The interpolation weight (between 0 and 64). * * @return The interpolated color. */ static vint4 lerp_color_int( vmask4 u8_mask, vint4 color0, vint4 color1, vint4 weights ) { … } /** * @brief Convert integer color value into a float value for the decoder. * * @param data The integer color value post-interpolation. * @param lns_mask If set treat lane as HDR (LNS) else LDR (unorm16). * * @return The float color value. */ static inline vfloat4 decode_texel( vint4 data, vmask4 lns_mask ) { … } /* See header for documentation. */ void unpack_weights( const block_size_descriptor& bsd, const symbolic_compressed_block& scb, const decimation_info& di, bool is_dual_plane, int weights_plane1[BLOCK_MAX_TEXELS], int weights_plane2[BLOCK_MAX_TEXELS] ) { … } /** * @brief Return an FP32 NaN value for use in error colors. * * This NaN encoding will turn into 0xFFFF when converted to an FP16 NaN. * * @return The float color value. */ static float error_color_nan() { … } /* See header for documentation. */ void decompress_symbolic_block( astcenc_profile decode_mode, const block_size_descriptor& bsd, int xpos, int ypos, int zpos, const symbolic_compressed_block& scb, image_block& blk ) { … } #if !defined(ASTCENC_DECOMPRESS_ONLY) /* See header for documentation. */ float compute_symbolic_block_difference_2plane( const astcenc_config& config, const block_size_descriptor& bsd, const symbolic_compressed_block& scb, const image_block& blk ) { … } /* See header for documentation. */ float compute_symbolic_block_difference_1plane( const astcenc_config& config, const block_size_descriptor& bsd, const symbolic_compressed_block& scb, const image_block& blk ) { … } /* See header for documentation. */ float compute_symbolic_block_difference_1plane_1partition( const astcenc_config& config, const block_size_descriptor& bsd, const symbolic_compressed_block& scb, const image_block& blk ) { … } #endif