From 0490917aca6b8e6057c04c8becc820a8e849a801 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 14 Oct 2012 00:54:07 +0200 Subject: [PATCH 1/1] Support conversion to and from the XYZ color space. --- colorspace_conversion_effect.cpp | 7 +++++++ image_format.h | 1 + 2 files changed, 8 insertions(+) diff --git a/colorspace_conversion_effect.cpp b/colorspace_conversion_effect.cpp index 9726b3b..2f74a27 100644 --- a/colorspace_conversion_effect.cpp +++ b/colorspace_conversion_effect.cpp @@ -25,6 +25,13 @@ ColorSpaceConversionEffect::ColorSpaceConversionEffect() void get_xyz_matrix(ColorSpace space, Matrix3x3 m) { + if (space == COLORSPACE_XYZ) { + m[0] = 1.0f; m[3] = 0.0f; m[6] = 0.0f; + m[1] = 0.0f; m[4] = 1.0f; m[7] = 0.0f; + m[2] = 0.0f; m[5] = 0.0f; m[8] = 1.0f; + return; + } + double x_R, x_G, x_B; double y_R, y_G, y_B; double Y_R, Y_G, Y_B; diff --git a/image_format.h b/image_format.h index 55aa8d4..f84a0f4 100644 --- a/image_format.h +++ b/image_format.h @@ -9,6 +9,7 @@ enum ColorSpace { COLORSPACE_REC_709 = 0, // Same as sRGB. COLORSPACE_REC_601_525 = 1, COLORSPACE_REC_601_625 = 2, + COLORSPACE_XYZ = 3, // Mostly useful for testing and debugging. }; enum GammaCurve { -- 2.39.2