Skip to content

Commit

Permalink
Modifying UASTC HDR DFD
Browse files Browse the repository at this point in the history
  • Loading branch information
richgel999 committed Sep 11, 2024
1 parent d25a43b commit 1d56bfd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
8 changes: 5 additions & 3 deletions basisu_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1508,11 +1508,13 @@ static bool unpack_and_validate_ktx2_file(
printf("DFD hex values:\n");
for (uint32_t i = 0; i < dec.get_dfd().size(); i++)
{
if (i)
printf(",");
printf("0x%X", dec.get_dfd()[i]);
if ((i + 1) != dec.get_dfd().size())
printf(",");
if ((i & 3) == 3)
printf("\n");
}
printf("\n\n");
printf("\n");


printf("Total key values: %u\n", dec.get_key_values().size());
Expand Down
17 changes: 11 additions & 6 deletions encoder/basisu_comp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2970,12 +2970,17 @@ namespace basisu
// HDR TODO - what is the best Khronos DFD to use for UASTC HDR?
static uint8_t g_ktx2_uastc_hdr_nonalpha_dfd[44] =
{
0x2C,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
0x2,0x0,0x28,0x0, 0xA7,0x1,0x1,0x0,
0x3,0x3,0x0,0x0, 0x10,0x0,0x0,0x0,
0x0,0x0,0x0,0x0, 0x0,0x0,0x7F,0x4,
0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,
0xFF,0xFF,0xFF,0xFF
0x2C,0x0,0x0,0x0, // 0 totalSize
0x0,0x0,0x0,0x0, // 1 descriptorType/vendorId
0x2,0x0,0x28,0x0, // 2 descriptorBlockSize/versionNumber
0xA7,0x1,0x1,0x0, // 3 flags, transferFunction, colorPrimaries, colorModel
0x3,0x3,0x0,0x0, // 4 texelBlockDimension0-texelBlockDimension3
0x10,0x0,0x0,0x0, // 5 bytesPlane0-bytesPlane3
0x0,0x0,0x0,0x0, // 6 bytesPlane4-bytesPlane7
0x0,0x0,0x7F,0x80, // 7 bitLength/bitOffset/channelType and Qualifer flags (KHR_DF_SAMPLE_DATATYPE_FLOAT etc.)
0x0,0x0,0x0,0x0, // 8 samplePosition0-samplePosition3
0x0,0x0,0x0,0x0, // 9 sampleLower (0.0)
0x00, 0x00, 0x80, 0xF3 // 10 sampleHigher (?)
};

void basis_compressor::get_dfd(uint8_vec &dfd, const basist::ktx2_header &header)
Expand Down

0 comments on commit 1d56bfd

Please sign in to comment.