OLD | NEW |
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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 g = out_linear_g * PRECACHE_OUTPUT_MAX; | 404 g = out_linear_g * PRECACHE_OUTPUT_MAX; |
405 b = out_linear_b * PRECACHE_OUTPUT_MAX; | 405 b = out_linear_b * PRECACHE_OUTPUT_MAX; |
406 | 406 |
407 *dest++ = transform->output_table_r->data[r]; | 407 *dest++ = transform->output_table_r->data[r]; |
408 *dest++ = transform->output_table_g->data[g]; | 408 *dest++ = transform->output_table_g->data[g]; |
409 *dest++ = transform->output_table_b->data[b]; | 409 *dest++ = transform->output_table_b->data[b]; |
410 *dest++ = alpha; | 410 *dest++ = alpha; |
411 } | 411 } |
412 } | 412 } |
413 | 413 |
| 414 static void qcms_transform_data_bgra_out_lut_precache(qcms_transform *transform,
unsigned char *src, unsigned char *dest, size_t length) |
| 415 { |
| 416 unsigned int i; |
| 417 float (*mat)[4] = transform->matrix; |
| 418 for (i = 0; i < length; i++) { |
| 419 unsigned char device_b = *src++; |
| 420 unsigned char device_g = *src++; |
| 421 unsigned char device_r = *src++; |
| 422 unsigned char alpha = *src++; |
| 423 uint16_t r, g, b; |
| 424 |
| 425 float linear_r = transform->input_gamma_table_r[device_r]; |
| 426 float linear_g = transform->input_gamma_table_g[device_g]; |
| 427 float linear_b = transform->input_gamma_table_b[device_b]; |
| 428 |
| 429 float out_linear_r = mat[0][0]*linear_r + mat[1][0]*linear_g + m
at[2][0]*linear_b; |
| 430 float out_linear_g = mat[0][1]*linear_r + mat[1][1]*linear_g + m
at[2][1]*linear_b; |
| 431 float out_linear_b = mat[0][2]*linear_r + mat[1][2]*linear_g + m
at[2][2]*linear_b; |
| 432 |
| 433 out_linear_r = clamp_float(out_linear_r); |
| 434 out_linear_g = clamp_float(out_linear_g); |
| 435 out_linear_b = clamp_float(out_linear_b); |
| 436 |
| 437 /* we could round here... */ |
| 438 r = out_linear_r * PRECACHE_OUTPUT_MAX; |
| 439 g = out_linear_g * PRECACHE_OUTPUT_MAX; |
| 440 b = out_linear_b * PRECACHE_OUTPUT_MAX; |
| 441 |
| 442 *dest++ = transform->output_table_b->data[b]; |
| 443 *dest++ = transform->output_table_g->data[g]; |
| 444 *dest++ = transform->output_table_r->data[r]; |
| 445 *dest++ = alpha; |
| 446 } |
| 447 } |
| 448 |
414 // Not used | 449 // Not used |
415 /* | 450 /* |
416 static void qcms_transform_data_clut(qcms_transform *transform, unsigned char *s
rc, unsigned char *dest, size_t length) { | 451 static void qcms_transform_data_clut(qcms_transform *transform, unsigned char *s
rc, unsigned char *dest, size_t length) { |
417 unsigned int i; | 452 unsigned int i; |
418 int xy_len = 1; | 453 int xy_len = 1; |
419 int x_len = transform->grid_size; | 454 int x_len = transform->grid_size; |
420 int len = x_len * x_len; | 455 int len = x_len * x_len; |
421 float* r_table = transform->r_clut; | 456 float* r_table = transform->r_clut; |
422 float* g_table = transform->g_clut; | 457 float* g_table = transform->g_clut; |
423 float* b_table = transform->b_clut; | 458 float* b_table = transform->b_clut; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 clut_g = c0_g + c1_g*rx + c2_g*ry + c3_g*rz; | 612 clut_g = c0_g + c1_g*rx + c2_g*ry + c3_g*rz; |
578 clut_b = c0_b + c1_b*rx + c2_b*ry + c3_b*rz; | 613 clut_b = c0_b + c1_b*rx + c2_b*ry + c3_b*rz; |
579 | 614 |
580 *dest++ = clamp_u8(clut_r*255.0f); | 615 *dest++ = clamp_u8(clut_r*255.0f); |
581 *dest++ = clamp_u8(clut_g*255.0f); | 616 *dest++ = clamp_u8(clut_g*255.0f); |
582 *dest++ = clamp_u8(clut_b*255.0f); | 617 *dest++ = clamp_u8(clut_b*255.0f); |
583 *dest++ = in_a; | 618 *dest++ = in_a; |
584 } | 619 } |
585 } | 620 } |
586 | 621 |
| 622 // Using lcms' tetra interpolation algorithm. |
| 623 static void qcms_transform_data_tetra_clut_bgra(qcms_transform *transform, unsig
ned char *src, unsigned char *dest, size_t length) { |
| 624 unsigned int i; |
| 625 int xy_len = 1; |
| 626 int x_len = transform->grid_size; |
| 627 int len = x_len * x_len; |
| 628 float* r_table = transform->r_clut; |
| 629 float* g_table = transform->g_clut; |
| 630 float* b_table = transform->b_clut; |
| 631 float c0_r, c1_r, c2_r, c3_r; |
| 632 float c0_g, c1_g, c2_g, c3_g; |
| 633 float c0_b, c1_b, c2_b, c3_b; |
| 634 float clut_r, clut_g, clut_b; |
| 635 for (i = 0; i < length; i++) { |
| 636 unsigned char in_b = *src++; |
| 637 unsigned char in_g = *src++; |
| 638 unsigned char in_r = *src++; |
| 639 unsigned char in_a = *src++; |
| 640 float linear_r = in_r/255.0f, linear_g=in_g/255.0f, linear_b = i
n_b/255.0f; |
| 641 |
| 642 int x = floor(linear_r * (transform->grid_size-1)); |
| 643 int y = floor(linear_g * (transform->grid_size-1)); |
| 644 int z = floor(linear_b * (transform->grid_size-1)); |
| 645 int x_n = ceil(linear_r * (transform->grid_size-1)); |
| 646 int y_n = ceil(linear_g * (transform->grid_size-1)); |
| 647 int z_n = ceil(linear_b * (transform->grid_size-1)); |
| 648 float rx = linear_r * (transform->grid_size-1) - x; |
| 649 float ry = linear_g * (transform->grid_size-1) - y; |
| 650 float rz = linear_b * (transform->grid_size-1) - z; |
| 651 |
| 652 c0_r = CLU(r_table, x, y, z); |
| 653 c0_g = CLU(g_table, x, y, z); |
| 654 c0_b = CLU(b_table, x, y, z); |
| 655 |
| 656 if( rx >= ry ) { |
| 657 if (ry >= rz) { //rx >= ry && ry >= rz |
| 658 c1_r = CLU(r_table, x_n, y, z) - c0_r; |
| 659 c2_r = CLU(r_table, x_n, y_n, z) - CLU(r_table,
x_n, y, z); |
| 660 c3_r = CLU(r_table, x_n, y_n, z_n) - CLU(r_table
, x_n, y_n, z); |
| 661 c1_g = CLU(g_table, x_n, y, z) - c0_g; |
| 662 c2_g = CLU(g_table, x_n, y_n, z) - CLU(g_table,
x_n, y, z); |
| 663 c3_g = CLU(g_table, x_n, y_n, z_n) - CLU(g_table
, x_n, y_n, z); |
| 664 c1_b = CLU(b_table, x_n, y, z) - c0_b; |
| 665 c2_b = CLU(b_table, x_n, y_n, z) - CLU(b_table,
x_n, y, z); |
| 666 c3_b = CLU(b_table, x_n, y_n, z_n) - CLU(b_table
, x_n, y_n, z); |
| 667 } else { |
| 668 if (rx >= rz) { //rx >= rz && rz >= ry |
| 669 c1_r = CLU(r_table, x_n, y, z) - c0_r; |
| 670 c2_r = CLU(r_table, x_n, y_n, z_n) - CLU
(r_table, x_n, y, z_n); |
| 671 c3_r = CLU(r_table, x_n, y, z_n) - CLU(r
_table, x_n, y, z); |
| 672 c1_g = CLU(g_table, x_n, y, z) - c0_g; |
| 673 c2_g = CLU(g_table, x_n, y_n, z_n) - CLU
(g_table, x_n, y, z_n); |
| 674 c3_g = CLU(g_table, x_n, y, z_n) - CLU(g
_table, x_n, y, z); |
| 675 c1_b = CLU(b_table, x_n, y, z) - c0_b; |
| 676 c2_b = CLU(b_table, x_n, y_n, z_n) - CLU
(b_table, x_n, y, z_n); |
| 677 c3_b = CLU(b_table, x_n, y, z_n) - CLU(b
_table, x_n, y, z); |
| 678 } else { //rz > rx && rx >= ry |
| 679 c1_r = CLU(r_table, x_n, y, z_n) - CLU(r
_table, x, y, z_n); |
| 680 c2_r = CLU(r_table, x_n, y_n, z_n) - CLU
(r_table, x_n, y, z_n); |
| 681 c3_r = CLU(r_table, x, y, z_n) - c0_r; |
| 682 c1_g = CLU(g_table, x_n, y, z_n) - CLU(g
_table, x, y, z_n); |
| 683 c2_g = CLU(g_table, x_n, y_n, z_n) - CLU
(g_table, x_n, y, z_n); |
| 684 c3_g = CLU(g_table, x, y, z_n) - c0_g; |
| 685 c1_b = CLU(b_table, x_n, y, z_n) - CLU(b
_table, x, y, z_n); |
| 686 c2_b = CLU(b_table, x_n, y_n, z_n) - CLU
(b_table, x_n, y, z_n); |
| 687 c3_b = CLU(b_table, x, y, z_n) - c0_b; |
| 688 } |
| 689 } |
| 690 } else { |
| 691 if (rx >= rz) { //ry > rx && rx >= rz |
| 692 c1_r = CLU(r_table, x_n, y_n, z) - CLU(r_table,
x, y_n, z); |
| 693 c2_r = CLU(r_table, x, y_n, z) - c0_r; |
| 694 c3_r = CLU(r_table, x_n, y_n, z_n) - CLU(r_table
, x_n, y_n, z); |
| 695 c1_g = CLU(g_table, x_n, y_n, z) - CLU(g_table,
x, y_n, z); |
| 696 c2_g = CLU(g_table, x, y_n, z) - c0_g; |
| 697 c3_g = CLU(g_table, x_n, y_n, z_n) - CLU(g_table
, x_n, y_n, z); |
| 698 c1_b = CLU(b_table, x_n, y_n, z) - CLU(b_table,
x, y_n, z); |
| 699 c2_b = CLU(b_table, x, y_n, z) - c0_b; |
| 700 c3_b = CLU(b_table, x_n, y_n, z_n) - CLU(b_table
, x_n, y_n, z); |
| 701 } else { |
| 702 if (ry >= rz) { //ry >= rz && rz > rx |
| 703 c1_r = CLU(r_table, x_n, y_n, z_n) - CLU
(r_table, x, y_n, z_n); |
| 704 c2_r = CLU(r_table, x, y_n, z) - c0_r; |
| 705 c3_r = CLU(r_table, x, y_n, z_n) - CLU(r
_table, x, y_n, z); |
| 706 c1_g = CLU(g_table, x_n, y_n, z_n) - CLU
(g_table, x, y_n, z_n); |
| 707 c2_g = CLU(g_table, x, y_n, z) - c0_g; |
| 708 c3_g = CLU(g_table, x, y_n, z_n) - CLU(g
_table, x, y_n, z); |
| 709 c1_b = CLU(b_table, x_n, y_n, z_n) - CLU
(b_table, x, y_n, z_n); |
| 710 c2_b = CLU(b_table, x, y_n, z) - c0_b; |
| 711 c3_b = CLU(b_table, x, y_n, z_n) - CLU(b
_table, x, y_n, z); |
| 712 } else { //rz > ry && ry > rx |
| 713 c1_r = CLU(r_table, x_n, y_n, z_n) - CLU
(r_table, x, y_n, z_n); |
| 714 c2_r = CLU(r_table, x, y_n, z_n) - CLU(r
_table, x, y, z_n); |
| 715 c3_r = CLU(r_table, x, y, z_n) - c0_r; |
| 716 c1_g = CLU(g_table, x_n, y_n, z_n) - CLU
(g_table, x, y_n, z_n); |
| 717 c2_g = CLU(g_table, x, y_n, z_n) - CLU(g
_table, x, y, z_n); |
| 718 c3_g = CLU(g_table, x, y, z_n) - c0_g; |
| 719 c1_b = CLU(b_table, x_n, y_n, z_n) - CLU
(b_table, x, y_n, z_n); |
| 720 c2_b = CLU(b_table, x, y_n, z_n) - CLU(b
_table, x, y, z_n); |
| 721 c3_b = CLU(b_table, x, y, z_n) - c0_b; |
| 722 } |
| 723 } |
| 724 } |
| 725 |
| 726 clut_r = c0_r + c1_r*rx + c2_r*ry + c3_r*rz; |
| 727 clut_g = c0_g + c1_g*rx + c2_g*ry + c3_g*rz; |
| 728 clut_b = c0_b + c1_b*rx + c2_b*ry + c3_b*rz; |
| 729 |
| 730 *dest++ = clamp_u8(clut_b*255.0f); |
| 731 *dest++ = clamp_u8(clut_g*255.0f); |
| 732 *dest++ = clamp_u8(clut_r*255.0f); |
| 733 *dest++ = in_a; |
| 734 } |
| 735 } |
| 736 |
587 // Using lcms' tetra interpolation code. | 737 // Using lcms' tetra interpolation code. |
588 static void qcms_transform_data_tetra_clut(qcms_transform *transform, unsigned c
har *src, unsigned char *dest, size_t length) { | 738 static void qcms_transform_data_tetra_clut(qcms_transform *transform, unsigned c
har *src, unsigned char *dest, size_t length) { |
589 unsigned int i; | 739 unsigned int i; |
590 int xy_len = 1; | 740 int xy_len = 1; |
591 int x_len = transform->grid_size; | 741 int x_len = transform->grid_size; |
592 int len = x_len * x_len; | 742 int len = x_len * x_len; |
593 float* r_table = transform->r_clut; | 743 float* r_table = transform->r_clut; |
594 float* g_table = transform->g_clut; | 744 float* g_table = transform->g_clut; |
595 float* b_table = transform->b_clut; | 745 float* b_table = transform->b_clut; |
596 float c0_r, c1_r, c2_r, c3_r; | 746 float c0_r, c1_r, c2_r, c3_r; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 out_device_b = lut_interp_linear(out_linear_b, | 912 out_device_b = lut_interp_linear(out_linear_b, |
763 transform->output_gamma_lut_b, transform->output
_gamma_lut_b_length); | 913 transform->output_gamma_lut_b, transform->output
_gamma_lut_b_length); |
764 | 914 |
765 *dest++ = clamp_u8(out_device_r*255); | 915 *dest++ = clamp_u8(out_device_r*255); |
766 *dest++ = clamp_u8(out_device_g*255); | 916 *dest++ = clamp_u8(out_device_g*255); |
767 *dest++ = clamp_u8(out_device_b*255); | 917 *dest++ = clamp_u8(out_device_b*255); |
768 *dest++ = alpha; | 918 *dest++ = alpha; |
769 } | 919 } |
770 } | 920 } |
771 | 921 |
| 922 static void qcms_transform_data_bgra_out_lut(qcms_transform *transform, unsigned
char *src, unsigned char *dest, size_t length) |
| 923 { |
| 924 unsigned int i; |
| 925 float (*mat)[4] = transform->matrix; |
| 926 for (i = 0; i < length; i++) { |
| 927 unsigned char device_b = *src++; |
| 928 unsigned char device_g = *src++; |
| 929 unsigned char device_r = *src++; |
| 930 unsigned char alpha = *src++; |
| 931 float out_device_r, out_device_g, out_device_b; |
| 932 |
| 933 float linear_r = transform->input_gamma_table_r[device_r]; |
| 934 float linear_g = transform->input_gamma_table_g[device_g]; |
| 935 float linear_b = transform->input_gamma_table_b[device_b]; |
| 936 |
| 937 float out_linear_r = mat[0][0]*linear_r + mat[1][0]*linear_g + m
at[2][0]*linear_b; |
| 938 float out_linear_g = mat[0][1]*linear_r + mat[1][1]*linear_g + m
at[2][1]*linear_b; |
| 939 float out_linear_b = mat[0][2]*linear_r + mat[1][2]*linear_g + m
at[2][2]*linear_b; |
| 940 |
| 941 out_linear_r = clamp_float(out_linear_r); |
| 942 out_linear_g = clamp_float(out_linear_g); |
| 943 out_linear_b = clamp_float(out_linear_b); |
| 944 |
| 945 out_device_r = lut_interp_linear(out_linear_r, |
| 946 transform->output_gamma_lut_r, transform->output
_gamma_lut_r_length); |
| 947 out_device_g = lut_interp_linear(out_linear_g, |
| 948 transform->output_gamma_lut_g, transform->output
_gamma_lut_g_length); |
| 949 out_device_b = lut_interp_linear(out_linear_b, |
| 950 transform->output_gamma_lut_b, transform->output
_gamma_lut_b_length); |
| 951 |
| 952 *dest++ = clamp_u8(out_device_b*255); |
| 953 *dest++ = clamp_u8(out_device_g*255); |
| 954 *dest++ = clamp_u8(out_device_r*255); |
| 955 *dest++ = alpha; |
| 956 } |
| 957 } |
| 958 |
772 #if 0 | 959 #if 0 |
773 static void qcms_transform_data_rgb_out_linear(qcms_transform *transform, unsign
ed char *src, unsigned char *dest, size_t length) | 960 static void qcms_transform_data_rgb_out_linear(qcms_transform *transform, unsign
ed char *src, unsigned char *dest, size_t length) |
774 { | 961 { |
775 int i; | 962 int i; |
776 float (*mat)[4] = transform->matrix; | 963 float (*mat)[4] = transform->matrix; |
777 for (i = 0; i < length; i++) { | 964 for (i = 0; i < length; i++) { |
778 unsigned char device_r = *src++; | 965 unsigned char device_r = *src++; |
779 unsigned char device_g = *src++; | 966 unsigned char device_g = *src++; |
780 unsigned char device_b = *src++; | 967 unsigned char device_b = *src++; |
781 | 968 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 } | 1248 } |
1062 | 1249 |
1063 lut = qcms_chain_transform(in, out, src, dest, lutSize); | 1250 lut = qcms_chain_transform(in, out, src, dest, lutSize); |
1064 if (lut) { | 1251 if (lut) { |
1065 transform->r_clut = &lut[0]; | 1252 transform->r_clut = &lut[0]; |
1066 transform->g_clut = &lut[1]; | 1253 transform->g_clut = &lut[1]; |
1067 transform->b_clut = &lut[2]; | 1254 transform->b_clut = &lut[2]; |
1068 transform->grid_size = samples; | 1255 transform->grid_size = samples; |
1069 if (in_type == QCMS_DATA_RGBA_8) { | 1256 if (in_type == QCMS_DATA_RGBA_8) { |
1070 transform->transform_fn = qcms_transform_data_te
tra_clut_rgba; | 1257 transform->transform_fn = qcms_transform_data_te
tra_clut_rgba; |
| 1258 } else if (in_type == QCMS_DATA_BGRA_8) { |
| 1259 transform->transform_fn = qcms_transform_data_te
tra_clut_bgra; |
1071 } else { | 1260 } else { |
1072 transform->transform_fn = qcms_transform_data_te
tra_clut; | 1261 transform->transform_fn = qcms_transform_data_te
tra_clut; |
1073 } | 1262 } |
1074 } | 1263 } |
1075 } | 1264 } |
1076 | 1265 |
1077 | 1266 |
1078 //XXX: qcms_modular_transform_data may return either the src or dest buf
fer. If so it must not be free-ed | 1267 //XXX: qcms_modular_transform_data may return either the src or dest buf
fer. If so it must not be free-ed |
1079 if (src && lut != src) { | 1268 if (src && lut != src) { |
1080 free(src); | 1269 free(src); |
(...skipping 14 matching lines...) Expand all Loading... |
1095 qcms_profile *out, qcms_data_type out_type, | 1284 qcms_profile *out, qcms_data_type out_type, |
1096 qcms_intent intent) | 1285 qcms_intent intent) |
1097 { | 1286 { |
1098 bool precache = false; | 1287 bool precache = false; |
1099 | 1288 |
1100 qcms_transform *transform = transform_alloc(); | 1289 qcms_transform *transform = transform_alloc(); |
1101 if (!transform) { | 1290 if (!transform) { |
1102 return NULL; | 1291 return NULL; |
1103 } | 1292 } |
1104 if (out_type != QCMS_DATA_RGB_8 && | 1293 if (out_type != QCMS_DATA_RGB_8 && |
1105 out_type != QCMS_DATA_RGBA_8) { | 1294 out_type != QCMS_DATA_RGBA_8 && |
| 1295 out_type != QCMS_DATA_BGRA_8) { |
1106 assert(0 && "output type"); | 1296 assert(0 && "output type"); |
1107 transform_free(transform); | 1297 transform_free(transform); |
1108 return NULL; | 1298 return NULL; |
1109 } | 1299 } |
1110 | 1300 |
1111 if (out->output_table_r && | 1301 if (out->output_table_r && |
1112 out->output_table_g && | 1302 out->output_table_g && |
1113 out->output_table_b) { | 1303 out->output_table_b) { |
1114 precache = true; | 1304 precache = true; |
1115 } | 1305 } |
(...skipping 28 matching lines...) Expand all Loading... |
1144 if (!transform->output_gamma_lut_r || !transform->output_gamma_l
ut_g || !transform->output_gamma_lut_b) { | 1334 if (!transform->output_gamma_lut_r || !transform->output_gamma_l
ut_g || !transform->output_gamma_lut_b) { |
1145 qcms_transform_release(transform); | 1335 qcms_transform_release(transform); |
1146 return NO_MEM_TRANSFORM; | 1336 return NO_MEM_TRANSFORM; |
1147 } | 1337 } |
1148 } | 1338 } |
1149 | 1339 |
1150 if (in->color_space == RGB_SIGNATURE) { | 1340 if (in->color_space == RGB_SIGNATURE) { |
1151 struct matrix in_matrix, out_matrix, result; | 1341 struct matrix in_matrix, out_matrix, result; |
1152 | 1342 |
1153 if (in_type != QCMS_DATA_RGB_8 && | 1343 if (in_type != QCMS_DATA_RGB_8 && |
1154 in_type != QCMS_DATA_RGBA_8){ | 1344 in_type != QCMS_DATA_RGBA_8 && |
| 1345 in_type != QCMS_DATA_BGRA_8){ |
1155 assert(0 && "input type"); | 1346 assert(0 && "input type"); |
1156 transform_free(transform); | 1347 transform_free(transform); |
1157 return NULL; | 1348 return NULL; |
1158 } | 1349 } |
1159 if (precache) { | 1350 if (precache) { |
1160 #ifdef X86 | 1351 #ifdef X86 |
1161 if (sse_version_available() >= 2) { | 1352 if (sse_version_available() >= 2) { |
1162 if (in_type == QCMS_DATA_RGB_8) | 1353 if (in_type == QCMS_DATA_RGB_8) |
1163 transform->transform_fn = qcms_transform_dat
a_rgb_out_lut_sse2; | 1354 transform->transform_fn = qcms_transform_dat
a_rgb_out_lut_sse2; |
| 1355 else if (in_type == QCMS_DATA_BGRA_8) |
| 1356 transform->transform_fn = qcms_transform_dat
a_bgra_out_lut_sse2; |
1164 else | 1357 else |
1165 transform->transform_fn = qcms_transform_dat
a_rgba_out_lut_sse2; | 1358 transform->transform_fn = qcms_transform_dat
a_rgba_out_lut_sse2; |
1166 | 1359 |
1167 #if !(defined(_MSC_VER) && defined(_M_AMD64)) | 1360 #if !(defined(_MSC_VER) && defined(_M_AMD64)) |
1168 /* Microsoft Compiler for x64 doesn't support MMX. | 1361 /* Microsoft Compiler for x64 doesn't support MMX. |
1169 * SSE code uses MMX so that we disable on x64 */ | 1362 * SSE code uses MMX so that we disable on x64 */ |
1170 } else | 1363 } else |
1171 if (sse_version_available() >= 1) { | 1364 if (sse_version_available() >= 1) { |
1172 if (in_type == QCMS_DATA_RGB_8) | 1365 if (in_type == QCMS_DATA_RGB_8) |
1173 transform->transform_fn = qcms_transform_dat
a_rgb_out_lut_sse1; | 1366 transform->transform_fn = qcms_transform_dat
a_rgb_out_lut_sse1; |
| 1367 else if (in_type == QCMS_DATA_BGRA_8) |
| 1368 transform->transform_fn = qcms_transform_dat
a_bgra_out_lut_sse1; |
1174 else | 1369 else |
1175 transform->transform_fn = qcms_transform_dat
a_rgba_out_lut_sse1; | 1370 transform->transform_fn = qcms_transform_dat
a_rgba_out_lut_sse1; |
1176 #endif | 1371 #endif |
1177 } else | 1372 } else |
1178 #endif | 1373 #endif |
1179 { | 1374 { |
1180 if (in_type == QCMS_DATA_RGB_8) | 1375 if (in_type == QCMS_DATA_RGB_8) |
1181 transform->transform_fn = qcms_transform
_data_rgb_out_lut_precache; | 1376 transform->transform_fn = qcms_transform
_data_rgb_out_lut_precache; |
| 1377 else if (in_type == QCMS_DATA_BGRA_8) |
| 1378 transform->transform_fn = qcms_transform
_data_bgra_out_lut_precache; |
1182 else | 1379 else |
1183 transform->transform_fn = qcms_transform
_data_rgba_out_lut_precache; | 1380 transform->transform_fn = qcms_transform
_data_rgba_out_lut_precache; |
1184 } | 1381 } |
1185 } else { | 1382 } else { |
1186 if (in_type == QCMS_DATA_RGB_8) | 1383 if (in_type == QCMS_DATA_RGB_8) |
1187 transform->transform_fn = qcms_transform_data_rg
b_out_lut; | 1384 transform->transform_fn = qcms_transform_data_rg
b_out_lut; |
| 1385 else if (in_type == QCMS_DATA_BGRA_8) |
| 1386 transform->transform_fn = qcms_transform_data_bg
ra_out_lut; |
1188 else | 1387 else |
1189 transform->transform_fn = qcms_transform_data_rg
ba_out_lut; | 1388 transform->transform_fn = qcms_transform_data_rg
ba_out_lut; |
1190 } | 1389 } |
1191 | 1390 |
1192 //XXX: avoid duplicating tables if we can | 1391 //XXX: avoid duplicating tables if we can |
1193 transform->input_gamma_table_r = build_input_gamma_table(in->red
TRC); | 1392 transform->input_gamma_table_r = build_input_gamma_table(in->red
TRC); |
1194 transform->input_gamma_table_g = build_input_gamma_table(in->gre
enTRC); | 1393 transform->input_gamma_table_g = build_input_gamma_table(in->gre
enTRC); |
1195 transform->input_gamma_table_b = build_input_gamma_table(in->blu
eTRC); | 1394 transform->input_gamma_table_b = build_input_gamma_table(in->blu
eTRC); |
1196 if (!transform->input_gamma_table_r || !transform->input_gamma_t
able_g || !transform->input_gamma_table_b) { | 1395 if (!transform->input_gamma_table_r || !transform->input_gamma_t
able_g || !transform->input_gamma_table_b) { |
1197 qcms_transform_release(transform); | 1396 qcms_transform_release(transform); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_
t length) | 1462 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_
t length) |
1264 { | 1463 { |
1265 transform->transform_fn(transform, src, dest, length); | 1464 transform->transform_fn(transform, src, dest, length); |
1266 } | 1465 } |
1267 | 1466 |
1268 qcms_bool qcms_supports_iccv4; | 1467 qcms_bool qcms_supports_iccv4; |
1269 void qcms_enable_iccv4() | 1468 void qcms_enable_iccv4() |
1270 { | 1469 { |
1271 qcms_supports_iccv4 = true; | 1470 qcms_supports_iccv4 = true; |
1272 } | 1471 } |
OLD | NEW |