Skip to content

Commit

Permalink
Set higher error targets for L+A data
Browse files Browse the repository at this point in the history
  • Loading branch information
solidpixel committed Jan 30, 2021
1 parent 91a1aa8 commit 18b9b15
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Source/astcenc_compress_symbolic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,13 +1377,19 @@ void compress_block(
bool block_is_l = imageblock_is_lum(blk);
float block_is_l_scale = block_is_l ? 1.0f / 1.5f : 1.0f;

// Set slightly stricter block targets for lumalpha data as we have more
// bits to play with - fewer endpoints but may use a second weight plane
bool block_is_la = imageblock_is_lumalp(blk);
float block_is_la_scale = block_is_la ? 1.0f / 1.05f : 1.0f;

#if defined(ASTCENC_DIAGNOSTICS)
// Do this early in diagnostic builds so we can dump uniform metrics
// for every block. Do it later in release builds to avoid redundant work!
float error_weight_sum = prepare_error_weight_block(ctx, input_image, bsd, blk, ewb);
float error_threshold = ctx.config.tune_db_limit
* error_weight_sum
* block_is_l_scale;
* block_is_l_scale
* block_is_la_scale;

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

Expand Down Expand Up @@ -1442,7 +1448,8 @@ void compress_block(
float error_weight_sum = prepare_error_weight_block(ctx, input_image, bsd, blk, ewb);
float error_threshold = ctx.config.tune_db_limit
* error_weight_sum
* block_is_l_scale;
* block_is_l_scale
* block_is_la_scale;
#endif

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

0 comments on commit 18b9b15

Please sign in to comment.