Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the Chromium LICENSE file. | 3 // found in the Chromium LICENSE file. |
| 4 | 4 |
| 5 #include "qcms.h" | 5 #include "qcms.h" |
| 6 #include "qcms_test_util.h" | 6 #include "qcms_test_util.h" |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| 11 | 11 |
| 12 // Colorant matrix for the official sRGB IEC61966-2.1 color (D50) primaries. | 12 // Colorant matrix and media white point for the official sRGB IEC61966-2.1 colo r (D50) primaries. |
|
Noel Gordon
2016/03/11 15:19:21
// D50 adapted color primaries of the sRGB IEC6196
radu.velea
2016/03/11 15:32:02
Done.
| |
| 13 static s15Fixed16Number sRGB_reference[3][3] = { | 13 static s15Fixed16Number sRGB_reference[3][3] = { |
| 14 {0x06fa2 /*0.436066*/, /*0.385147*/ 0x06299, /*0.143066*/ 0x024 a0}, | 14 {0x06fa2 /*0.436066*/, /*0.385147*/ 0x06299, /*0.143066*/ 0x024 a0}, |
| 15 {0x038f5 /*0.222488*/, /*0.716873*/ 0x0b785, /*0.060608*/ 0x00f 84}, | 15 {0x038f5 /*0.222488*/, /*0.716873*/ 0x0b785, /*0.060608*/ 0x00f 84}, |
| 16 {0x00390 /*0.013916*/, /*0.097076*/ 0x018da, /*0.714096*/ 0x0b6 cf}}; | 16 {0x00390 /*0.013916*/, /*0.097076*/ 0x018da, /*0.714096*/ 0x0b6 cf}}; |
|
Noel Gordon
2016/03/11 15:19:21
0x0b6cf}}; ->
0x0b6cf}
};
radu.velea
2016/03/11 15:32:02
Done.
| |
| 17 static struct XYZNumber D65 = { | |
|
Noel Gordon
2016/03/11 15:19:21
space before this line
// Reference media white po
radu.velea
2016/03/11 15:32:02
Done.
| |
| 18 0xf351, 0x10000, 0x116cc // ( 0.950455, 1.000000, 1.089050 ) | |
| 19 }; | |
| 17 | 20 |
| 18 static int qcms_test_internal_srgb(size_t width, | 21 static int qcms_test_internal_srgb(size_t width, |
| 19 size_t height, | 22 size_t height, |
| 20 int iterations, | 23 int iterations, |
| 21 const char *in_path, | 24 const char *in_path, |
| 22 const char *out_path, | 25 const char *out_path, |
| 23 const int force_software) | 26 const int force_software) |
| 24 { | 27 { |
| 25 qcms_profile *profile = qcms_profile_sRGB(); | 28 qcms_profile *profile = qcms_profile_sRGB(); |
| 26 s15Fixed16Number sRGB_internal[3][3]; | 29 s15Fixed16Number sRGB_internal[3][3]; |
| 27 s15Fixed16Number diff = 0; | 30 s15Fixed16Number diff = 0; |
| 28 int i, j; | 31 int i, j; |
| 29 | 32 |
| 33 if (qcms_profile_is_bogus(profile)) { | |
| 34 fprintf(stderr, "Profile is bogus\n"); | |
|
Noel Gordon
2016/03/11 15:19:21
"Failure: the internal sRGB profile failed the bog
radu.velea
2016/03/11 15:32:02
Done.
| |
| 35 qcms_profile_release(profile); | |
| 36 return -1; | |
| 37 } | |
| 38 | |
| 30 printf("Test qcms internal sRGB colorant matrix against official sRGB IE C61966-2.1 color (D50) primaries\n"); | 39 printf("Test qcms internal sRGB colorant matrix against official sRGB IE C61966-2.1 color (D50) primaries\n"); |
|
Noel Gordon
2016/03/11 15:19:21
printf("Test qcms internal sRGB colorant primaries
radu.velea
2016/03/11 15:32:02
Done.
| |
| 31 | 40 |
| 32 sRGB_internal[0][0] = profile->redColorant.X; | 41 sRGB_internal[0][0] = profile->redColorant.X; |
| 33 sRGB_internal[1][0] = profile->redColorant.Y; | 42 sRGB_internal[1][0] = profile->redColorant.Y; |
| 34 sRGB_internal[2][0] = profile->redColorant.Z; | 43 sRGB_internal[2][0] = profile->redColorant.Z; |
| 35 sRGB_internal[0][1] = profile->greenColorant.X; | 44 sRGB_internal[0][1] = profile->greenColorant.X; |
| 36 sRGB_internal[1][1] = profile->greenColorant.Y; | 45 sRGB_internal[1][1] = profile->greenColorant.Y; |
| 37 sRGB_internal[2][1] = profile->greenColorant.Z; | 46 sRGB_internal[2][1] = profile->greenColorant.Z; |
| 38 sRGB_internal[0][2] = profile->blueColorant.X; | 47 sRGB_internal[0][2] = profile->blueColorant.X; |
| 39 sRGB_internal[1][2] = profile->blueColorant.Y; | 48 sRGB_internal[1][2] = profile->blueColorant.Y; |
| 40 sRGB_internal[2][2] = profile->blueColorant.Z; | 49 sRGB_internal[2][2] = profile->blueColorant.Z; |
| 41 | 50 |
| 42 for (i = 0; i < 3; i++) { | 51 for (i = 0; i < 3; i++) { |
| 43 for (j = 0; j < 3; j++) { | 52 for (j = 0; j < 3; j++) { |
| 44 s15Fixed16Number tmp = sRGB_internal[i][j] - sRGB_refere nce[i][j]; | 53 s15Fixed16Number tmp = sRGB_internal[i][j] - sRGB_refere nce[i][j]; |
| 45 printf("\t%d", tmp); | 54 printf("\t%d", tmp); |
| 46 diff += abs(tmp); | 55 diff += abs(tmp); |
| 47 } | 56 } |
| 48 printf("\n"); | 57 printf("\n"); |
| 49 } | 58 } |
| 50 | 59 |
| 60 printf("Total error = 0x%x [%.6f]\n\n", diff, diff / 65536.0); | |
| 61 | |
| 62 printf("Test media white point against official sRGB IEC61966-2.1 D65 XY Z values\n"); | |
|
Noel Gordon
2016/03/11 15:19:21
printf("Test media white point against expected sR
radu.velea
2016/03/11 15:32:02
Done.
| |
| 63 printf("Internal values = [0x%X, 0x%X, 0x%X]\n", | |
| 64 profile->mediaWhitePoint.X, profile->mediaWhitePoint.Y, profile->mediaWhitePoint.Z); | |
| 65 | |
| 66 printf("White point error = [0x%X, 0x%X, 0x%X]\n", | |
| 67 profile->mediaWhitePoint.X - D65.X, profile->mediaWhiteP oint.Y - D65.Y, profile->mediaWhitePoint.Z - D65.Z); | |
| 68 | |
| 51 qcms_profile_release(profile); | 69 qcms_profile_release(profile); |
| 52 | 70 |
| 53 printf("Total error = 0x%x [%.6f]\n", diff, diff / 65536.0); | |
| 54 | |
| 55 return diff; | 71 return diff; |
| 56 } | 72 } |
| 57 | 73 |
| 58 struct qcms_test_case qcms_test_internal_srgb_info = { | 74 struct qcms_test_case qcms_test_internal_srgb_info = { |
| 59 "qcms_test_internal_srgb", | 75 "qcms_test_internal_srgb", |
| 60 qcms_test_internal_srgb, | 76 qcms_test_internal_srgb, |
| 61 QCMS_TEST_DISABLED | 77 QCMS_TEST_DISABLED |
| 62 }; | 78 }; |
| OLD | NEW |