diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-25 16:22:34 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-25 16:22:34 +0100 |
| commit | 130b5dc1d918194ceec756d2388c33665efcc169 (patch) | |
| tree | 9e261777b15a7fa5f914d269c3238603644f80ef | |
| parent | e520f1009eaa552c7b3931ced85c0f19d8aff554 (diff) | |
Clamp out-of-range XYZ values rather than assert()ing.
| -rw-r--r-- | src/rgb_xyz.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rgb_xyz.cc b/src/rgb_xyz.cc index 509e320a..c27e18c7 100644 --- a/src/rgb_xyz.cc +++ b/src/rgb_xyz.cc @@ -166,9 +166,12 @@ libdcp::rgb_to_xyz ( e.y = e.y * DCI_COEFFICIENT * 65535; e.z = e.z * DCI_COEFFICIENT * 65535; - assert (e.x >= 0 && e.x < 65536); - assert (e.y >= 0 && e.y < 65536); - assert (e.z >= 0 && e.z < 65536); + e.x = max (0.0, e.x); + e.y = max (0.0, e.y); + e.z = max (0.0, e.z); + e.x = min (65535.0, e.x); + e.y = min (65535.0, e.y); + e.z = min (65535.0, e.z); /* Out gamma LUT */ xyz->data(0)[jn] = lut_out->lut()[(int) e.x] * 4096; |
