![]() |
libktx Reference 5.0.0
Libraries and tools to create and read KTX image texture files.
|
Structure for passing extended parameters to ktxTexture2_CompressBasisEx(). More...
#include <ktx.h>
Data Fields | |
| ktx_uint32_t | structSize |
| ktx_basis_codec | codec |
| ktx_bool_t | verbose |
| ktx_bool_t | noSSE |
| ktx_uint32_t | threadCount |
| ktx_uint32_t | etc1sCompressionLevel |
| ktx_uint32_t | qualityLevel |
| ktx_uint32_t | maxEndpoints |
| float | endpointRDOThreshold |
| ktx_uint32_t | maxSelectors |
| float | selectorRDOThreshold |
| char | inputSwizzle [4] |
| ktx_bool_t | normalMap |
| ktx_bool_t | separateRGToRGB_A |
| ktx_bool_t | preSwizzle |
| ktx_bool_t | noEndpointRDO |
| ktx_bool_t | noSelectorRDO |
| ktx_pack_uastc_flags | uastcFlags |
| ktx_bool_t | uastcRDO |
| float | uastcRDOQualityScalar |
| ktx_uint32_t | uastcRDODictSize |
| float | uastcRDOMaxSmoothBlockErrorScale |
| float | uastcRDOMaxSmoothBlockStdDev |
| ktx_bool_t | uastcRDODontFavorSimplerModes |
| ktx_bool_t | uastcRDONoMultithreading |
| ktx_uint32_t | uastcHDRQuality |
| ktx_bool_t | uastcHDRUberMode |
| ktx_bool_t | uastcHDRUltraQuant |
| ktx_bool_t | uastcHDRFavorAstc |
| float | uastcHDRLambda |
| ktx_uint32_t | uastcHDRLevel |
Structure for passing extended parameters to ktxTexture2_CompressBasisEx().
If you only want default values, use ktxTexture2_CompressBasis(). Here, at a minimum you must initialize the structure as follows:
etc1sCompressionLevel has to be explicitly set because 0 is a valid etc1sCompressionLevel but is not the default used by the BasisU encoder when no value is set. Only the other settings that are to be non-default must be non-zero.
| ktx_basis_codec codec |
Flag to indicate which codec to use. 0 - NONE, 1 - ETC1S, 2 - UASTC_LDR, 3 - UASTC_HDR4x4, 4 - UASTC_HDR6x6i.
| float endpointRDOThreshold |
Set endpoint RDO quality threshold. The default is 1.25. Lower is higher quality but less quality per output bit (try [1.0,3.0]. This will override the value chosen by qualityLevel.
| ktx_uint32_t etc1sCompressionLevel |
ETC1S compression effort level. Range is [0,6]. Higher values are much slower, but give slightly higher quality. Higher levels are intended for video. This parameter controls numerous internal encoding speed vs. compression efficiency/performance tradeoffs. Note this is NOT the same as the ETC1S quality level, and most users shouldn't change this. There is no default. Callers must explicitly set this value. Callers can use KTX_ETC1S_DEFAULT_COMPRESSION_LEVEL as a default value. Currently this is 2
| char inputSwizzle[4] |
A swizzle to apply before encoding. It must match the regular expression /^[rgba01]{4}$/. If both this and preSwizzle are specified ktxTexture_CompressBasisEx will raise KTX_INVALID_OPERATION. Usable with both ETC1S and UASTC.
| ktx_uint32_t maxEndpoints |
Manually set the max number of color endpoint clusters. Range is [1,16128]. Default is 0, unset. If this is set, maxSelectors must also be set, otherwise the value will be ignored.
| ktx_uint32_t maxSelectors |
Manually set the max number of color selector clusters. Range is [1,16128]. Default is 0, unset. If this is set, maxEndpoints must also be set, otherwise the value will be ignored.
| ktx_bool_t noEndpointRDO |
Disable endpoint rate distortion optimizations. Slightly faster, less noisy output, but lower quality per output bit. Default is KTX_FALSE.
| ktx_bool_t normalMap |
Tunes codec parameters for better quality on normal maps (no selector RDO, no endpoint RDO) and sets the texture's DFD appropriately. Only valid for linear textures.
| ktx_bool_t noSelectorRDO |
Disable selector rate distortion optimizations. Slightly faster, less noisy output, but lower quality per output bit. Default is KTX_FALSE.
| ktx_bool_t noSSE |
True to forbid use of the SSE instruction set. Ignored if CPU does not support SSE.
| ktx_bool_t preSwizzle |
If the texture has KTXswizzle metadata, apply it before compressing. Swizzling, like rabb may yield drastically different error metrics if done after supercompression. Usable for both ETC1S and UASTC.
| ktx_uint32_t qualityLevel |
Compression quality. Range is [1,255]. Lower gives better compression/lower quality/faster. Higher gives less compression /higher quality/slower. This automatically determines values for maxEndpoints, maxSelectors, endpointRDOThreshold and selectorRDOThreshold for the target quality level. Setting these parameters overrides the values determined by qualityLevel which defaults to 128 if neither it nor both of maxEndpoints and maxSelectors have been set.
maxEndpoints and maxSelectors must be set for them to have any effect. endpointRDOThreshold and selectorRDOThreshold when its value exceeds 128, otherwise their defaults will be used. | float selectorRDOThreshold |
Set selector RDO quality threshold. The default is 1.5. Lower is higher quality but less quality per output bit (try [1.0,3.0]). This will override the value chosen by qualityLevel.
| ktx_bool_t separateRGToRGB_A |
| ktx_uint32_t structSize |
Size of this struct. Used so library can tell which version of struct is being passed.
| ktx_uint32_t threadCount |
Number of threads used for compression. Default is 1.
| ktx_pack_uastc_flags uastcFlags |
A set of ktx_pack_uastc_flag_bits_e controlling UASTC encoding. The most important value is the level given in the least-significant 4 bits which selects a speed vs quality tradeoff as shown in the following table:
| Level/Speed | Quality |
|---|---|
| KTX_PACK_UASTC_LEVEL_FASTEST | 43.45dB |
| KTX_PACK_UASTC_LEVEL_FASTER | 46.49dB |
| KTX_PACK_UASTC_LEVEL_DEFAULT | 47.47dB |
| KTX_PACK_UASTC_LEVEL_SLOWER | 48.01dB |
| KTX_PACK_UASTC_LEVEL_VERYSLOW | 48.24dB |
| ktx_bool_t uastcHDRFavorAstc |
UASTC HDR 4x4: By default the UASTC HDR 4x4 encoder tries to strike a balance or even slightly favor BC6H quality. If this option is specified, ASTC HDR 4x4 quality is favored instead.
| float uastcHDRLambda |
UASTC HDR 6x6i specific option: Enables rate distortion optimization (RDO). The higher this value, the lower the quality, but the smaller the file size. Try 100-20000, or higher values on some images.
| ktx_uint32_t uastcHDRLevel |
UASTC HDR 6x6i specific option: Controls the 6x6 HDR intermediate mode encoder performance vs. max quality tradeoff. X may range from [0,12]. Default level is 2.
| ktx_uint32_t uastcHDRQuality |
UASTC HDR 4x4: Sets the UASTC HDR 4x4 compressor's level. Valid range is [0,4] - higher=slower but higher quality. Default=1. Level 0=fastest/lowest quality, 3=highest practical setting, 4=exhaustive
| ktx_bool_t uastcHDRUberMode |
UASTC HDR 4x4: Allow the UASTC HDR 4x4 encoder to try varying the CEM 11 selectors more for slightly higher quality (slower). This may negatively impact BC6H quality, however.
| ktx_bool_t uastcHDRUltraQuant |
UASTC HDR 4x4: Try to find better quantized CEM 7/11 endpoint values (slower)
| ktx_bool_t uastcRDO |
Enable Rate Distortion Optimization (RDO) post-processing.
| ktx_uint32_t uastcRDODictSize |
UASTC RDO dictionary size in bytes. Default is 4096. Lower values=faster, but give less compression. Range is [64,65536].
| ktx_bool_t uastcRDODontFavorSimplerModes |
Do not favor simpler UASTC modes in RDO mode.
| float uastcRDOMaxSmoothBlockErrorScale |
UASTC RDO max smooth block error scale. Range is [1,300]. Default is 10.0, 1.0 is disabled. Larger values suppress more artifacts (and allocate more bits) on smooth blocks.
| float uastcRDOMaxSmoothBlockStdDev |
UASTC RDO max smooth block standard deviation. Range is [.01,65536.0]. Default is 18.0. Larger values expand the range of blocks considered smooth.
| ktx_bool_t uastcRDONoMultithreading |
Disable RDO multithreading (slightly higher compression, deterministic).
| float uastcRDOQualityScalar |
UASTC RDO quality scalar (lambda). Lower values yield higher quality/larger LZ compressed files, higher values yield lower quality/smaller LZ compressed files. A good range to try is [.2,4]. Full range is [.001,50.0]. Default is 1.0.
| ktx_bool_t verbose |
If true, prints Basis Universal encoder operation details to stdout. Not recommended for GUI apps.