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..6ca1b0dcaae7ceef550089a830142848dd684c71 100644 |
| --- a/third_party/qcms/src/iccread.c |
| +++ b/third_party/qcms/src/iccread.c |
| @@ -1203,7 +1203,7 @@ qcms_profile* qcms_profile_create_rgb_with_gamma( |
| return profile; |
| } |
| -qcms_profile* qcms_profile_create_rgb_with_table( |
| +/*unused*/ qcms_profile* qcms_profile_create_rgb_with_table( |
|
radu.velea
2016/03/10 15:08:32
I think there are a lot of unused functions that c
Noel Gordon
2016/03/11 13:53:48
This is can probably go, but in a future CL.
radu.velea
2016/03/11 14:59:58
Done.
|
| qcms_CIE_xyY white_point, |
| qcms_CIE_xyYTRIPLE primaries, |
| uint16_t *table, int num_entries) |
| @@ -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) |
| +/*unused*/ qcms_CIE_xyY white_point_from_temp(int temp_K) |
|
radu.velea
2016/03/10 15:08:32
This is an example.
Noel Gordon
2016/03/11 13:53:48
I would retain this code, not remove it, it is use
radu.velea
2016/03/11 14:59:58
OK, but removing the static keyword so it does not
|
| { |
| qcms_CIE_xyY white_point; |
| double x, y; |
| @@ -1290,26 +1290,61 @@ qcms_profile* qcms_profile_sRGB(void) |
| { |
| qcms_profile *profile; |
| uint16_t *table; |
| + int num_entries = 1024; |
| + struct XYZNumber D50 = {0xF351, 0x10000, 0x116CC}; // TODO - find actual values. |
|
Noel Gordon
2016/03/11 13:53:48
The values are correct, decoding them gives:
0x0f
radu.velea
2016/03/11 14:59:58
Done.
|
| + // D50 white point and colorant matrix for the official sRGB IEC61966-2.1 color profile. |
|
Noel Gordon
2016/03/11 13:53:48
// sRGB IEC61966-2.1 / Rec.709 color profile prima
radu.velea
2016/03/11 14:59:58
Done.
|
| + s15Fixed16Number colorants[3][3] = { |
| + {0x06fa2, 0x06299, 0x024a0}, |
| + {0x038f5, 0x0b785, 0x00f84}, |
| + {0x00390, 0x018da, 0x0b6cf}}; |
| - qcms_CIE_xyYTRIPLE Rec709Primaries = { |
| - {0.6400, 0.3300, 1.0}, |
| - {0.3000, 0.6000, 1.0}, |
| - {0.1500, 0.0600, 1.0} |
| - }; |
| - qcms_CIE_xyY D65; |
| + table = build_sRGB_gamma_table(num_entries); |
| - D65 = white_point_from_temp(6504); |
| + if (!table) |
| + return NO_MEM_PROFILE; |
| - table = build_sRGB_gamma_table(1024); |
| + profile = qcms_profile_create(); |
| - if (!table) |
| + if (!profile) { |
| + free(table); |
| + return NO_MEM_PROFILE; |
| + } |
| + |
| + profile->redTRC = curve_from_table(table, num_entries); |
| + profile->blueTRC = curve_from_table(table, num_entries); |
| + profile->greenTRC = curve_from_table(table, num_entries); |
| + |
| + if (!profile->redTRC || !profile->blueTRC || !profile->greenTRC) { |
| + free(table); |
| + qcms_profile_release(profile); |
| return NO_MEM_PROFILE; |
| + } |
| + |
| + profile->redColorant.X = colorants[0][0]; |
|
Noel Gordon
2016/03/11 13:53:48
colorants -> primaries
radu.velea
2016/03/11 14:59:58
Done.
|
| + profile->redColorant.Y = colorants[1][0]; |
| + profile->redColorant.Z = colorants[2][0]; |
| + |
| + profile->greenColorant.X = colorants[0][1]; |
| + profile->greenColorant.Y = colorants[1][1]; |
| + profile->greenColorant.Z = colorants[2][1]; |
| + |
| + profile->blueColorant.X = colorants[0][2]; |
| + profile->blueColorant.Y = colorants[1][2]; |
| + profile->blueColorant.Z = colorants[2][2]; |
| + |
| + profile->mediaWhitePoint.X = D50.X; |
| + profile->mediaWhitePoint.Y = D50.Y; |
| + profile->mediaWhitePoint.Z = D50.Z; |
| - profile = qcms_profile_create_rgb_with_table(D65, Rec709Primaries, table, 1024); |
| - if (profile) |
| - strcpy(profile->description, "sRGB IEC61966-2.1"); |
| + 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; |
| } |