1
1
// SPDX-License-Identifier: Apache-2.0
2
2
// ----------------------------------------------------------------------------
3
- // Copyright 2011-2023 Arm Limited
3
+ // Copyright 2011-2025 Arm Limited
4
4
//
5
5
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
6
6
// use this file except in compliance with the License. You may obtain a copy
@@ -50,7 +50,7 @@ static void compute_partition_averages_rgb(
50
50
vfloat4 averages[BLOCK_MAX_PARTITIONS]
51
51
) {
52
52
unsigned int partition_count = pi.partition_count ;
53
- unsigned int texel_count = blk.texel_count ;
53
+ size_t texel_count = blk.texel_count ;
54
54
promise (texel_count > 0 );
55
55
56
56
// For 1 partition just use the precomputed mean
@@ -64,7 +64,7 @@ static void compute_partition_averages_rgb(
64
64
vfloatacc pp_avg_rgb[3 ] {};
65
65
66
66
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)
68
68
{
69
69
vint texel_partition (pi.partition_of_texel + i);
70
70
@@ -100,7 +100,7 @@ static void compute_partition_averages_rgb(
100
100
vfloatacc pp_avg_rgb[2 ][3 ] {};
101
101
102
102
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)
104
104
{
105
105
vint texel_partition (pi.partition_of_texel + i);
106
106
@@ -145,7 +145,7 @@ static void compute_partition_averages_rgb(
145
145
vfloatacc pp_avg_rgb[3 ][3 ] {};
146
146
147
147
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)
149
149
{
150
150
vint texel_partition (pi.partition_of_texel + i);
151
151
@@ -221,7 +221,7 @@ static void compute_partition_averages_rgba(
221
221
vfloat4 averages[BLOCK_MAX_PARTITIONS]
222
222
) {
223
223
unsigned int partition_count = pi.partition_count ;
224
- unsigned int texel_count = blk.texel_count ;
224
+ size_t texel_count = blk.texel_count ;
225
225
promise (texel_count > 0 );
226
226
227
227
// For 1 partition just use the precomputed mean
@@ -235,7 +235,7 @@ static void compute_partition_averages_rgba(
235
235
vfloat4 pp_avg_rgba[4 ] {};
236
236
237
237
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)
239
239
{
240
240
vint texel_partition (pi.partition_of_texel + i);
241
241
@@ -275,7 +275,7 @@ static void compute_partition_averages_rgba(
275
275
vfloat4 pp_avg_rgba[2 ][4 ] {};
276
276
277
277
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)
279
279
{
280
280
vint texel_partition (pi.partition_of_texel + i);
281
281
@@ -326,7 +326,7 @@ static void compute_partition_averages_rgba(
326
326
vfloat4 pp_avg_rgba[3 ][4 ] {};
327
327
328
328
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)
330
330
{
331
331
vint texel_partition (pi.partition_of_texel + i);
332
332
@@ -390,17 +390,17 @@ void compute_avgs_and_dirs_4_comp(
390
390
const image_block& blk,
391
391
partition_metrics pm[BLOCK_MAX_PARTITIONS]
392
392
) {
393
- int partition_count = pi.partition_count ;
393
+ size_t partition_count = pi.partition_count ;
394
394
promise (partition_count > 0 );
395
395
396
396
// Pre-compute partition_averages
397
397
vfloat4 partition_averages[BLOCK_MAX_PARTITIONS];
398
398
compute_partition_averages_rgba (pi, blk, partition_averages);
399
399
400
- for (int partition = 0 ; partition < partition_count; partition++)
400
+ for (size_t partition = 0 ; partition < partition_count; partition++)
401
401
{
402
402
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];
404
404
promise (texel_count > 0 );
405
405
406
406
vfloat4 average = partition_averages[partition];
@@ -411,7 +411,7 @@ void compute_avgs_and_dirs_4_comp(
411
411
vfloat4 sum_zp = vfloat4::zero ();
412
412
vfloat4 sum_wp = vfloat4::zero ();
413
413
414
- for (unsigned int i = 0 ; i < texel_count; i++)
414
+ for (size_t i = 0 ; i < texel_count; i++)
415
415
{
416
416
unsigned int iwt = texel_indexes[i];
417
417
vfloat4 texel_datum = blk.texel (iwt);
@@ -509,13 +509,13 @@ void compute_avgs_and_dirs_3_comp(
509
509
partition_averages[3 ] = partition_averages[3 ].swz <0 , 1 , 2 >();
510
510
}
511
511
512
- unsigned int partition_count = pi.partition_count ;
512
+ size_t partition_count = pi.partition_count ;
513
513
promise (partition_count > 0 );
514
514
515
- for (unsigned int partition = 0 ; partition < partition_count; partition++)
515
+ for (size_t partition = 0 ; partition < partition_count; partition++)
516
516
{
517
517
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];
519
519
promise (texel_count > 0 );
520
520
521
521
vfloat4 average = partition_averages[partition];
@@ -525,7 +525,7 @@ void compute_avgs_and_dirs_3_comp(
525
525
vfloat4 sum_yp = vfloat4::zero ();
526
526
vfloat4 sum_zp = vfloat4::zero ();
527
527
528
- for (unsigned int i = 0 ; i < texel_count; i++)
528
+ for (size_t i = 0 ; i < texel_count; i++)
529
529
{
530
530
unsigned int iwt = texel_indexes[i];
531
531
@@ -570,17 +570,17 @@ void compute_avgs_and_dirs_3_comp_rgb(
570
570
const image_block& blk,
571
571
partition_metrics pm[BLOCK_MAX_PARTITIONS]
572
572
) {
573
- unsigned int partition_count = pi.partition_count ;
573
+ size_t partition_count = pi.partition_count ;
574
574
promise (partition_count > 0 );
575
575
576
576
// Pre-compute partition_averages
577
577
vfloat4 partition_averages[BLOCK_MAX_PARTITIONS];
578
578
compute_partition_averages_rgb (pi, blk, partition_averages);
579
579
580
- for (unsigned int partition = 0 ; partition < partition_count; partition++)
580
+ for (size_t partition = 0 ; partition < partition_count; partition++)
581
581
{
582
582
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];
584
584
promise (texel_count > 0 );
585
585
586
586
vfloat4 average = partition_averages[partition];
@@ -590,7 +590,7 @@ void compute_avgs_and_dirs_3_comp_rgb(
590
590
vfloat4 sum_yp = vfloat4::zero ();
591
591
vfloat4 sum_zp = vfloat4::zero ();
592
592
593
- for (unsigned int i = 0 ; i < texel_count; i++)
593
+ for (size_t i = 0 ; i < texel_count; i++)
594
594
{
595
595
unsigned int iwt = texel_indexes[i];
596
596
@@ -664,20 +664,20 @@ void compute_avgs_and_dirs_2_comp(
664
664
data_vg = blk.data_b ;
665
665
}
666
666
667
- unsigned int partition_count = pt.partition_count ;
667
+ size_t partition_count = pt.partition_count ;
668
668
promise (partition_count > 0 );
669
669
670
- for (unsigned int partition = 0 ; partition < partition_count; partition++)
670
+ for (size_t partition = 0 ; partition < partition_count; partition++)
671
671
{
672
672
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];
674
674
promise (texel_count > 0 );
675
675
676
676
// Only compute a partition mean if more than one partition
677
677
if (partition_count > 1 )
678
678
{
679
679
average = vfloat4::zero ();
680
- for (unsigned int i = 0 ; i < texel_count; i++)
680
+ for (size_t i = 0 ; i < texel_count; i++)
681
681
{
682
682
unsigned int iwt = texel_indexes[i];
683
683
average += vfloat2 (data_vr[iwt], data_vg[iwt]);
@@ -691,7 +691,7 @@ void compute_avgs_and_dirs_2_comp(
691
691
vfloat4 sum_xp = vfloat4::zero ();
692
692
vfloat4 sum_yp = vfloat4::zero ();
693
693
694
- for (unsigned int i = 0 ; i < texel_count; i++)
694
+ for (size_t i = 0 ; i < texel_count; i++)
695
695
{
696
696
unsigned int iwt = texel_indexes[i];
697
697
vfloat4 texel_datum = vfloat2 (data_vr[iwt], data_vg[iwt]);
@@ -729,20 +729,20 @@ void compute_error_squared_rgba(
729
729
float & uncor_error,
730
730
float & samec_error
731
731
) {
732
- unsigned int partition_count = pi.partition_count ;
732
+ size_t partition_count = pi.partition_count ;
733
733
promise (partition_count > 0 );
734
734
735
735
vfloatacc uncor_errorsumv = vfloatacc::zero ();
736
736
vfloatacc samec_errorsumv = vfloatacc::zero ();
737
737
738
- for (unsigned int partition = 0 ; partition < partition_count; partition++)
738
+ for (size_t partition = 0 ; partition < partition_count; partition++)
739
739
{
740
740
const uint8_t *texel_indexes = pi.texels_of_partition [partition];
741
741
742
742
processed_line4 l_uncor = uncor_plines[partition];
743
743
processed_line4 l_samec = samec_plines[partition];
744
744
745
- unsigned int texel_count = pi.partition_texel_count [partition];
745
+ size_t texel_count = pi.partition_texel_count [partition];
746
746
promise (texel_count > 0 );
747
747
748
748
// Vectorize some useful scalar inputs
@@ -775,7 +775,7 @@ void compute_error_squared_rgba(
775
775
// array to extend the last value. This means min/max are not impacted, but we need to mask
776
776
// out the dummy values when we compute the line weighting.
777
777
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)
779
779
{
780
780
vmask mask = lane_ids < vint (texel_count);
781
781
const uint8_t * texel_idxs = texel_indexes + i;
@@ -847,17 +847,17 @@ void compute_error_squared_rgb(
847
847
float & uncor_error,
848
848
float & samec_error
849
849
) {
850
- unsigned int partition_count = pi.partition_count ;
850
+ size_t partition_count = pi.partition_count ;
851
851
promise (partition_count > 0 );
852
852
853
853
vfloatacc uncor_errorsumv = vfloatacc::zero ();
854
854
vfloatacc samec_errorsumv = vfloatacc::zero ();
855
855
856
- for (unsigned int partition = 0 ; partition < partition_count; partition++)
856
+ for (size_t partition = 0 ; partition < partition_count; partition++)
857
857
{
858
858
partition_lines3& pl = plines[partition];
859
859
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];
861
861
promise (texel_count > 0 );
862
862
863
863
processed_line3 l_uncor = pl.uncor_pline ;
@@ -889,7 +889,7 @@ void compute_error_squared_rgb(
889
889
// to extend the last value. This means min/max are not impacted, but we need to mask
890
890
// out the dummy values when we compute the line weighting.
891
891
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)
893
893
{
894
894
vmask mask = lane_ids < vint (texel_count);
895
895
const uint8_t * texel_idxs = texel_indexes + i;
0 commit comments