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

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

Issue 1155033003: [qcms] Add matrix transform flag and matrix extraction api (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use get_matrix in the api name. Created 5 years, 6 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/src/qcmsint.h ('k') | no next file » | 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 Corporation 3 // Copyright (C) 2009 Mozilla Corporation
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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 transform->matrix[0][0] = result.m[0][0]; 1358 transform->matrix[0][0] = result.m[0][0];
1359 transform->matrix[1][0] = result.m[0][1]; 1359 transform->matrix[1][0] = result.m[0][1];
1360 transform->matrix[2][0] = result.m[0][2]; 1360 transform->matrix[2][0] = result.m[0][2];
1361 transform->matrix[0][1] = result.m[1][0]; 1361 transform->matrix[0][1] = result.m[1][0];
1362 transform->matrix[1][1] = result.m[1][1]; 1362 transform->matrix[1][1] = result.m[1][1];
1363 transform->matrix[2][1] = result.m[1][2]; 1363 transform->matrix[2][1] = result.m[1][2];
1364 transform->matrix[0][2] = result.m[2][0]; 1364 transform->matrix[0][2] = result.m[2][0];
1365 transform->matrix[1][2] = result.m[2][1]; 1365 transform->matrix[1][2] = result.m[2][1];
1366 transform->matrix[2][2] = result.m[2][2]; 1366 transform->matrix[2][2] = result.m[2][2];
1367 1367
1368 /* Flag transform as matrix. */
1369 transform->transform_flags |= TRANSFORM_FLAG_MATRIX;
Stephen White 2015/05/27 17:17:49 Does transform_flags need to be initialized to zer
Noel Gordon 2015/05/27 17:42:56 calloc-ed as you noted, that's the normal case for
1370
1368 } else if (in->color_space == GRAY_SIGNATURE) { 1371 } else if (in->color_space == GRAY_SIGNATURE) {
1369 if (in_type != QCMS_DATA_GRAY_8 && 1372 if (in_type != QCMS_DATA_GRAY_8 &&
1370 in_type != QCMS_DATA_GRAYA_8){ 1373 in_type != QCMS_DATA_GRAYA_8){
1371 assert(0 && "input type"); 1374 assert(0 && "input type");
1372 transform_free(transform); 1375 transform_free(transform);
1373 return NULL; 1376 return NULL;
1374 } 1377 }
1375 1378
1376 transform->input_gamma_table_gray = build_input_gamma_table(in-> grayTRC); 1379 transform->input_gamma_table_gray = build_input_gamma_table(in-> grayTRC);
1377 if (!transform->input_gamma_table_gray) { 1380 if (!transform->input_gamma_table_gray) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 1427
1425 void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest, size_t length, qcms_output_type type) 1428 void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest, size_t length, qcms_output_type type)
1426 { 1429 {
1427 static const struct _qcms_format_type output_rgbx = { 0, 2 }; 1430 static const struct _qcms_format_type output_rgbx = { 0, 2 };
1428 static const struct _qcms_format_type output_bgrx = { 2, 0 }; 1431 static const struct _qcms_format_type output_bgrx = { 2, 0 };
1429 1432
1430 transform->transform_fn(transform, src, dest, length, type == QCMS_OUTPU T_BGRX ? output_bgrx : output_rgbx); 1433 transform->transform_fn(transform, src, dest, length, type == QCMS_OUTPU T_BGRX ? output_bgrx : output_rgbx);
1431 } 1434 }
1432 1435
1433 qcms_bool qcms_supports_iccv4; 1436 qcms_bool qcms_supports_iccv4;
1437
1434 void qcms_enable_iccv4() 1438 void qcms_enable_iccv4()
1435 { 1439 {
1436 qcms_supports_iccv4 = true; 1440 qcms_supports_iccv4 = true;
1437 } 1441 }
1442
1443 static inline qcms_bool transform_is_matrix(qcms_transform *t)
1444 {
1445 return (t->transform_flags & TRANSFORM_FLAG_MATRIX) ? true : false;
1446 }
1447
1448 qcms_bool qcms_transform_is_matrix(qcms_transform *t)
1449 {
1450 return transform_is_matrix(t);
1451 }
1452
1453 float qcms_transform_get_matrix(qcms_transform *t, int i, int j)
robert.bradford 2015/05/27 16:03:27 Perhaps call it _matrix_value - in case in the fut
robert.bradford 2015/05/27 16:03:27 unsigned int or size_t?
Noel Gordon 2015/05/27 17:21:55 The i, j kinda does that for me too. Let's leave
Noel Gordon 2015/05/27 17:21:55 Yes, made it unsigned.
1454 {
1455 assert(transform_is_matrix(t));
1456
1457 // Return transform matrix elements in row major order (permute i and j)
1458
1459 return t->matrix[j][i];
robert.bradford 2015/05/27 16:03:27 Should we be doing bounds checks on array derefere
Noel Gordon 2015/05/27 17:21:55 Done.
1460 }
OLDNEW
« no previous file with comments | « third_party/qcms/src/qcmsint.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698