Add BCn encoders/decoders with RDO support#1167
Add BCn encoders/decoders with RDO support#1167walcht wants to merge 6 commits intoKhronosGroup:mainfrom
Conversation
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
*Add encode/decode tests (that use both CompressBCn/DecodeBCn) *Add BCn ktx2 test files (transcoded from tests/resources/ktx2/color_grid_uastc_zstd_5.ktx2) *Cleanup BCn test fixtures *Remove `std::cout` statement Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
|
There are also a lot of compiler warnings from bc7enc_rdo dependency. These should be straightforward to address directly in copied files from bc7enc_rdo. |
*Add BC1, BC3, BC4, BC5, and BC7 encoding support to "ktx encode" command. *Cleanup ktxBCnParams and add BC1/BC3 quality and mode params. *Add docstrings/documentation to newly added enums/structs in ktx.h. Signed-off-by: Walid Chtioui <walid.chtioui.main@gmail.com>
|
@walcht, Thank you for this. Can you view the build logs? One issue I notice immediately is that there are no changes to Regarding RDO and multi-threading, the UASTC encoder also has separate multi-threading options for the encoder and for the RDO step. You can follow the same model. If we need to fix warnings in the encoder I suggest forking the encoder then incorporating the fork here by way of Re. SIMD and ISPC, be careful how you support this. We need to support building and running on arm64 processors. Also compile flags to enable SIMD are not compatible with straightforward use of universal build tool chains, which is why this project does not do universal builds. Better is use of compiler pre-defined macros and run-time queries to discover what the software is being compiled for and running on. However since we aren't doing universal builds there is no need to obsess over this last detail. |
As discussed in #1159:
ktxTexture2_CompressBCnandktxTexture2_DecodeBCnare introduced in this PR to allow libktx users/consumers to encode/decode BCn textures from/to raw decompressed formats.I still haven't added the RDO post processing step and I will once I finalize testing (which is currently just partial).
https://github.com/richgel999/bc7enc_rdo does not support BC6HU/BC6HS encoding/decoding and also no BC2 (this format is essentially dead since BC3 replaces it). Anyways, even though the names are
ktxTexture2_CompressBCnandktxTexture2_DecodeBCnonly BC1, BC3, BC4, BC5, and BC7 are supported (I can add BC6HU/BC6HS support in another PR).This is still a somewhat early PR. Please feel free to give feedback, edit, and nitpick as much as possible.
Some context: I am adding KTX2 support to OIIO (PR: AcademySoftwareFoundation/OpenImageIO#5185) and having libktx encode/decode BCn formats significantly simplifies things (also ETC encoding/decoding which I can also open a PR for - if approved).
I haven't updated the KTX-Software-CTS with the added BCn test files.
Once this is finalized, this will address issue #587.
Current TODOs:
ktx encodecommandktx extractcommandktxBCnParamsstruct (apparently there are many and I am not qualified to know which subset to expose or to expose them all). For the moment I will just expose them all.LIBKTX_FEATURE_BCN_DECODERCMake flag optionNote1: no LLMs/AI coding tools were used in any capacity whatsoever in writing or aiding in the writing of this PR.
Note2: I am an individual contributor (main reason I am contributing here is to add support for KTX2 in Blender).
Edit: TODO list edits