Skip to content

Commit 961935d

Browse files
committed
Changing C compression API for XUAST LDR: if unified quality level is not being used, and the lower level uastc_rdo_or_dct_quality parameter was set to 100, we would previously return an error. Now DCT is not enabled, as expected.
1 parent c4d7061 commit 961935d

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

encoder/basisu_comp.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5096,15 +5096,17 @@ namespace basisu
50965096
// Valid XUASTC LDR weight grid DCT quality levels are 1-100.
50975097
if (basist::basis_tex_format_is_xuastc_ldr(mode) && (uastc_rdo_or_dct_quality != 0.0f))
50985098
{
5099-
// TODO: change this so 100=no DCT to simplify the non-unified API, right now they must set 0=no DCT
5100-
if ((uastc_rdo_or_dct_quality >= (float)BASISU_XUASTC_QUALITY_MIN) && (uastc_rdo_or_dct_quality < (float)BASISU_XUASTC_QUALITY_MAX))
5099+
if ((uastc_rdo_or_dct_quality >= (float)BASISU_XUASTC_QUALITY_MIN) && (uastc_rdo_or_dct_quality <= (float)BASISU_XUASTC_QUALITY_MAX))
51015100
{
5102-
// Enable weight grid DCT usage, set quality level.
5103-
comp_params.m_xuastc_ldr_use_dct = true;
5104-
comp_params.m_quality_level = (int)uastc_rdo_or_dct_quality;
5105-
5106-
// Also enable bounded lossy distortion mode in the normally lossless supercompressor for extra savings.
5107-
comp_params.m_xuastc_ldr_use_lossy_supercompression = true;
5101+
if (uastc_rdo_or_dct_quality < (float)BASISU_XUASTC_QUALITY_MAX)
5102+
{
5103+
// Enable weight grid DCT usage, set quality level.
5104+
comp_params.m_xuastc_ldr_use_dct = true;
5105+
comp_params.m_quality_level = (int)uastc_rdo_or_dct_quality;
5106+
5107+
// Also enable bounded lossy distortion mode in the normally lossless supercompressor for extra savings.
5108+
comp_params.m_xuastc_ldr_use_lossy_supercompression = true;
5109+
}
51085110
}
51095111
else
51105112
{

0 commit comments

Comments
 (0)