summaryrefslogtreecommitdiff
path: root/lib/extras/tone_mapping.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/extras/tone_mapping.cc')
-rw-r--r--lib/extras/tone_mapping.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/extras/tone_mapping.cc b/lib/extras/tone_mapping.cc
index 1ed1b29..3d02695 100644
--- a/lib/extras/tone_mapping.cc
+++ b/lib/extras/tone_mapping.cc
@@ -7,11 +7,13 @@
#undef HWY_TARGET_INCLUDE
#define HWY_TARGET_INCLUDE "lib/extras/tone_mapping.cc"
+#include <jxl/cms.h>
+
#include <hwy/foreach_target.h>
#include <hwy/highway.h>
-#include "lib/jxl/dec_tone_mapping-inl.h"
-#include "lib/jxl/enc_color_management.h"
+#include "lib/jxl/cms/tone_mapping-inl.h"
+#include "lib/jxl/image_bundle.h"
HWY_BEFORE_NAMESPACE();
namespace jxl {
@@ -30,11 +32,12 @@ Status ToneMapFrame(const std::pair<float, float> display_nits,
ColorEncoding linear_rec2020;
linear_rec2020.SetColorSpace(ColorSpace::kRGB);
- linear_rec2020.primaries = Primaries::k2100;
- linear_rec2020.white_point = WhitePoint::kD65;
- linear_rec2020.tf.SetTransferFunction(TransferFunction::kLinear);
+ JXL_RETURN_IF_ERROR(linear_rec2020.SetPrimariesType(Primaries::k2100));
+ JXL_RETURN_IF_ERROR(linear_rec2020.SetWhitePointType(WhitePoint::kD65));
+ linear_rec2020.Tf().SetTransferFunction(TransferFunction::kLinear);
JXL_RETURN_IF_ERROR(linear_rec2020.CreateICC());
- JXL_RETURN_IF_ERROR(ib->TransformTo(linear_rec2020, GetJxlCms(), pool));
+ JXL_RETURN_IF_ERROR(
+ ib->TransformTo(linear_rec2020, *JxlGetDefaultCms(), pool));
Rec2408ToneMapper<decltype(df)> tone_mapper(
{ib->metadata()->tone_mapping.min_nits,
@@ -67,11 +70,12 @@ Status GamutMapFrame(ImageBundle* const ib, float preserve_saturation,
ColorEncoding linear_rec2020;
linear_rec2020.SetColorSpace(ColorSpace::kRGB);
- linear_rec2020.primaries = Primaries::k2100;
- linear_rec2020.white_point = WhitePoint::kD65;
- linear_rec2020.tf.SetTransferFunction(TransferFunction::kLinear);
+ JXL_RETURN_IF_ERROR(linear_rec2020.SetPrimariesType(Primaries::k2100));
+ JXL_RETURN_IF_ERROR(linear_rec2020.SetWhitePointType(WhitePoint::kD65));
+ linear_rec2020.Tf().SetTransferFunction(TransferFunction::kLinear);
JXL_RETURN_IF_ERROR(linear_rec2020.CreateICC());
- JXL_RETURN_IF_ERROR(ib->TransformTo(linear_rec2020, GetJxlCms(), pool));
+ JXL_RETURN_IF_ERROR(
+ ib->TransformTo(linear_rec2020, *JxlGetDefaultCms(), pool));
JXL_RETURN_IF_ERROR(RunOnPool(
pool, 0, ib->ysize(), ThreadPool::NoInit,