Skip to content

Commit 18b9b15

Browse files
committed
Set higher error targets for L+A data
1 parent 91a1aa8 commit 18b9b15

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Source/astcenc_compress_symbolic.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,13 +1377,19 @@ void compress_block(
13771377
bool block_is_l = imageblock_is_lum(blk);
13781378
float block_is_l_scale = block_is_l ? 1.0f / 1.5f : 1.0f;
13791379

1380+
// Set slightly stricter block targets for lumalpha data as we have more
1381+
// bits to play with - fewer endpoints but may use a second weight plane
1382+
bool block_is_la = imageblock_is_lumalp(blk);
1383+
float block_is_la_scale = block_is_la ? 1.0f / 1.05f : 1.0f;
1384+
13801385
#if defined(ASTCENC_DIAGNOSTICS)
13811386
// Do this early in diagnostic builds so we can dump uniform metrics
13821387
// for every block. Do it later in release builds to avoid redundant work!
13831388
float error_weight_sum = prepare_error_weight_block(ctx, input_image, bsd, blk, ewb);
13841389
float error_threshold = ctx.config.tune_db_limit
13851390
* error_weight_sum
1386-
* block_is_l_scale;
1391+
* block_is_l_scale
1392+
* block_is_la_scale;
13871393

13881394
lowest_correl = prepare_block_statistics(bsd->texel_count, blk, ewb);
13891395

@@ -1442,7 +1448,8 @@ void compress_block(
14421448
float error_weight_sum = prepare_error_weight_block(ctx, input_image, bsd, blk, ewb);
14431449
float error_threshold = ctx.config.tune_db_limit
14441450
* error_weight_sum
1445-
* block_is_l_scale;
1451+
* block_is_l_scale
1452+
* block_is_la_scale;
14461453
#endif
14471454

14481455
// Set SCB and mode errors to a very high error value

0 commit comments

Comments
 (0)