-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ktx create not doing verbatim copy of EXR half_float. Also "Not enough precision" error message is unclear. #970
Comments
It was an explicit requirement for the tool to do verbatim copies on create/extract, that is for a 16-bit float input file one must use a 16-bit float format. Pretty much it was a general goal to have 1:1 mapping whenever possible (there are exceptions like depth/stencil, packed float, certain integer, etc. formats, of course). Sure, it would be possible to convert, both up (FP32) or down (e.g. UNORM), so if it is deemed preferable to do conversion then it should be straightforward to add support. |
Verbatim copies is fine. With that in mind there are two issues with the current code:
I'll update the title of this issue. |
The reason why it is loaded as a FP32 is that some other parameters may require transforming the data in various fashions (e.g. generate mipmaps) and there's no native FP16 support to be able to implement it on the CPU, particularly in the image manipulation library KTX inherited from basisu. Adding that would require pulling in an IEEE compliant half library that is actually able to do math on halfs and even that would be less efficient than the current solution. Functionally, this works today, i.e. you're able to create R16G16B16A16_SFLOAT from an FP16 EXR. If you'd like to add "native" (of course, emulated) FP16 support to the imaging stack, you can use a library like the following: |
When loading an EXR file with half float channels and
--format R32B32B32A32_SFLOAT
ktx create raises an errorHowever ExrInput::ReadImage happily accepts a targetBitDepth of 32 which it passes on to
LoadEXRImageFromMemory
which returns float values. If I comment out this codeKTX-Software/tools/ktx/command_create.cpp
Line 1406 in b619004
The half-float file I've been using for testing is https://raw.githubusercontent.com/AcademySoftwareFoundation/openexr-images/main/ScanLines/Blobbies.jpg.
The text was updated successfully, but these errors were encountered: