Chromium Code Reviews| Index: third_party/qcms/src/iccread.c |
| diff --git a/third_party/qcms/src/iccread.c b/third_party/qcms/src/iccread.c |
| index 1b6aaf680db812691831b2b0795277fc5b39bf8d..6152c8a5d7d143a98e67d991fdfbc30f25760957 100644 |
| --- a/third_party/qcms/src/iccread.c |
| +++ b/third_party/qcms/src/iccread.c |
| @@ -1238,7 +1238,7 @@ qcms_profile* qcms_profile_create_rgb_with_table( |
| * Invalid values of tempK will return |
| * (x,y,Y) = (-1.0, -1.0, -1.0) |
| * similar to argyll: icx_DTEMP2XYZ() */ |
| -static qcms_CIE_xyY white_point_from_temp(int temp_K) |
| +qcms_CIE_xyY white_point_from_temp(int temp_K) |
| { |
| qcms_CIE_xyY white_point; |
| double x, y; |
| @@ -1291,25 +1291,67 @@ qcms_profile* qcms_profile_sRGB(void) |
| qcms_profile *profile; |
| uint16_t *table; |
| - qcms_CIE_xyYTRIPLE Rec709Primaries = { |
| - {0.6400, 0.3300, 1.0}, |
| - {0.3000, 0.6000, 1.0}, |
| - {0.1500, 0.0600, 1.0} |
| + // Standard Illuminant D65 in XYZ coordinates, which is the standard |
| + // sRGB IEC61966-2.1 / Rec.709 profile reference media white point. |
| + 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.
|
| }; |
| - qcms_CIE_xyY D65; |
| - D65 = white_point_from_temp(6504); |
| + // sRGB IEC61966-2.1 / Rec.709 color profile primaries, chromatically |
| + // adapted (via Bradford procedures) to the ICC PCS white point, D50. |
| + s15Fixed16Number primaries[3][3] = { |
| + { 0x06fa2, 0x06299, 0x024a0 }, // ( 0.436066, 0.385147, 0.143066 ) |
|
Noel Gordon
2016/03/11 15:45:08
1303-1304 ditto, one tab too many.
radu.velea
2016/03/11 15:55:21
Done.
|
| + { 0x038f5, 0x0b785, 0x00f84 }, // ( 0.222488, 0.716873, 0.060608 ) |
| + { 0x00390, 0x018da, 0x0b6cf }, // ( 0.013916, 0.097076, 0.714096 ) |
| + }; |
| table = build_sRGB_gamma_table(1024); |
| if (!table) |
| return NO_MEM_PROFILE; |
| - profile = qcms_profile_create_rgb_with_table(D65, Rec709Primaries, table, 1024); |
| - if (profile) |
| - strcpy(profile->description, "sRGB IEC61966-2.1"); |
| + profile = qcms_profile_create(); |
| + |
| + if (!profile) { |
| + free(table); |
| + return NO_MEM_PROFILE; |
| + } |
| + |
| + profile->redTRC = curve_from_table(table, 1024); |
| + profile->blueTRC = curve_from_table(table, 1024); |
| + profile->greenTRC = curve_from_table(table, 1024); |
| + |
| + if (!profile->redTRC || !profile->blueTRC || !profile->greenTRC) { |
| + free(table); |
| + qcms_profile_release(profile); |
| + return NO_MEM_PROFILE; |
| + } |
| + |
| + profile->redColorant.X = primaries[0][0]; |
| + profile->redColorant.Y = primaries[1][0]; |
| + profile->redColorant.Z = primaries[2][0]; |
| + |
| + profile->greenColorant.X = primaries[0][1]; |
| + profile->greenColorant.Y = primaries[1][1]; |
| + profile->greenColorant.Z = primaries[2][1]; |
| + |
| + profile->blueColorant.X = primaries[0][2]; |
| + profile->blueColorant.Y = primaries[1][2]; |
| + profile->blueColorant.Z = primaries[2][2]; |
| + |
| + profile->mediaWhitePoint.X = D65.X; |
| + profile->mediaWhitePoint.Y = D65.Y; |
| + profile->mediaWhitePoint.Z = D65.Z; |
| + |
| + profile->class = DISPLAY_DEVICE_PROFILE; |
| + profile->rendering_intent = QCMS_INTENT_PERCEPTUAL; |
| + profile->color_space = RGB_SIGNATURE; |
| + profile->pcs = XYZ_SIGNATURE; |
| + |
| + strcpy(profile->description, "sRGB IEC61966-2.1"); |
| free(table); |
| + |
| return profile; |
| } |