Skip to content

Commit 5bb4f6f

Browse files
committed
replace unsigned int with size_t
1 parent b5b87ef commit 5bb4f6f

34 files changed

+1118
-1115
lines changed

Source/astcenc.h

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ extern "C" typedef void (*astcenc_progress_callback)(float);
317317
* be e.g. rrrg (the default ordering for ASTC normals on the command line) or gggr (the ordering
318318
* used by BC5n).
319319
*/
320-
static const unsigned int ASTCENC_FLG_MAP_NORMAL = 1 << 0;
320+
static const size_t ASTCENC_FLG_MAP_NORMAL = 1 << 0;
321321

322322
/**
323323
* @brief Enable compression heuristics that assume use of decode_unorm8 decode mode.
@@ -330,7 +330,7 @@ static const unsigned int ASTCENC_FLG_MAP_NORMAL = 1 << 0;
330330
* Note that LDR_SRGB images will always use decode_unorm8 for the RGB channels, irrespective of
331331
* this setting.
332332
*/
333-
static const unsigned int ASTCENC_FLG_USE_DECODE_UNORM8 = 1 << 1;
333+
static const size_t ASTCENC_FLG_USE_DECODE_UNORM8 = 1 << 1;
334334

335335
/**
336336
* @brief Enable alpha weighting.
@@ -339,23 +339,23 @@ static const unsigned int ASTCENC_FLG_USE_DECODE_UNORM8 = 1 << 1;
339339
* the transparency level. This allows the codec to more accurately encode the alpha value in areas
340340
* where the color value is less significant.
341341
*/
342-
static const unsigned int ASTCENC_FLG_USE_ALPHA_WEIGHT = 1 << 2;
342+
static const size_t ASTCENC_FLG_USE_ALPHA_WEIGHT = 1 << 2;
343343

344344
/**
345345
* @brief Enable perceptual error metrics.
346346
*
347347
* This mode enables perceptual compression mode, which will optimize for perceptual error rather
348348
* than best PSNR. Only some input modes support perceptual error metrics.
349349
*/
350-
static const unsigned int ASTCENC_FLG_USE_PERCEPTUAL = 1 << 3;
350+
static const size_t ASTCENC_FLG_USE_PERCEPTUAL = 1 << 3;
351351

352352
/**
353353
* @brief Create a decompression-only context.
354354
*
355355
* This mode disables support for compression. This enables context allocation to skip some
356356
* transient buffer allocation, resulting in lower memory usage.
357357
*/
358-
static const unsigned int ASTCENC_FLG_DECOMPRESS_ONLY = 1 << 4;
358+
static const size_t ASTCENC_FLG_DECOMPRESS_ONLY = 1 << 4;
359359

360360
/**
361361
* @brief Create a self-decompression context.
@@ -365,7 +365,7 @@ static const unsigned int ASTCENC_FLG_DECOMPRESS_ONLY = 1 << 4;
365365
* cases, and setting this flag enables additional optimizations, but does mean that the context
366366
* cannot reliably decompress arbitrary ASTC images.
367367
*/
368-
static const unsigned int ASTCENC_FLG_SELF_DECOMPRESS_ONLY = 1 << 5;
368+
static const size_t ASTCENC_FLG_SELF_DECOMPRESS_ONLY = 1 << 5;
369369

370370
/**
371371
* @brief Enable RGBM map compression.
@@ -388,12 +388,12 @@ static const unsigned int ASTCENC_FLG_SELF_DECOMPRESS_ONLY = 1 << 5;
388388
* scale, ensuring that the M value is accurately encoded. This defaults to 10 when in RGBM mode,
389389
* matching the default scale factor.
390390
*/
391-
static const unsigned int ASTCENC_FLG_MAP_RGBM = 1 << 6;
391+
static const size_t ASTCENC_FLG_MAP_RGBM = 1 << 6;
392392

393393
/**
394394
* @brief The bit mask of all valid flags.
395395
*/
396-
static const unsigned int ASTCENC_ALL_FLAGS =
396+
static const size_t ASTCENC_ALL_FLAGS =
397397
ASTCENC_FLG_MAP_NORMAL |
398398
ASTCENC_FLG_MAP_RGBM |
399399
ASTCENC_FLG_USE_ALPHA_WEIGHT |
@@ -418,16 +418,16 @@ struct astcenc_config
418418
astcenc_profile profile;
419419

