summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/cms
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/jpeg-xl/lib/jxl/cms
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/cms')
-rw-r--r--third_party/jpeg-xl/lib/jxl/cms/jxl_cms_internal.h16
-rw-r--r--third_party/jpeg-xl/lib/jxl/cms/opsin_params.h3
-rw-r--r--third_party/jpeg-xl/lib/jxl/cms/tone_mapping.h1
3 files changed, 19 insertions, 1 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/cms/jxl_cms_internal.h b/third_party/jpeg-xl/lib/jxl/cms/jxl_cms_internal.h
index a787bd11d8..69a5dc434e 100644
--- a/third_party/jpeg-xl/lib/jxl/cms/jxl_cms_internal.h
+++ b/third_party/jpeg-xl/lib/jxl/cms/jxl_cms_internal.h
@@ -405,7 +405,7 @@ static Status WriteICCS15Fixed16(float value, size_t pos,
// Even the first value works well,...
bool ok = (-32767.995f <= value) && (value <= 32767.995f);
if (!ok) return JXL_FAILURE("ICC value is out of range / NaN");
- int32_t i = value * 65536.0f + 0.5f;
+ int32_t i = static_cast<int32_t>(std::lround(value * 65536.0f));
// Use two's complement
uint32_t u = static_cast<uint32_t>(i);
WriteICCUint32(u, pos, icc);
@@ -849,6 +849,20 @@ static std::string ToString(JxlRenderingIntent rendering_intent) {
}
static std::string ColorEncodingDescriptionImpl(const JxlColorEncoding& c) {
+ if (c.color_space == JXL_COLOR_SPACE_RGB &&
+ c.white_point == JXL_WHITE_POINT_D65) {
+ if (c.rendering_intent == JXL_RENDERING_INTENT_PERCEPTUAL &&
+ c.transfer_function == JXL_TRANSFER_FUNCTION_SRGB) {
+ if (c.primaries == JXL_PRIMARIES_SRGB) return "sRGB";
+ if (c.primaries == JXL_PRIMARIES_P3) return "DisplayP3";
+ }
+ if (c.rendering_intent == JXL_RENDERING_INTENT_RELATIVE &&
+ c.primaries == JXL_PRIMARIES_2100) {
+ if (c.transfer_function == JXL_TRANSFER_FUNCTION_PQ) return "Rec2100PQ";
+ if (c.transfer_function == JXL_TRANSFER_FUNCTION_HLG) return "Rec2100HLG";
+ }
+ }
+
std::string d = ToString(c.color_space);
bool explicit_wp_tf = (c.color_space != JXL_COLOR_SPACE_XYB);
diff --git a/third_party/jpeg-xl/lib/jxl/cms/opsin_params.h b/third_party/jpeg-xl/lib/jxl/cms/opsin_params.h
index 69dcd0b512..0af852c745 100644
--- a/third_party/jpeg-xl/lib/jxl/cms/opsin_params.h
+++ b/third_party/jpeg-xl/lib/jxl/cms/opsin_params.h
@@ -6,6 +6,9 @@
#ifndef LIB_JXL_CMS_OPSIN_PARAMS_H_
#define LIB_JXL_CMS_OPSIN_PARAMS_H_
+#include <array>
+#include <cstddef>
+
#include "lib/jxl/base/matrix_ops.h"
// Constants that define the XYB color space.
diff --git a/third_party/jpeg-xl/lib/jxl/cms/tone_mapping.h b/third_party/jpeg-xl/lib/jxl/cms/tone_mapping.h
index 1f85dcca41..c1f43f4d31 100644
--- a/third_party/jpeg-xl/lib/jxl/cms/tone_mapping.h
+++ b/third_party/jpeg-xl/lib/jxl/cms/tone_mapping.h
@@ -8,6 +8,7 @@
#include <algorithm>
#include <cmath>
+#include <cstddef>
#include <utility>
#include "lib/jxl/base/common.h"