]> git.sesse.net Git - movit/commitdiff
Support conversion to and from the XYZ color space.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Oct 2012 22:54:07 +0000 (00:54 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Oct 2012 22:54:07 +0000 (00:54 +0200)
colorspace_conversion_effect.cpp
image_format.h

index 9726b3b69afdb283b24cb043a9d42643a03661d2..2f74a2785ec49a84bfe518f9b2b99cc07ef6f8c9 100644 (file)
@@ -25,6 +25,13 @@ ColorSpaceConversionEffect::ColorSpaceConversionEffect()
 
 void get_xyz_matrix(ColorSpace space, Matrix3x3 m)
 {
 
 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;
        double x_R, x_G, x_B;
        double y_R, y_G, y_B;
        double Y_R, Y_G, Y_B;
index 55aa8d4989b26233d2688243e0370f08c46e4552..f84a0f487ff596f0f65bb864b3b1f3b45dc14748 100644 (file)
@@ -9,6 +9,7 @@ enum ColorSpace {
        COLORSPACE_REC_709 = 0,  // Same as sRGB.
        COLORSPACE_REC_601_525 = 1,
        COLORSPACE_REC_601_625 = 2,
        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 {
 };
 
 enum GammaCurve {