Skip to content

Commit 3b2785d

Browse files
committed
Standardize on "component" not "channel"
1 parent 61644ae commit 3b2785d

19 files changed

Lines changed: 240 additions & 241 deletions

Source/astcenc.h

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
* Images can be any dimension; there is no requirement for them to be a
8484
* multiple of the ASTC block size.
8585
*
86-
* Data is always passed in as 4 color channels, and accessed as an array of
86+
* Data is always passed in as 4 color components, and accessed as an array of
8787
* 2D image slices. Data within an image slice is always tightly packed without
8888
* padding. Addresing looks like this:
8989
*
@@ -96,26 +96,27 @@
9696
* =======================
9797
*
9898
* One of the most important things for coding image quality is to align the
99-
* input data channel count with the ASTC color endpoint mode. This avoids
100-
* wasting bits encoding channels you don't need in the endpoint colors.
99+
* input data component count with the ASTC color endpoint mode. This avoids
100+
* wasting bits encoding components you don't need in the endpoint colors.
101101
*
102-
* | Input data | Encoding swizzle | Sampling swizzle |
103-
* | ---------- | ---------------- | ---------------- |
104-
* | 1 channel | RRR1 | .g |
105-
* | 2 channels | RRRG | .ga |
106-
* | 3 channels | RGB1 | .rgb |
107-
* | 4 channels | RGBA | .rgba |
102+
* | Input data | Encoding swizzle | Sampling swizzle |
103+
* | ------------ | ---------------- | ---------------- |
104+
* | 1 component | RRR1 | .g |
105+
* | 2 components | RRRG | .ga |
106+
* | 3 components | RGB1 | .rgb |
107+
* | 4 components | RGBA | .rgba |
108108
*
109-
* The 1 and 2 channel modes recommend sampling from "g" to recover the
109+
* The 1 and 2 component modes recommend sampling from "g" to recover the
110110
* luminance value as this provide best compatibility with ETC1. For ETC the
111-
* luminance data will be stored as RGB565 where the green channel has the
112-
* best quality. For ASTC any of the rgb channels can be used - the same data
111+
* luminance data will be stored as RGB565 where the green component has the
112+
* best quality. For ASTC any of the RGB components can be used - the same data
113113
* will be returned for all three.
114114
*
115115
* When using the normal map compression mode ASTC will store normals as a two
116-
* channel X+Y map. Input images must contain unit-length normalized and should
117-
* be passed in using the RRRG swizzle. The Z component can be programatically
118-
* recovered in shader code, using knowledge that the vector is unit length.
116+
* component X+Y map. Input images must contain unit-length normalized and
117+
* should be passed in using the RRRG swizzle. The Z component can be recovered
118+
* programatically in shader code, using knowledge that the vector is unit
119+
* length.
119120
*
120121
* Decompress-only usage
121122
* =====================
@@ -183,7 +184,7 @@ enum astcenc_error {
183184
ASTCENC_ERR_BAD_PROFILE,
184185
/** @brief The call failed due to an out-of-spec quality value. */
185186
ASTCENC_ERR_BAD_QUALITY,
186-
/** @brief The call failed due to an out-of-spec channel swizzle. */
187+
/** @brief The call failed due to an out-of-spec component swizzle. */
187188
ASTCENC_ERR_BAD_SWIZZLE,
188189
/** @brief The call failed due to an out-of-spec flag set. */
189190
ASTCENC_ERR_BAD_FLAGS,
@@ -227,55 +228,55 @@ static const float ASTCENC_PRE_THOROUGH = 98.0f;
227228
static const float ASTCENC_PRE_EXHAUSTIVE = 100.0f;
228229

229230
/**
230-
* @brief A codec channel swizzle selector.
231+
* @brief A codec component swizzle selector.
231232
*/
232233
enum astcenc_swz {
233-
/** @brief Select the red channel. */
234+
/** @brief Select the red component. */
234235
ASTCENC_SWZ_R = 0,
235-
/** @brief Select the green channel. */
236+
/** @brief Select the green component. */
236237
ASTCENC_SWZ_G = 1,
237-
/** @brief Select the blue channel. */
238+
/** @brief Select the blue component. */
238239
ASTCENC_SWZ_B = 2,
239-
/** @brief Select the alpha channel. */
240+
/** @brief Select the alpha component. */
240241
ASTCENC_SWZ_A = 3,
241-
/** @brief Use a constant zero channel. */
242+
/** @brief Use a constant zero component. */
242243
ASTCENC_SWZ_0 = 4,
243-
/** @brief Use a constant one channel. */
244+
/** @brief Use a constant one component. */
244245
ASTCENC_SWZ_1 = 5,
245-
/** @brief Use a reconstructed normal vector Z channel. */
246+
/** @brief Use a reconstructed normal vector Z component. */
246247
ASTCENC_SWZ_Z = 6
247248
};
248249

249250
/**
250-
* @brief A texel channel swizzle.
251+
* @brief A texel component swizzle.
251252
*/
252253
struct astcenc_swizzle {
253-
/** @brief The red channel selector. */
254+
/** @brief The red component selector. */
254255
astcenc_swz r;
255-
/** @brief The green channel selector. */
256+
/** @brief The green component selector. */
256257
astcenc_swz g;
257-
/** @brief The blue channel selector. */
258+
/** @brief The blue component selector. */
258259
astcenc_swz b;
259-
/** @brief The alpha channel selector. */
260+
/** @brief The alpha component selector. */
260261
astcenc_swz a;
261262
};
262263

263264
/**
264-
* @brief A texel channel data format.
265+
* @brief A texel component data format.
265266
*/
266267
enum astcenc_type {
267-
/** @brief Unorm 8-bit data per channel. */
268+
/** @brief Unorm 8-bit data per component. */
268269
ASTCENC_TYPE_U8 = 0,
269-
/** @brief 16-bit float per channel. */
270+
/** @brief 16-bit float per component. */
270271
ASTCENC_TYPE_F16 = 1,
271-
/** @brief 32-bit float per channel. */
272+
/** @brief 32-bit float per component. */
272273
ASTCENC_TYPE_F32 = 2
273274
};
274275

275276
/**
276277
* @brief Enable normal map compression.
277278
*
278-
* Input data will be treated a two channel normal map, storing X and Y, and
279+
* Input data will be treated a two component normal map, storing X and Y, and
279280
* the codec will optimize for angular error rather than simple linear PSNR.
280281
* In this mode the input swizzle should be e.g. rrrg (the default ordering for
281282
* ASTC normals on the command line) or gggr (the ordering used by BC5).
@@ -286,7 +287,7 @@ static const unsigned int ASTCENC_FLG_MAP_NORMAL = 1 << 0;
286287
* @brief Enable mask map compression.
287288
*
288289
* Input data will be treated a multi-layer mask map, where is is desirable for
289-
* the color channels to be treated independently for the purposes of error
290+
* the color components to be treated independently for the purposes of error
290291
* analysis.
291292
*/
292293
static const unsigned int ASTCENC_FLG_MAP_MASK = 1 << 1;
@@ -320,7 +321,7 @@ static const unsigned int ASTCENC_FLG_MAP_RGBM = 1 << 6;
320321
* @brief Enable alpha weighting.
321322
*
322323
* The input alpha value is used for transparency, so errors in the RGB
323-
* channels are weighted by the transparency level. This allows the codec to
324+
* components are weighted by the transparency level. This allows the codec to
324325
* more accurately encode the alpha value in areas where the color value
325326
* is less significant.
326327
*/
@@ -374,8 +375,8 @@ static const unsigned int ASTCENC_ALL_FLAGS =
374375
* astcenccli_toplevel_help.cpp for full user documentation of the power-user
375376
* settings.
376377
*
377-
* Note for any settings which are associated with a specific color channel,
378-
* the value in the config applies to the channel that exists after any
378+
* Note for any settings which are associated with a specific color component,
379+
* the value in the config applies to the component that exists after any
379380
* compression data swizzle is applied.
380381
*/
381382
struct astcenc_config
@@ -398,7 +399,7 @@ struct astcenc_config
398399
/** @brief The size of the texel kernel for error weighting (-v). */
399400
unsigned int v_rgba_radius;
400401

401-
/** @brief The mean and stdev channel mix for error weighting (-v). */
402+
/** @brief The mean and stdev component mix for error weighting (-v). */
402403
float v_rgba_mean_stdev_mix;
403404

404405
/** @brief The texel RGB power for error weighting (-v). */
@@ -425,16 +426,16 @@ struct astcenc_config
425426
/** @brief The texel A stdev for error weighting (-va). */
426427
float v_a_stdev;
427428

428-
/** @brief The red channel weight scale for error weighting (-cw). */
429+
/** @brief The red component weight scale for error weighting (-cw). */
429430
float cw_r_weight;
430431

431-
/** @brief The green channel weight scale for error weighting (-cw). */
432+
/** @brief The green component weight scale for error weighting (-cw). */
432433
float cw_g_weight;
433434

434-
/** @brief The blue channel weight scale for error weighting (-cw). */
435+
/** @brief The blue component weight scale for error weighting (-cw). */
435436
float cw_b_weight;
436437

437-
/** @brief The alpha channel weight scale for error weighting (-cw). */
438+
/** @brief The alpha component weight scale for error weighting (-cw). */
438439
float cw_a_weight;
439440

440441
/**
@@ -566,7 +567,7 @@ struct astcenc_image
566567
/** @brief The Z dimension of the image, in texels. */
567568
unsigned int dim_z;
568569

569-
/** @brief The data type per channel. */
570+
/** @brief The data type per component. */
570571
astcenc_type data_type;
571572

572573
/** @brief The array of 2D slices, of length @c dim_z. */

Source/astcenc_compress_symbolic.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static int realign_weights(
6969
int weight_count = dt->weight_count;
7070

7171
int max_plane = bm.is_dual_plane;
72-
int plane2_component = bm.is_dual_plane ? scb->plane2_color_component : -1;
72+
int plane2_component = bm.is_dual_plane ? scb->plane2_component : -1;
7373
vmask4 plane_mask = vint4::lane_id() == vint4(plane2_component);
7474

7575
// Decode the color endpoints
@@ -105,7 +105,7 @@ static int realign_weights(
105105
{
106106
for (int pa_idx = 0; pa_idx < partition_count; pa_idx++)
107107
{
108-
// Compute the endpoint delta for all channels in current plane
108+
// Compute the endpoint delta for all components in current plane
109109
vint4 epd = endpnt1[pa_idx] - endpnt0[pa_idx];
110110
epd = select(epd, vint4::zero(), plane_mask);
111111

@@ -863,7 +863,7 @@ static float compress_symbolic_block_fixed_partition_2_planes(
863863
workscb.partition_index = partition_index;
864864
workscb.color_quant_level = workscb.color_formats_matched ? color_quant_level_mod[i] : color_quant_level[i];
865865
workscb.block_mode = qw_bm.mode_index;
866-
workscb.plane2_color_component = separate_component;
866+
workscb.plane2_component = separate_component;
867867
workscb.error_block = 0;
868868

869869
if (workscb.color_quant_level < 4)
@@ -1432,7 +1432,7 @@ void compress_block(
14321432
TRACE_NODE(node1, "pass");
14331433
trace_add_data("partition_count", 1);
14341434
trace_add_data("plane_count", 2);
1435-
trace_add_data("plane_channel", i);
1435+
trace_add_data("plane_component", i);
14361436

14371437
if (block_skip_two_plane)
14381438
{
@@ -1448,7 +1448,7 @@ void compress_block(
14481448

14491449
if (!uses_alpha && i == 3)
14501450
{
1451-
trace_add_data("skip", "no alpha channel");
1451+
trace_add_data("skip", "no alpha component");
14521452
continue;
14531453
}
14541454

@@ -1539,7 +1539,7 @@ void compress_block(
15391539
trace_add_data("partition_count", partition_count);
15401540
trace_add_data("partition_index", partition_index_2planes & (PARTITION_COUNT - 1));
15411541
trace_add_data("plane_count", 2);
1542-
trace_add_data("plane_channel", partition_index_2planes >> PARTITION_BITS);
1542+
trace_add_data("plane_component", partition_index_2planes >> PARTITION_BITS);
15431543

15441544
float errorval = compress_symbolic_block_fixed_partition_2_planes(
15451545
ctx.config,

Source/astcenc_compute_variance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#if !defined(ASTCENC_DECOMPRESS_ONLY)
1919

2020
/**
21-
* @brief Functions to calculate variance per channel in a NxN footprint.
21+
* @brief Functions to calculate variance per component in a NxN footprint.
2222
*
2323
* We need N to be parametric, so the routine below uses summed area tables in
2424
* order to execute in O(1) time independent of how big N is.

Source/astcenc_decompress_symbolic.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static inline vfloat4 decode_texel(
8585
color_unorm = unorm16_to_sf16(data);
8686
}
8787

88-
// Pick channels and then covert to FP16
88+
// Pick components and then covert to FP16
8989
vint4 datai = select(color_unorm, color_lns, lns_mask);
9090
return float16_to_float(datai);
9191
}
@@ -284,8 +284,8 @@ void decompress_symbolic_block(
284284
unpack_weights(*bsd, *scb, *dt, is_dual_plane, weight_quant_level, weights, plane2_weights);
285285

286286
// Now that we have endpoint colors and weights, we can unpack texel colors
287-
int plane2_color_component = is_dual_plane ? scb->plane2_color_component : -1;
288-
vmask4 plane2_mask = vint4::lane_id() == vint4(plane2_color_component);
287+
int plane2_component = is_dual_plane ? scb->plane2_component : -1;
288+
vmask4 plane2_mask = vint4::lane_id() == vint4(plane2_component);
289289

290290
for (int i = 0; i < partition_count; i++)
291291
{
@@ -384,8 +384,8 @@ float compute_symbolic_block_difference(
384384
unpack_weights(*bsd, *scb, *dt, is_dual_plane, weight_quant_level, weights, plane2_weights);
385385

386386
// Now that we have endpoint colors and weights, we can unpack texel colors
387-
int plane2_color_component = is_dual_plane ? scb->plane2_color_component : -1;
388-
vmask4 plane2_mask = vint4::lane_id() == vint4(plane2_color_component);
387+
int plane2_component = is_dual_plane ? scb->plane2_component : -1;
388+
vmask4 plane2_mask = vint4::lane_id() == vint4(plane2_component);
389389

390390
float summa = 0.0f;
391391
for (int i = 0; i < texel_count; i++)

Source/astcenc_diagnostic_trace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
* - candidate
3030
*
3131
* One block node exists for each compressed block in the image. One pass node
32-
* exists for each major pass (N partition, M planes, O channel) applied to a
33-
* block. One candidate node exists for each encoding candidate trialed for a
32+
* exists for each major pass (N partition, M planes, O components) applied to
33+
* a block. One candidate node exists for each encoding candidate trialed for a
3434
* pass.
3535
*
3636
* Each node contains both the hierarchy but also a number of attributes which

Source/astcenc_encoding_choice_error.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* Encoding choice errors are caused by encoder decisions, such as:
2828
* - using luminance rather than RGB.
2929
* - using RGB+scale instead of two full RGB endpoints.
30-
* - dropping the alpha channel.
30+
* - dropping the alpha component.
3131
*
3232
* Quantization errors occur due to the limited precision we use for storage.
3333
* These errors generally scale with quantization level, but are not actually

Source/astcenc_entry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ astcenc_error astcenc_get_block_info(
10741074

10751075
info->partition_count = scb.partition_count;
10761076
info->partition_index = scb.partition_index;
1077-
info->dual_plane_component = scb.plane2_color_component;
1077+
info->dual_plane_component = scb.plane2_component;
10781078

10791079
info->color_level_count = get_quant_method_levels((quant_method)scb.color_quant_level);
10801080
info->weight_level_count = get_quant_method_levels((quant_method)bm.quant_mode);

Source/astcenc_find_best_partitioning.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ void find_best_partitionings(
186186
break;
187187
}
188188

189-
// Compute weighting to give to each channel in each partition
189+
// Compute weighting to give to each component in each partition
190190
partition_metrics pms[4];
191191

192192
compute_partition_error_color_weightings_and_range(*blk, *ewb, *(ptab + partition), pms);
@@ -392,7 +392,7 @@ void find_best_partitionings(
392392
break;
393393
}
394394

395-
// Compute weighting to give to each channel in each partition
395+
// Compute weighting to give to each component in each partition
396396
partition_metrics pms[4];
397397

398398
compute_partition_error_color_weightings_and_range(*blk, *ewb, *(ptab + partition), pms);

0 commit comments

Comments
 (0)