Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: third_party/qcms/src/iccread.c

Issue 1779163002: [qcms] Update primaries used to build internal sRGB profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved printfs, added comments, removed newlines Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/qcms/README.chromium ('k') | third_party/qcms/src/tests/qcms_test_internal_srgb.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* vim: set ts=8 sw=8 noexpandtab: */ 1 /* vim: set ts=8 sw=8 noexpandtab: */
2 // qcms 2 // qcms
3 // Copyright (C) 2009 Mozilla Foundation 3 // Copyright (C) 2009 Mozilla Foundation
4 // Copyright (C) 1998-2007 Marti Maria 4 // Copyright (C) 1998-2007 Marti Maria
5 // 5 //
6 // Permission is hereby granted, free of charge, to any person obtaining 6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the "Software"), 7 // a copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation 8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 profile->color_space = RGB_SIGNATURE; 1231 profile->color_space = RGB_SIGNATURE;
1232 profile->pcs = XYZ_SIGNATURE; 1232 profile->pcs = XYZ_SIGNATURE;
1233 return profile; 1233 return profile;
1234 } 1234 }
1235 1235
1236 /* from lcms: cmsWhitePointFromTemp */ 1236 /* from lcms: cmsWhitePointFromTemp */
1237 /* tempK must be >= 4000. and <= 25000. 1237 /* tempK must be >= 4000. and <= 25000.
1238 * Invalid values of tempK will return 1238 * Invalid values of tempK will return
1239 * (x,y,Y) = (-1.0, -1.0, -1.0) 1239 * (x,y,Y) = (-1.0, -1.0, -1.0)
1240 * similar to argyll: icx_DTEMP2XYZ() */ 1240 * similar to argyll: icx_DTEMP2XYZ() */
1241 static qcms_CIE_xyY white_point_from_temp(int temp_K) 1241 qcms_CIE_xyY white_point_from_temp(int temp_K)
1242 { 1242 {
1243 qcms_CIE_xyY white_point; 1243 qcms_CIE_xyY white_point;
1244 double x, y; 1244 double x, y;
1245 double T, T2, T3; 1245 double T, T2, T3;
1246 // double M1, M2; 1246 // double M1, M2;
1247 1247
1248 // No optimization provided. 1248 // No optimization provided.
1249 T = temp_K; 1249 T = temp_K;
1250 T2 = T*T; // Square 1250 T2 = T*T; // Square
1251 T3 = T2*T; // Cube 1251 T3 = T2*T; // Cube
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 white_point.Y = 1.0; 1284 white_point.Y = 1.0;
1285 1285
1286 return white_point; 1286 return white_point;
1287 } 1287 }
1288 1288
1289 qcms_profile* qcms_profile_sRGB(void) 1289 qcms_profile* qcms_profile_sRGB(void)
1290 { 1290 {
1291 qcms_profile *profile; 1291 qcms_profile *profile;
1292 uint16_t *table; 1292 uint16_t *table;
1293 1293
1294 » qcms_CIE_xyYTRIPLE Rec709Primaries = { 1294 » // Standard Illuminant D65 in XYZ coordinates, which is the standard
1295 » » {0.6400, 0.3300, 1.0}, 1295 » // sRGB IEC61966-2.1 / Rec.709 profile reference media white point.
1296 » » {0.3000, 0.6000, 1.0}, 1296 » struct XYZNumber D65 = {
1297 » » {0.1500, 0.0600, 1.0} 1297 » » 0xf351, 0x10000, 0x116cc // ( 0.950455, 1.000000, 1.089050 )
1298 }; 1298 };
1299 qcms_CIE_xyY D65;
1300 1299
1301 » D65 = white_point_from_temp(6504); 1300 » // sRGB IEC61966-2.1 / Rec.709 color profile primaries, chromatically
1301 » // adapted (via Bradford procedures) to D50 white point.
1302 » // For details, refer to crbug/580917
1303 #if 0
1304 » // lindbloom: ASTM E308-01 D50 White point.
1305 » s15Fixed16Number primaries[3][3] = {
1306 » » { 0x06fa3, 0x06294, 0x024a1 }, // ( 0.436081, 0.385071, 0.143082 )
1307 » » { 0x038f6, 0x0b785, 0x00f85 }, // ( 0.222504, 0.716873, 0.060623 )
1308 » » { 0x00391, 0x018dc, 0x0b6d4 }, // ( 0.013931, 0.097107, 0.714172 )
1309 » };
1310 #else
1311 » // ninedegreesbelow: ICC D50 White point.
1312 » s15Fixed16Number primaries[3][3] = {
1313 » » { 0x06fa0, 0x06296, 0x024a0 }, // ( 0.436035, 0.385101, 0.143066 )
1314 » » { 0x038f2, 0x0b789, 0x00f85 }, // ( 0.222443, 0.716934, 0.060623 )
1315 » » { 0x0038f, 0x018da, 0x0b6c4 }, // ( 0.013901, 0.097076, 0.713928 )
1316 » };
1317 #endif
1302 1318
1303 table = build_sRGB_gamma_table(1024); 1319 table = build_sRGB_gamma_table(1024);
1304 1320
1305 if (!table) 1321 if (!table)
1306 return NO_MEM_PROFILE; 1322 return NO_MEM_PROFILE;
1307 1323
1308 » profile = qcms_profile_create_rgb_with_table(D65, Rec709Primaries, table , 1024); 1324 » profile = qcms_profile_create();
1309 » if (profile) 1325
1310 » » strcpy(profile->description, "sRGB IEC61966-2.1"); 1326 » if (!profile) {
1327 » » free(table);
1328 » » return NO_MEM_PROFILE;
1329 » }
1330
1331 » profile->redTRC = curve_from_table(table, 1024);
1332 » profile->blueTRC = curve_from_table(table, 1024);
1333 » profile->greenTRC = curve_from_table(table, 1024);
1334
1335 » if (!profile->redTRC || !profile->blueTRC || !profile->greenTRC) {
1336 » » qcms_profile_release(profile);
1337 » » free(table);
1338 » » return NO_MEM_PROFILE;
1339 » }
1340
1341 » profile->redColorant.X = primaries[0][0];
1342 » profile->redColorant.Y = primaries[1][0];
1343 » profile->redColorant.Z = primaries[2][0];
1344
1345 » profile->greenColorant.X = primaries[0][1];
1346 » profile->greenColorant.Y = primaries[1][1];
1347 » profile->greenColorant.Z = primaries[2][1];
1348
1349 » profile->blueColorant.X = primaries[0][2];
1350 » profile->blueColorant.Y = primaries[1][2];
1351 » profile->blueColorant.Z = primaries[2][2];
1352
1353 » profile->mediaWhitePoint.X = D65.X;
1354 » profile->mediaWhitePoint.Y = D65.Y;
1355 » profile->mediaWhitePoint.Z = D65.Z;
1356
1357 » profile->class = DISPLAY_DEVICE_PROFILE;
1358 » profile->rendering_intent = QCMS_INTENT_PERCEPTUAL;
1359 » profile->color_space = RGB_SIGNATURE;
1360 » profile->pcs = XYZ_SIGNATURE;
1361
1362 » strcpy(profile->description, "sRGB IEC61966-2.1");
1311 1363
1312 free(table); 1364 free(table);
1365
1313 return profile; 1366 return profile;
1314 } 1367 }
1315 1368
1316 /* qcms_profile_from_memory does not hold a reference to the memory passed in */ 1369 /* qcms_profile_from_memory does not hold a reference to the memory passed in */
1317 qcms_profile* qcms_profile_from_memory(const void *mem, size_t size) 1370 qcms_profile* qcms_profile_from_memory(const void *mem, size_t size)
1318 { 1371 {
1319 uint32_t length; 1372 uint32_t length;
1320 struct mem_source source; 1373 struct mem_source source;
1321 struct mem_source *src = &source; 1374 struct mem_source *src = &source;
1322 struct tag_index index; 1375 struct tag_index index;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 { 1636 {
1584 qcms_profile *profile = NULL; 1637 qcms_profile *profile = NULL;
1585 FILE *file = _wfopen(path, L"rb"); 1638 FILE *file = _wfopen(path, L"rb");
1586 if (file) { 1639 if (file) {
1587 profile = qcms_profile_from_file(file); 1640 profile = qcms_profile_from_file(file);
1588 fclose(file); 1641 fclose(file);
1589 } 1642 }
1590 return profile; 1643 return profile;
1591 } 1644 }
1592 #endif 1645 #endif
OLDNEW
« no previous file with comments | « third_party/qcms/README.chromium ('k') | third_party/qcms/src/tests/qcms_test_internal_srgb.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698