diff --git a/Source/astcenc_compress_symbolic.cpp b/Source/astcenc_compress_symbolic.cpp index ca1e981396f60196b6d963da0c9433b806ae0666..a93046a4551aa49ecde9beafbed61af4d0413e30 100644 --- a/Source/astcenc_compress_symbolic.cpp +++ b/Source/astcenc_compress_symbolic.cpp @@ -209,8 +209,8 @@ static bool realign_weights_undecimated( vfloat4 error_down_vec = vfloat4(error_down0, error_down1, error_down2, error_down3); vfloat4 error_up_vec = vfloat4(error_up0, error_up1, error_up2, error_up3); - vmask4 check_result_up = (error_up_vec < error_base_vec) & - (error_up_vec < error_down_vec) & (uqw_vec < vint4(64)); + vmask4 check_result_up = (error_up_vec < error_base_vec) & + (error_up_vec < error_down_vec) & (uqw_vec < vint4(64)); vmask4 check_result_down = (error_down_vec < error_base_vec) & (uqw_vec > vint4::zero()); check_result_down = check_result_down & (~check_result_up); @@ -222,8 +222,8 @@ static bool realign_weights_undecimated( dec_weights_uquant[texel] = uqw_vec.lane<0>(); dec_weights_uquant[texel + 1] = uqw_vec.lane<1>(); - dec_weights_uquant[texel + 2] = uqw_vec.lane<2>(); - dec_weights_uquant[texel + 3] = uqw_vec.lane<3>(); + dec_weights_uquant[texel + 2] = uqw_vec.lane<2>(); // channel 2 + dec_weights_uquant[texel + 3] = uqw_vec.lane<3>(); // channel 3 adjustments = true; } }; diff --git a/Source/astcenc_find_best_partitioning.cpp b/Source/astcenc_find_best_partitioning.cpp index 5d0682e9c5cbff932b183683e13b2a0607dfd30c..119e435ac91d447876afe1f01cefb78b61c3a3c8 100644 --- a/Source/astcenc_find_best_partitioning.cpp +++ b/Source/astcenc_find_best_partitioning.cpp @@ -260,7 +260,7 @@ static inline uint8_t partition_mismatch2( uint64x2_t b10 = vextq_u64(b01, b01, 1); uint8_t c1 = popcount(veorq_u64(a01, b01)); uint8_t c2 = popcount(veorq_u64(a01, b10)); - return static_cast(astc::min(c1, c2) / 2); + return static_cast(astc::min(c1, c2) / 2); // 2 is the number of partitions } #else static inline uint8_t partition_mismatch2( diff --git a/Source/astcenc_ideal_endpoints_and_weights.cpp b/Source/astcenc_ideal_endpoints_and_weights.cpp index 29f5745314ebe3018db6ab13972b44b197f7f531..e41d4e06a88d8dcdbed9e7c6949b12f6b9ef7578 100644 --- a/Source/astcenc_ideal_endpoints_and_weights.cpp +++ b/Source/astcenc_ideal_endpoints_and_weights.cpp @@ -364,7 +364,7 @@ static void compute_ideal_colors_and_weights_3_comp( unsigned int texel_count = blk.texel_count; promise(texel_count > 0); - partition_metrics *pms = (partition_metrics *)&blk.pms[0]; + partition_metrics *pms = reinterpret_cast(&blk.pms[0]); float error_weight; const float* data_vr = nullptr; diff --git a/Source/astcenc_internal.h b/Source/astcenc_internal.h index ba6a4b94ffdb46ea9fa41165bc5487fbfe70ff62..0c8248e069448adde828e938e495ef3da2249125 100644 --- a/Source/astcenc_internal.h +++ b/Source/astcenc_internal.h @@ -763,7 +763,7 @@ struct image_block /** @brief The input (compress) or output (decompress) data for the alpha color component. */ ASTCENC_ALIGNAS float data_a[BLOCK_MAX_TEXELS]; - partition_metrics pms[BLOCK_MAX_PARTITIONS]; + mutable partition_metrics pms[BLOCK_MAX_PARTITIONS]; /** @brief The number of texels in the block. */ uint8_t texel_count; diff --git a/Source/astcenc_pick_best_endpoint_format.cpp b/Source/astcenc_pick_best_endpoint_format.cpp index ff4e4450792de9fda84e3ddd38487edd08e1124f..d3b9f6c296efe2857e9ecfc941d9a59606e1c0e0 100644 --- a/Source/astcenc_pick_best_endpoint_format.cpp +++ b/Source/astcenc_pick_best_endpoint_format.cpp @@ -204,11 +204,10 @@ static void compute_error_squared_rgb_single_partition( haccumulate(l_errv2, dist2 * dist2); } - uncor_errv = uncor_errv0 * ews.lane<0>() + uncor_errv1 * ews.lane<1>() + uncor_errv2 * ews.lane<2>(); - samec_errv = samec_errv0 * ews.lane<0>() + samec_errv1 * ews.lane<1>() + samec_errv2 * ews.lane<2>(); - rgbl_errv = rgbl_errv0 * ews.lane<0>() + rgbl_errv1 * ews.lane<1>() + rgbl_errv2 * ews.lane<2>(); - l_errv = l_errv0 * ews.lane<0>() + l_errv1 * ews.lane<1>() + l_errv2 * ews.lane<2>(); - + uncor_errv = uncor_errv0 * ews.lane<0>() + uncor_errv1 * ews.lane<1>() + uncor_errv2 * ews.lane<2>(); // channel 0,1,2 + samec_errv = samec_errv0 * ews.lane<0>() + samec_errv1 * ews.lane<1>() + samec_errv2 * ews.lane<2>(); // channel 0,1,2 + rgbl_errv = rgbl_errv0 * ews.lane<0>() + rgbl_errv1 * ews.lane<1>() + rgbl_errv2 * ews.lane<2>(); // channel 0,1,2 + l_errv = l_errv0 * ews.lane<0>() + l_errv1 * ews.lane<1>() + l_errv2 * ews.lane<2>(); // channel 0,1,2 if (i < texel_count) { @@ -316,7 +315,7 @@ static void compute_encoding_choice_errors( int partition_count = pi.partition_count; promise(partition_count > 0); - partition_metrics *pms = (partition_metrics *)&blk.pms[0]; + partition_metrics *pms = reinterpret_cast(&blk.pms[0]); if (!blk.is_constant_channel(3) || (partition_count != 1 && privateProfile == HIGH_QUALITY_PROFILE)) { diff --git a/Source/astcenc_vecmathlib_common_4.h b/Source/astcenc_vecmathlib_common_4.h index a19b954f5ba9263d6fc716235b51700c15aad639..9fbbad8083b1c7fe3ec5b10760d091037ffe2d0a 100644 --- a/Source/astcenc_vecmathlib_common_4.h +++ b/Source/astcenc_vecmathlib_common_4.h @@ -290,7 +290,7 @@ ASTCENC_SIMD_INLINE void haccumulate(vfloat4& accum, vfloat4 a, vmask4 m) #define ASTCENC_USE_COMMON_GATHERF ASTCENC_SIMD_INLINE vfloat4 gatherf(const float* base, const uint8_t* idx) { - return vfloat4(base[idx[0]], base[idx[1]], base[idx[2]], base[idx[3]]); + return vfloat4(base[idx[0]], base[idx[1]], base[idx[2]], base[idx[3]]); // index 0,1,2,3 } /** @@ -307,7 +307,7 @@ ASTCENC_SIMD_INLINE float hadd_rgb_s(vfloat4 a) */ ASTCENC_SIMD_INLINE float hadd_rgba_s(vfloat4 a) { - return a.lane<0>() + a.lane<1>() + a.lane<2>() + a.lane<3>(); + return a.lane<0>() + a.lane<1>() + a.lane<2>() + a.lane<3>(); // channel 0,1,2,3 } #endif diff --git a/Source/astcenc_vecmathlib_neon_4.h b/Source/astcenc_vecmathlib_neon_4.h index f6f8de1df926162e159e95e260e6778f9d9b263a..c22f80f80731fc1d8426e9df3f15d46bb1e2eca8 100644 --- a/Source/astcenc_vecmathlib_neon_4.h +++ b/Source/astcenc_vecmathlib_neon_4.h @@ -650,12 +650,7 @@ ASTCENC_SIMD_INLINE vint4 gatheri(const int* base, vint4 indices) */ ASTCENC_SIMD_INLINE vint4 pack_low_bytes(vint4 a) { - uint8x16_t idx = { - 0, 4, 8, 12, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0 - }; + uint8x16_t idx = {0, 4, 8, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int8x16_t av = vreinterpretq_s8_s32(a.m); return vint4(vreinterpretq_s32_s8(vqtbl1q_s8(av, idx))); } diff --git a/Source/astcenc_weight_align.cpp b/Source/astcenc_weight_align.cpp index 703a0c61ec88270a7f906a358e0fba144e840ea4..14e736fa38c138a8c1397aecd84aa0397955f316 100644 --- a/Source/astcenc_weight_align.cpp +++ b/Source/astcenc_weight_align.cpp @@ -241,7 +241,6 @@ static void compute_lowest_and_highest_weight( rcp_stepsize = rcp_stepsize + vfloat(ASTCENC_SIMD_WIDTH); } - } #else static void compute_lowest_and_highest_weight( @@ -472,7 +471,7 @@ void compute_angular_endpoints_1plane( } compute_angular_endpoints_for_quant_levels( - privateProfile, + privateProfile, weight_count, dec_weight_ideal_value + i * BLOCK_MAX_WEIGHTS, max_precision, low_values[i], high_values[i]);