@@ -854,6 +854,8 @@ static void construct_block_size_descriptor_2d(
854854 unsigned int always_block_mode_count = 0 ;
855855 unsigned int always_decimation_mode_count = 0 ;
856856
857+ float always_threshold = 0 .0f ;
858+
857859 // Iterate twice; first time keep the "always" blocks, second time keep the "non-always" blocks.
858860 // This ensures that the always block modes and decimation modes are at the start of the list.
859861 for (unsigned int j = 0 ; j < 2 ; j ++)
@@ -869,12 +871,12 @@ static void construct_block_size_descriptor_2d(
869871 float percentile = percentiles[i];
870872 bool selected = (percentile <= mode_cutoff) || !can_omit_modes;
871873
872- if (j == 0 && percentile != 0 . 0f )
874+ if (j == 0 && percentile > always_threshold )
873875 {
874876 continue ;
875877 }
876878
877- if (j == 1 && percentile == 0 . 0f )
879+ if (j == 1 && percentile <= always_threshold )
878880 {
879881 continue ;
880882 }
@@ -911,7 +913,7 @@ static void construct_block_size_descriptor_2d(
911913 decimation_mode_index[y_weights * 16 + x_weights] = decimation_mode;
912914
913915 #if !defined(ASTCENC_DECOMPRESS_ONLY)
914- if (percentile == 0 . 0f )
916+ if (percentile <= always_threshold )
915917 {
916918 always_decimation_mode_count++;
917919 }
@@ -920,7 +922,7 @@ static void construct_block_size_descriptor_2d(
920922
921923 #if !defined(ASTCENC_DECOMPRESS_ONLY)
922924 // Flatten the block mode heuristic into some precomputed flags
923- if (percentile == 0 . 0f )
925+ if (percentile <= always_threshold )
924926 {
925927 always_block_mode_count++;
926928 bsd.block_modes [packed_idx].percentile_hit = true ;
0 commit comments