diff options
Diffstat (limited to 'lib/extras/enc/exr.cc')
-rw-r--r-- | lib/extras/enc/exr.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/extras/enc/exr.cc b/lib/extras/enc/exr.cc index 05e05f9..d4005c3 100644 --- a/lib/extras/enc/exr.cc +++ b/lib/extras/enc/exr.cc @@ -5,20 +5,23 @@ #include "lib/extras/enc/exr.h" +#if JPEGXL_ENABLE_EXR #include <ImfChromaticitiesAttribute.h> #include <ImfIO.h> #include <ImfRgbaFile.h> #include <ImfStandardAttributes.h> +#endif +#include <jxl/codestream_header.h> #include <vector> -#include "jxl/codestream_header.h" #include "lib/extras/packed_image.h" #include "lib/jxl/base/byte_order.h" namespace jxl { namespace extras { +#if JPEGXL_ENABLE_EXR namespace { namespace OpenEXR = OPENEXR_IMF_NAMESPACE; @@ -110,7 +113,7 @@ Status EncodeImageEXR(const PackedImage& image, const JxlBasicInfo& info, chromaticities.white = Imath::V2f(c_enc.white_point_xy[0], c_enc.white_point_xy[1]); OpenEXR::addChromaticities(header, chromaticities); - OpenEXR::addWhiteLuminance(header, 255.0f); + OpenEXR::addWhiteLuminance(header, info.intensity_target); auto loadFloat = format.endianness == JXL_BIG_ENDIAN ? LoadBEFloat : LoadLEFloat; @@ -162,7 +165,7 @@ class EXREncoder : public Encoder { std::vector<JxlPixelFormat> AcceptedFormats() const override { std::vector<JxlPixelFormat> formats; for (const uint32_t num_channels : {1, 2, 3, 4}) { - for (const JxlDataType data_type : {JXL_TYPE_FLOAT, JXL_TYPE_FLOAT16}) { + for (const JxlDataType data_type : {JXL_TYPE_FLOAT}) { for (JxlEndianness endianness : {JXL_BIG_ENDIAN, JXL_LITTLE_ENDIAN}) { formats.push_back(JxlPixelFormat{/*num_channels=*/num_channels, /*data_type=*/data_type, @@ -191,9 +194,14 @@ class EXREncoder : public Encoder { }; } // namespace +#endif std::unique_ptr<Encoder> GetEXREncoder() { +#if JPEGXL_ENABLE_EXR return jxl::make_unique<EXREncoder>(); +#else + return nullptr; +#endif } } // namespace extras |