Index: third_party/qcms/src/transform_util.c |
diff --git a/third_party/qcms/src/transform_util.c b/third_party/qcms/src/transform_util.c |
index aa08df04bffed7e2d781608b66ace76033d8365d..5cb45f8419e81132b4176eb9cf076bb740c28a97 100644 |
--- a/third_party/qcms/src/transform_util.c |
+++ b/third_party/qcms/src/transform_util.c |
@@ -360,6 +360,14 @@ uint16_fract_t lut_inverse_interp16(uint16_t Value, uint16_t LutTable[], int len |
return 0; |
} |
+ // For input 0, return that to maintain black level. Note the binary search |
+ // does not. For example, it inverts the standard sRGB gamma curve to 7 at |
+ // the origin, causing a black level error. |
+ |
+ if (Value == 0 && NumZeroes) { |
+ return 0; |
+ } |
+ |
// Seems not a degenerated case... apply binary search |
while (r > l) { |