420420
/** @brief The set of set flags. */
421-
unsigned int flags;
421+
size_t flags;
422422

423423
/** @brief The ASTC block size X dimension. */
424-
unsigned int block_x;
424+
size_t block_x;
425425

426426
/** @brief The ASTC block size Y dimension. */
427-
unsigned int block_y;
427+
size_t block_y;
428428

429429
/** @brief The ASTC block size Z dimension. */
430-
unsigned int block_z;
430+
size_t block_z;
431431

432432
/** @brief The red component weight scale for error weighting (-cw). */
433433
float cw_r_weight;
@@ -448,7 +448,7 @@ struct astcenc_config
448448
* will be sampled using linear texture filtering to minimize color bleed out of transparent
449449
* texels that are adjacent to non-transparent texels.
450450
*/
451-
unsigned int a_scale_radius;
451+
size_t a_scale_radius;
452452

453453
/** @brief The RGBM scale factor for the shared multiplier (-rgbm). */
454454
float rgbm_m_scale;
@@ -458,71 +458,71 @@ struct astcenc_config
458458
*
459459
* Valid values are between 1 and 4.
460460
*/
461-
unsigned int tune_partition_count_limit;
461+
size_t tune_partition_count_limit;
462462

463463
/**
464464
* @brief The maximum number of partitions searched (-2partitionindexlimit).
465465
*
466466
* Valid values are between 1 and 1024.
467467
*/
468-
unsigned int tune_2partition_index_limit;
468+
size_t tune_2partition_index_limit;
469469

470470
/**
471471
* @brief The maximum number of partitions searched (-3partitionindexlimit).
472472
*
473473
* Valid values are between 1 and 1024.
474474
*/
475-
unsigned int tune_3partition_index_limit;
475+
size_t tune_3partition_index_limit;
476476

477477
/**
478478
* @brief The maximum number of partitions searched (-4partitionindexlimit).
479479
*
480480
* Valid values are between 1 and 1024.
481481
*/
482-
unsigned int tune_4partition_index_limit;
482+
size_t tune_4partition_index_limit;
483483

484484
/**
485485
* @brief The maximum centile for block modes searched (-blockmodelimit).
486486
*
487487
* Valid values are between 1 and 100.
488488
*/
489-
unsigned int tune_block_mode_limit;
489+
size_t tune_block_mode_limit;
490490

491491
/**
492492
* @brief The maximum iterative refinements applied (-refinementlimit).
493493
*
494494
* Valid values are between 1 and N; there is no technical upper limit
495495
* but little benefit is expected after N=4.
496496
*/
497-
unsigned int tune_refinement_limit;
497+
size_t tune_refinement_limit;
498498

499499
/**
500500
* @brief The number of trial candidates per mode search (-candidatelimit).
501501
*
502502
* Valid values are between 1 and TUNE_MAX_TRIAL_CANDIDATES.
503503
*/
504-
unsigned int tune_candidate_limit;
504+
size_t tune_candidate_limit;
505505

506506
/**
507507
* @brief The number of trial partitionings per search (-2partitioncandidatelimit).
508508
*
509509
* Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.
510510
*/
511-
unsigned int tune_2partitioning_candidate_limit;
511+
size_t tune_2partitioning_candidate_limit;
512512

513513
/**
514514
* @brief The number of trial partitionings per search (-3partitioncandidatelimit).
515515
*
516516
* Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.
517517
*/
518-
unsigned int tune_3partitioning_candidate_limit;
518+
size_t tune_3partitioning_candidate_limit;
519519

520520
/**
521521
* @brief The number of trial partitionings per search (-4partitioncandidatelimit).
522522
*
523523
* Valid values are between 1 and TUNE_MAX_PARTITIONING_CANDIDATES.
524524
*/
525-
unsigned int tune_4partitioning_candidate_limit;
525+
size_t tune_4partitioning_candidate_limit;
526526

527527
/**
528528
* @brief The dB threshold for stopping block search (-dblimit).
@@ -601,13 +601,13 @@ struct astcenc_config
601601
struct astcenc_image
602602
{
603603
/** @brief The X dimension of the image, in texels. */
604-
unsigned int dim_x;
604+
size_t dim_x;
605605

