+ if (space == COLORSPACE_sRGB) {
+ // sRGB is not defined by the color primaries, but by concrete
+ // forward and inverse matrices that are rounded-off versions
+ // of the Rec. 709 color space (see
+ // https://photosauce.net/blog/post/what-makes-srgb-a-special-color-space).
+ // We're not compliant with the inverse matrix, since we'd be
+ // too accurate (sRGB is specified for 8-bit only); however,
+ // results should be very close in practice (and even closer to
+ // scRGB's inverse matrix, which is a higher-accuracy inversion of
+ // the same forward matrix).
+ return Matrix3d{
+ { 0.4124, 0.3576, 0.1805 },
+ { 0.2126, 0.7152, 0.0722 },
+ { 0.0193, 0.1192, 0.9505 }
+ };
+ }