summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-10-22 00:20:53 +0200
committerCarl Hetherington <cth@carlh.net>2023-10-22 00:42:22 +0200
commit687e46f8770ee946ce149e2b893f3626052b6881 (patch)
tree8745f8b05959db85bf08bf5fa6bb42801ea0b2e3 /src
parente171a0bbaf0dedbab261279561888e7259a40df7 (diff)
Remove logging of clamped values.
I can't remember seeing this logged for ages and it appears to cost nearly a second on the rgb_xyz benchmark on AMD Ryzen 7 5700U.
Diffstat (limited to 'src')
-rw-r--r--src/rgb_xyz.cc23
-rw-r--r--src/rgb_xyz.h6
2 files changed, 7 insertions, 22 deletions
diff --git a/src/rgb_xyz.cc b/src/rgb_xyz.cc
index 9aeed761..c9854107 100644
--- a/src/rgb_xyz.cc
+++ b/src/rgb_xyz.cc
@@ -275,8 +275,7 @@ rgb_to_xyz_internal(
T*& xyz_z,
dcp::Size size,
int stride,
- ColourConversion const& conversion,
- optional<NoteHandler> note
+ ColourConversion const& conversion
)
{
struct {
@@ -294,7 +293,6 @@ rgb_to_xyz_internal(
double fast_matrix[9];
combined_rgb_to_xyz (conversion, fast_matrix);
- int clamped = 0;
for (int y = 0; y < size.height; ++y) {
auto p = reinterpret_cast<uint16_t const *> (rgb + y * stride);
for (int x = 0; x < size.width; ++x) {
@@ -310,11 +308,6 @@ rgb_to_xyz_internal(
d.z = s.r * fast_matrix[6] + s.g * fast_matrix[7] + s.b * fast_matrix[8];
/* Clamp */
-
- if (d.x < 0 || d.y < 0 || d.z < 0 || d.x > 1 || d.y > 1 || d.z > 1) {
- ++clamped;
- }
-
d.x = max (0.0, d.x);
d.y = max (0.0, d.y);
d.z = max (0.0, d.z);
@@ -328,10 +321,6 @@ rgb_to_xyz_internal(
*xyz_z++ = lut_out.lookup(d.z);
}
}
-
- if (clamped && note) {
- note.get()(NoteType::NOTE, String::compose("%1 XYZ value(s) clamped", clamped));
- }
}
@@ -340,8 +329,7 @@ dcp::rgb_to_xyz (
uint8_t const * rgb,
dcp::Size size,
int stride,
- ColourConversion const & conversion,
- optional<NoteHandler> note
+ ColourConversion const & conversion
)
{
auto xyz = make_shared<OpenJPEGImage>(size);
@@ -350,7 +338,7 @@ dcp::rgb_to_xyz (
int* xyz_y = xyz->data (1);
int* xyz_z = xyz->data (2);
- rgb_to_xyz_internal(rgb, xyz_x, xyz_y, xyz_z, size, stride, conversion, note);
+ rgb_to_xyz_internal(rgb, xyz_x, xyz_y, xyz_z, size, stride, conversion);
return xyz;
}
@@ -362,9 +350,8 @@ dcp::rgb_to_xyz (
uint16_t* dst,
dcp::Size size,
int stride,
- ColourConversion const & conversion,
- optional<NoteHandler> note
+ ColourConversion const & conversion
)
{
- rgb_to_xyz_internal(rgb, dst, dst, dst, size, stride, conversion, note);
+ rgb_to_xyz_internal(rgb, dst, dst, dst, size, stride, conversion);
}
diff --git a/src/rgb_xyz.h b/src/rgb_xyz.h
index 22e1396d..c41fdee0 100644
--- a/src/rgb_xyz.h
+++ b/src/rgb_xyz.h
@@ -107,8 +107,7 @@ extern void rgb_to_xyz (
uint16_t* dst,
dcp::Size size,
int stride,
- ColourConversion const & conversion,
- boost::optional<NoteHandler> note = boost::optional<NoteHandler>()
+ ColourConversion const& conversion
);
/** @param rgb RGB data; packed RGB 16:16:16, 48bpp, 16R, 16G, 16B,
@@ -121,8 +120,7 @@ extern std::shared_ptr<OpenJPEGImage> rgb_to_xyz (
uint8_t const * rgb,
dcp::Size size,
int stride,
- ColourConversion const & conversion,
- boost::optional<NoteHandler> note = boost::optional<NoteHandler> ()
+ ColourConversion const& conversion
);