-
-
Notifications
You must be signed in to change notification settings - Fork 698
tiffload: add 16-bit float support #3626
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
Conversation
@kmilos I believe it's a little bit too much for a single rare case 🙂 |
Ah good point. We already have imath as an optional dependency via openexr, so I think just adding Does anyone know if imath has runtime dispatch? Ie. the SSE2 / AVX512 / whatever path is picked at runtime? |
I don't think so. |
I had a quick grep and I think it's probably using a look up table by default: https://github.com/AcademySoftwareFoundation/Imath/blob/main/src/Imath/half.h#L116 You need to build with extra compiler flags to enable the use of intrinsics. Anyway, it's likely to be quicker than bit twiddling, and we probably already have this LUT inside the openexr loader, so it probably makes sense to use it. |
I guess -march and -mcpu determine if F16C extension is available or not. Been around for a while though...
Some idea of difference is already given by the same header file: |
Once PR #3618 lands, another option would be to use Highway's This should be safe to use if its availability is verified at both compile- and run time with I might take a look at this, although 16-bit float TIFFs aren't that common. |
e695017
to
9203c29
Compare
It's definitely quicker. But since 16-bit float TIFF seems to be an extremely rare case, I decided to not go hardcore here.
It uses |
Ah I keep forgetting about highway, you're right. But I agree with @DarthSim --- this is not likely to be a hotspot, so just do something simple for now. We can put in a highway path if this function ever shows up on profiles. |
9203c29
to
20c2bcf
Compare
Applied some code style fixes |
Hey there 👋
This PR adds support for 16-bit float TIFFs. I didn't use
_Float16
because it's not generally available.Here are some test images: tiff3_f16_f32.zip