HDR file format: replace FreeImage HDR loader with our own from-scratch implementation #743
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #739. Thank you to @warrengalyen for catching and reporting.
PhotoDemon has historically used the 3rd-party FreeImage library to load HDR images. FreeImage has not been updated in 8 years but its problems run even deeper than that. For HDR images specifically, it has a lot of weird quirks that just don't make sense - it enforces line-length requirements on header lines which break valid files (see #739), it uses a non-standard exposure calculation when converting from float to RGB, it ignores embedded color correction values and provides no way for the caller to even see those values, it writes bad exposure values which prevents loading saved HDR images in GIMP and other software, it doesn't cover format variations like the XYZ color space, and its performance is mediocre at best.
This commit fixes all those problems with a new, from-scratch HDR loader built specifically for PhotoDemon.
HDR format support is now faster, much more comprehensive, and color accuracy of imported images is greatly improved. All format variations are supported and very-old Radiance files are now supported for the first time.
This merge only overhauls HDR import; HDR export support is still TODO.