606606
/** @brief The Y dimension of the image, in texels. */
607-
unsigned int dim_y;
607+
size_t dim_y;
608608

609609
/** @brief The Z dimension of the image, in texels. */
610-
unsigned int dim_z;
610+
size_t dim_z;
611611

612612
/** @brief The data type per component. */
613613
astcenc_type data_type;
@@ -628,16 +628,16 @@ struct astcenc_block_info
628628
astcenc_profile profile;
629629

630630
/** @brief The number of texels in the X dimension. */
631-
unsigned int block_x;
631+
size_t block_x;
632632

633633
/** @brief The number of texels in the Y dimension. */
634-
unsigned int block_y;
634+
size_t block_y;
635635

636636
/** @brief The number of texel in the Z dimension. */
637-
unsigned int block_z;
637+
size_t block_z;
638638

639639
/** @brief The number of texels in the block. */
640-
unsigned int texel_count;
640+
size_t texel_count;
641641

642642
/** @brief True if this block is an error block. */
643643
bool is_error_block;
@@ -652,31 +652,31 @@ struct astcenc_block_info
652652
bool is_dual_plane_block;
653653

654654
/** @brief The number of partitions if not constant color. */
655-
unsigned int partition_count;
655+
size_t partition_count;
656656

657657
/** @brief The partition index if 2 - 4 partitions used. */
658-
unsigned int partition_index;
658+
size_t partition_index;
659659

660660
/** @brief The component index of the second plane if dual plane. */
661-
unsigned int dual_plane_component;
661+
size_t dual_plane_component;
662662

663663
/** @brief The color endpoint encoding mode for each partition. */
664-
unsigned int color_endpoint_modes[4];
664+
size_t color_endpoint_modes[4];
665665

666666
/** @brief The number of color endpoint quantization levels. */
667-
unsigned int color_level_count;
667+
size_t color_level_count;
668668

669669
/** @brief The number of weight quantization levels. */
670-
unsigned int weight_level_count;
670+
size_t weight_level_count;
671671

672672
/** @brief The number of weights in the X dimension. */
673-
unsigned int weight_x;
673+
size_t weight_x;
674674

675675
/** @brief The number of weights in the Y dimension. */
676-
unsigned int weight_y;
676+
size_t weight_y;
677677

678678
/** @brief The number of weights in the Z dimension. */
679-
unsigned int weight_z;
679+
size_t weight_z;
680680

681681
/** @brief The unpacked color endpoints for each partition. */
682682
float color_endpoints[4][2][4];
@@ -712,11 +712,11 @@ struct astcenc_block_info
712712
*/
713713
ASTCENC_PUBLIC astcenc_error astcenc_config_init(
714714
astcenc_profile profile,
715-
unsigned int block_x,
716-
unsigned int block_y,
717-
unsigned int block_z,
715+
size_t block_x,
716+
size_t block_y,
717+
size_t block_z,
718718
float quality,
719-
unsigned int flags,
719+
size_t flags,
720720
astcenc_config* config);
721721

722722
/**
@@ -739,7 +739,7 @@ ASTCENC_PUBLIC astcenc_error astcenc_config_init(
739739
*/
740740
ASTCENC_PUBLIC astcenc_error astcenc_context_alloc(
741741
const astcenc_config* config,
742-
unsigned int thread_count,
742+
size_t thread_count,
743743
astcenc_context** context);
744744

745745
/**
@@ -766,7 +766,7 @@ ASTCENC_PUBLIC astcenc_error astcenc_compress_image(
766766
const astcenc_swizzle* swizzle,
767767
uint8_t* data_out,
768768
size_t data_len,
769-
unsigned int thread_index);
769+
size_t thread_index);
770770

771771
/**
772772
* @brief Reset the codec state for a new compression.
@@ -816,7 +816,7 @@ ASTCENC_PUBLIC astcenc_error astcenc_decompress_image(
816816
size_t data_len,
817817
astcenc_image* image_out,
818818
const astcenc_swizzle* swizzle,
819-
unsigned int thread_index);
819+
size_t thread_index);
820820

821821
/**
822822
* @brief Reset the codec state for a new decompression.

0 commit comments

Comments
 (0)