Chromium Code Reviews| Index: third_party/qcms/src/tests/qcms_test_internal_srgb.c |
| diff --git a/third_party/qcms/src/tests/qcms_test_internal_srgb.c b/third_party/qcms/src/tests/qcms_test_internal_srgb.c |
| index 58855a1b6c924edcc0c4a50a1f42afdbf5f5d731..bf1f9095178d4ff566349912c4c6488bea89c243 100644 |
| --- a/third_party/qcms/src/tests/qcms_test_internal_srgb.c |
| +++ b/third_party/qcms/src/tests/qcms_test_internal_srgb.c |
| @@ -9,11 +9,17 @@ |
| #include <stdint.h> |
| #include <stdlib.h> |
| -// Colorant matrix for the official sRGB IEC61966-2.1 color (D50) primaries. |
| +// D50 adapted color primaries of the sRGB IEC61966-2.1 color profile. |
| static s15Fixed16Number sRGB_reference[3][3] = { |
| {0x06fa2 /*0.436066*/, /*0.385147*/ 0x06299, /*0.143066*/ 0x024a0}, |
| {0x038f5 /*0.222488*/, /*0.716873*/ 0x0b785, /*0.060608*/ 0x00f84}, |
| - {0x00390 /*0.013916*/, /*0.097076*/ 0x018da, /*0.714096*/ 0x0b6cf}}; |
| + {0x00390 /*0.013916*/, /*0.097076*/ 0x018da, /*0.714096*/ 0x0b6cf} |
|
Noel Gordon
2016/03/11 15:45:08
Nit: One tab too many.
radu.velea
2016/03/11 15:55:21
Done.
|
| +}; |
| + |
| +// Reference media white point of the sRGB IEC61966-2.1 color profile. |
| +static struct XYZNumber D65 = { |
| + 0xf351, 0x10000, 0x116cc // ( 0.950455, 1.000000, 1.089050 ) |
|
Noel Gordon
2016/03/11 15:45:08
nit: One tab too many.
radu.velea
2016/03/11 15:55:21
Done.
|
| +}; |
| static int qcms_test_internal_srgb(size_t width, |
| size_t height, |
| @@ -27,7 +33,13 @@ static int qcms_test_internal_srgb(size_t width, |
| s15Fixed16Number diff = 0; |
| int i, j; |
| - printf("Test qcms internal sRGB colorant matrix against official sRGB IEC61966-2.1 color (D50) primaries\n"); |
| + if (qcms_profile_is_bogus(profile)) { |
| + fprintf(stderr, "Failure: the internal sRGB profile failed the bogus profile check\n"); |
| + qcms_profile_release(profile); |
| + return -1; |
| + } |
| + |
| + printf("Test qcms internal sRGB color primaries against sRGB IEC61966-2.1 color primaries\n"); |
| sRGB_internal[0][0] = profile->redColorant.X; |
| sRGB_internal[1][0] = profile->redColorant.Y; |
| @@ -48,9 +60,16 @@ static int qcms_test_internal_srgb(size_t width, |
| printf("\n"); |
| } |
| - qcms_profile_release(profile); |
| + printf("Total error = 0x%x [%.6f]\n\n", diff, diff / 65536.0); |
| + |
| + printf("Test media white point against expected sRGB IEC61966-2.1 D65 XYZ values\n"); |
| + printf("Internal values = [0x%X, 0x%X, 0x%X]\n", |
| + profile->mediaWhitePoint.X, profile->mediaWhitePoint.Y, profile->mediaWhitePoint.Z); |
| - printf("Total error = 0x%x [%.6f]\n", diff, diff / 65536.0); |
| + printf("White point error = [%d, %d, %d]\n", |
| + profile->mediaWhitePoint.X - D65.X, profile->mediaWhitePoint.Y - D65.Y, profile->mediaWhitePoint.Z - D65.Z); |
| + |
| + qcms_profile_release(profile); |
| return diff; |
| } |