11// SPDX-License-Identifier: Apache-2.0
22// ----------------------------------------------------------------------------
3- // Copyright 2011-2023 Arm Limited
3+ // Copyright 2011-2025 Arm Limited
44//
55// Licensed under the Apache License, Version 2.0 (the "License"); you may not
66// use this file except in compliance with the License. You may obtain a copy
@@ -50,7 +50,7 @@ static void compute_partition_averages_rgb(
5050 vfloat4 averages[BLOCK_MAX_PARTITIONS]
5151) {
5252 unsigned int partition_count = pi.partition_count ;
53- unsigned int texel_count = blk.texel_count ;
53+ size_t texel_count = blk.texel_count ;
5454 promise (texel_count > 0 );
5555
5656 // For 1 partition just use the precomputed mean
@@ -64,7 +64,7 @@ static void compute_partition_averages_rgb(
6464 vfloatacc pp_avg_rgb[3 ] {};
6565
6666 vint lane_id = vint::lane_id ();
67- for (unsigned int i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
67+ for (size_t i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
6868 {
6969 vint texel_partition (pi.partition_of_texel + i);
7070
@@ -100,7 +100,7 @@ static void compute_partition_averages_rgb(
100100 vfloatacc pp_avg_rgb[2 ][3 ] {};
101101
102102 vint lane_id = vint::lane_id ();
103- for (unsigned int i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
103+ for (size_t i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
104104 {
105105 vint texel_partition (pi.partition_of_texel + i);
106106
@@ -145,7 +145,7 @@ static void compute_partition_averages_rgb(
145145 vfloatacc pp_avg_rgb[3 ][3 ] {};
146146
147147 vint lane_id = vint::lane_id ();
148- for (unsigned int i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
148+ for (size_t i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
149149 {
150150 vint texel_partition (pi.partition_of_texel + i);
151151
@@ -221,7 +221,7 @@ static void compute_partition_averages_rgba(
221221 vfloat4 averages[BLOCK_MAX_PARTITIONS]
222222) {
223223 unsigned int partition_count = pi.partition_count ;
224- unsigned int texel_count = blk.texel_count ;
224+ size_t texel_count = blk.texel_count ;
225225 promise (texel_count > 0 );
226226
227227 // For 1 partition just use the precomputed mean
@@ -235,7 +235,7 @@ static void compute_partition_averages_rgba(
235235 vfloat4 pp_avg_rgba[4 ] {};
236236
237237 vint lane_id = vint::lane_id ();
238- for (unsigned int i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
238+ for (size_t i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
239239 {
240240 vint texel_partition (pi.partition_of_texel + i);
241241
@@ -275,7 +275,7 @@ static void compute_partition_averages_rgba(
275275 vfloat4 pp_avg_rgba[2 ][4 ] {};
276276
277277 vint lane_id = vint::lane_id ();
278- for (unsigned int i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
278+ for (size_t i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
279279 {
280280 vint texel_partition (pi.partition_of_texel + i);
281281
@@ -326,7 +326,7 @@ static void compute_partition_averages_rgba(
326326 vfloat4 pp_avg_rgba[3 ][4 ] {};
327327
328328 vint lane_id = vint::lane_id ();
329- for (unsigned int i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
329+ for (size_t i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
330330 {
331331 vint texel_partition (pi.partition_of_texel + i);
332332
@@ -390,17 +390,17 @@ void compute_avgs_and_dirs_4_comp(
390390 const image_block& blk,
391391 partition_metrics pm[BLOCK_MAX_PARTITIONS]
392392) {
393- int partition_count = pi.partition_count ;
393+ size_t partition_count = pi.partition_count ;
394394 promise (partition_count > 0 );
395395
396396 // Pre-compute partition_averages
397397 vfloat4 partition_averages[BLOCK_MAX_PARTITIONS];
398398 compute_partition_averages_rgba (pi, blk, partition_averages);
399399
400- for (int partition = 0 ; partition < partition_count; partition++)
400+ for (size_t partition = 0 ; partition < partition_count; partition++)
401401 {
402402 const uint8_t *texel_indexes = pi.texels_of_partition [partition];
403- unsigned int texel_count = pi.partition_texel_count [partition];
403+ size_t texel_count = pi.partition_texel_count [partition];
404404 promise (texel_count > 0 );
405405
406406 vfloat4 average = partition_averages[partition];
@@ -411,7 +411,7 @@ void compute_avgs_and_dirs_4_comp(
411411 vfloat4 sum_zp = vfloat4::zero ();
412412 vfloat4 sum_wp = vfloat4::zero ();
413413
414- for (unsigned int i = 0 ; i < texel_count; i++)
414+ for (size_t i = 0 ; i < texel_count; i++)
415415 {
416416 unsigned int iwt = texel_indexes[i];
417417 vfloat4 texel_datum = blk.texel (iwt);
@@ -509,13 +509,13 @@ void compute_avgs_and_dirs_3_comp(
509509 partition_averages[3 ] = partition_averages[3 ].swz <0 , 1 , 2 >();
510510 }
511511
512- unsigned int partition_count = pi.partition_count ;
512+ size_t partition_count = pi.partition_count ;
513513 promise (partition_count > 0 );
514514
515- for (unsigned int partition = 0 ; partition < partition_count; partition++)
515+ for (size_t partition = 0 ; partition < partition_count; partition++)
516516 {
517517 const uint8_t *texel_indexes = pi.texels_of_partition [partition];
518- unsigned int texel_count = pi.partition_texel_count [partition];
518+ size_t texel_count = pi.partition_texel_count [partition];
519519 promise (texel_count > 0 );
520520
521521 vfloat4 average = partition_averages[partition];
@@ -525,7 +525,7 @@ void compute_avgs_and_dirs_3_comp(
525525 vfloat4 sum_yp = vfloat4::zero ();
526526 vfloat4 sum_zp = vfloat4::zero ();
527527
528- for (unsigned int i = 0 ; i < texel_count; i++)
528+ for (size_t i = 0 ; i < texel_count; i++)
529529 {
530530 unsigned int iwt = texel_indexes[i];
531531
@@ -570,17 +570,17 @@ void compute_avgs_and_dirs_3_comp_rgb(
570570 const image_block& blk,
571571 partition_metrics pm[BLOCK_MAX_PARTITIONS]
572572) {
573- unsigned int partition_count = pi.partition_count ;
573+ size_t partition_count = pi.partition_count ;
574574 promise (partition_count > 0 );
575575
576576 // Pre-compute partition_averages
577577 vfloat4 partition_averages[BLOCK_MAX_PARTITIONS];
578578 compute_partition_averages_rgb (pi, blk, partition_averages);
579579
580- for (unsigned int partition = 0 ; partition < partition_count; partition++)
580+ for (size_t partition = 0 ; partition < partition_count; partition++)
581581 {
582582 const uint8_t *texel_indexes = pi.texels_of_partition [partition];
583- unsigned int texel_count = pi.partition_texel_count [partition];
583+ size_t texel_count = pi.partition_texel_count [partition];
584584 promise (texel_count > 0 );
585585
586586 vfloat4 average = partition_averages[partition];
@@ -590,7 +590,7 @@ void compute_avgs_and_dirs_3_comp_rgb(
590590 vfloat4 sum_yp = vfloat4::zero ();
591591 vfloat4 sum_zp = vfloat4::zero ();
592592
593- for (unsigned int i = 0 ; i < texel_count; i++)
593+ for (size_t i = 0 ; i < texel_count; i++)
594594 {
595595 unsigned int iwt = texel_indexes[i];
596596
@@ -664,20 +664,20 @@ void compute_avgs_and_dirs_2_comp(
664664 data_vg = blk.data_b ;
665665 }
666666
667- unsigned int partition_count = pt.partition_count ;
667+ size_t partition_count = pt.partition_count ;
668668 promise (partition_count > 0 );
669669
670- for (unsigned int partition = 0 ; partition < partition_count; partition++)
670+ for (size_t partition = 0 ; partition < partition_count; partition++)
671671 {
672672 const uint8_t *texel_indexes = pt.texels_of_partition [partition];
673- unsigned int texel_count = pt.partition_texel_count [partition];
673+ size_t texel_count = pt.partition_texel_count [partition];
674674 promise (texel_count > 0 );
675675
676676 // Only compute a partition mean if more than one partition
677677 if (partition_count > 1 )
678678 {
679679 average = vfloat4::zero ();
680- for (unsigned int i = 0 ; i < texel_count; i++)
680+ for (size_t i = 0 ; i < texel_count; i++)
681681 {
682682 unsigned int iwt = texel_indexes[i];
683683 average += vfloat2 (data_vr[iwt], data_vg[iwt]);
@@ -691,7 +691,7 @@ void compute_avgs_and_dirs_2_comp(
691691 vfloat4 sum_xp = vfloat4::zero ();
692692 vfloat4 sum_yp = vfloat4::zero ();
693693
694- for (unsigned int i = 0 ; i < texel_count; i++)
694+ for (size_t i = 0 ; i < texel_count; i++)
695695 {
696696 unsigned int iwt = texel_indexes[i];
697697 vfloat4 texel_datum = vfloat2 (data_vr[iwt], data_vg[iwt]);
@@ -729,20 +729,20 @@ void compute_error_squared_rgba(
729729 float & uncor_error,
730730 float & samec_error
731731) {
732- unsigned int partition_count = pi.partition_count ;
732+ size_t partition_count = pi.partition_count ;
733733 promise (partition_count > 0 );
734734
735735 vfloatacc uncor_errorsumv = vfloatacc::zero ();
736736 vfloatacc samec_errorsumv = vfloatacc::zero ();
737737
738- for (unsigned int partition = 0 ; partition < partition_count; partition++)
738+ for (size_t partition = 0 ; partition < partition_count; partition++)
739739 {
740740 const uint8_t *texel_indexes = pi.texels_of_partition [partition];
741741
742742 processed_line4 l_uncor = uncor_plines[partition];
743743 processed_line4 l_samec = samec_plines[partition];
744744
745- unsigned int texel_count = pi.partition_texel_count [partition];
745+ size_t texel_count = pi.partition_texel_count [partition];
746746 promise (texel_count > 0 );
747747
748748 // Vectorize some useful scalar inputs
@@ -775,7 +775,7 @@ void compute_error_squared_rgba(
775775 // array to extend the last value. This means min/max are not impacted, but we need to mask
776776 // out the dummy values when we compute the line weighting.
777777 vint lane_ids = vint::lane_id ();
778- for (unsigned int i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
778+ for (size_t i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
779779 {
780780 vmask mask = lane_ids < vint (texel_count);
781781 const uint8_t * texel_idxs = texel_indexes + i;
@@ -847,17 +847,17 @@ void compute_error_squared_rgb(
847847 float & uncor_error,
848848 float & samec_error
849849) {
850- unsigned int partition_count = pi.partition_count ;
850+ size_t partition_count = pi.partition_count ;
851851 promise (partition_count > 0 );
852852
853853 vfloatacc uncor_errorsumv = vfloatacc::zero ();
854854 vfloatacc samec_errorsumv = vfloatacc::zero ();
855855
856- for (unsigned int partition = 0 ; partition < partition_count; partition++)
856+ for (size_t partition = 0 ; partition < partition_count; partition++)
857857 {
858858 partition_lines3& pl = plines[partition];
859859 const uint8_t *texel_indexes = pi.texels_of_partition [partition];
860- unsigned int texel_count = pi.partition_texel_count [partition];
860+ size_t texel_count = pi.partition_texel_count [partition];
861861 promise (texel_count > 0 );
862862
863863 processed_line3 l_uncor = pl.uncor_pline ;
@@ -889,7 +889,7 @@ void compute_error_squared_rgb(
889889 // to extend the last value. This means min/max are not impacted, but we need to mask
890890 // out the dummy values when we compute the line weighting.
891891 vint lane_ids = vint::lane_id ();
892- for (unsigned int i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
892+ for (size_t i = 0 ; i < texel_count; i += ASTCENC_SIMD_WIDTH)
893893 {
894894 vmask mask = lane_ids < vint (texel_count);
895895 const uint8_t * texel_idxs = texel_indexes + i;
0 commit comments