OLD | NEW |
1 diff --git a/third_party/qcms/src/iccread.c b/third_party/qcms/src/iccread.c | 1 diff --git a/third_party/qcms/src/iccread.c b/third_party/qcms/src/iccread.c |
2 index 36b7011..0523846 100644 | 2 index 36b7011..0523846 100644 |
3 --- a/third_party/qcms/src/iccread.c | 3 --- a/third_party/qcms/src/iccread.c |
4 +++ b/third_party/qcms/src/iccread.c | 4 +++ b/third_party/qcms/src/iccread.c |
5 @@ -266,7 +266,7 @@ qcms_bool qcms_profile_is_bogus(qcms_profile *profile) | 5 @@ -266,7 +266,7 @@ qcms_bool qcms_profile_is_bogus(qcms_profile *profile) |
6 if (profile->color_space != RGB_SIGNATURE) | 6 if (profile->color_space != RGB_SIGNATURE) |
7 return false; | 7 return false; |
8 | 8 |
9 - if (profile->A2B0 || profile->B2A0) | 9 - if (profile->A2B0 || profile->B2A0) |
10 + if (qcms_supports_iccv4 && (profile->A2B0 || profile->B2A0)) | 10 + if (qcms_supports_iccv4 && (profile->A2B0 || profile->B2A0)) |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 _mm_store_si128((__m128i*)output, _mm_cvtps_epi32(result)); | 306 _mm_store_si128((__m128i*)output, _mm_cvtps_epi32(result)); |
307 | 307 |
308 - dest[0] = otdata_r[output[0]]; | 308 - dest[0] = otdata_r[output[0]]; |
309 - dest[1] = otdata_g[output[1]]; | 309 - dest[1] = otdata_g[output[1]]; |
310 - dest[2] = otdata_b[output[2]]; | 310 - dest[2] = otdata_b[output[2]]; |
311 + dest[r_out] = otdata_r[output[0]]; | 311 + dest[r_out] = otdata_r[output[0]]; |
312 + dest[1] = otdata_g[output[1]]; | 312 + dest[1] = otdata_g[output[1]]; |
313 + dest[b_out] = otdata_b[output[2]]; | 313 + dest[b_out] = otdata_b[output[2]]; |
314 } | 314 } |
315 diff --git a/third_party/qcms/src/transform.c b/third_party/qcms/src/transform.c | 315 diff --git a/third_party/qcms/src/transform.c b/third_party/qcms/src/transform.c |
316 index 9a6562b..1f4e72b 100644 | 316 index 9a6562b..7312ced 100644 |
317 --- a/third_party/qcms/src/transform.c | 317 --- a/third_party/qcms/src/transform.c |
318 +++ b/third_party/qcms/src/transform.c | 318 +++ b/third_party/qcms/src/transform.c |
319 @@ -181,11 +181,20 @@ compute_chromatic_adaption(struct CIE_XYZ source_white_poi
nt, | 319 @@ -181,11 +181,20 @@ compute_chromatic_adaption(struct CIE_XYZ source_white_poi
nt, |
320 static struct matrix | 320 static struct matrix |
321 adaption_matrix(struct CIE_XYZ source_illumination, struct CIE_XYZ target_illum
ination) | 321 adaption_matrix(struct CIE_XYZ source_illumination, struct CIE_XYZ target_illum
ination) |
322 { | 322 { |
323 +#if defined (_MSC_VER) | 323 +#if defined (_MSC_VER) |
324 +#pragma warning(push) | 324 +#pragma warning(push) |
325 +/* Disable double to float truncation warning 4305 */ | 325 +/* Disable double to float truncation warning 4305 */ |
326 +#pragma warning(disable:4305) | 326 +#pragma warning(disable:4305) |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 - /* don't precache since we will use the mBA LUT */ | 700 - /* don't precache since we will use the mBA LUT */ |
701 - if (profile->mBA) | 701 - if (profile->mBA) |
702 - return; | 702 - return; |
703 + /* don't precache since we will use the mBA LUT */ | 703 + /* don't precache since we will use the mBA LUT */ |
704 + if (profile->mBA) | 704 + if (profile->mBA) |
705 + return; | 705 + return; |
706 + } | 706 + } |
707 | 707 |
708 /* don't precache if we do not have the TRC curves */ | 708 /* don't precache if we do not have the TRC curves */ |
709 if (!profile->redTRC || !profile->greenTRC || !profile->blueTRC) | 709 if (!profile->redTRC || !profile->greenTRC || !profile->blueTRC) |
710 @@ -1224,14 +1224,14 @@ | 710 @@ -1157,14 +1224,14 @@ qcms_transform* qcms_transform_create( |
711 return NULL; | 711 return NULL; |
712 } | 712 } |
713 if (precache) { | 713 if (precache) { |
714 -#ifdef X86 | 714 -#ifdef X86 |
715 +#if defined(SSE2_ENABLE) && defined(X86) | 715 +#if defined(SSE2_ENABLE) && defined(X86) |
716 if (sse_version_available() >= 2) { | 716 if (sse_version_available() >= 2) { |
717 if (in_type == QCMS_DATA_RGB_8) | 717 if (in_type == QCMS_DATA_RGB_8) |
718 transform->transform_fn = qcms_transform_dat
a_rgb_out_lut_sse2; | 718 transform->transform_fn = qcms_transform_dat
a_rgb_out_lut_sse2; |
719 else | 719 else |
720 transform->transform_fn = qcms_transform_dat
a_rgba_out_lut_sse2; | 720 transform->transform_fn = qcms_transform_dat
a_rgba_out_lut_sse2; |
721 | 721 |
722 -#if !(defined(_MSC_VER) && defined(_M_AMD64)) | 722 -#if !(defined(_MSC_VER) && defined(_M_AMD64)) |
723 +#if defined(SSE2_ENABLE) && !(defined(_MSC_VER) && defined(_M_AMD64)) | 723 +#if defined(SSE2_ENABLE) && !(defined(_MSC_VER) && defined(_M_AMD64)) |
724 /* Microsoft Compiler for x64 doesn't support MMX. | 724 /* Microsoft Compiler for x64 doesn't support MMX. |
725 * SSE code uses MMX so that we disable on x64 */ | 725 * SSE code uses MMX so that we disable on x64 */ |
726 } else | 726 } else |
727 @@ -1262,7 +1329,17 @@ __attribute__((__force_align_arg_pointer__)) | 727 @@ -1256,13 +1323,34 @@ qcms_transform* qcms_transform_create( |
| 728 » return transform; |
| 729 } |
| 730 |
| 731 -#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) |
| 732 +/* __force_align_arg_pointer__ is an x86-only attribute, and gcc/clang warns on
unused |
| 733 + * attributes. Don't use this on ARM or AMD64. __has_attribute can detect the p
resence |
| 734 + * of the attribute but is currently only supported by clang */ |
| 735 +#if defined(__has_attribute) |
| 736 +#define HAS_FORCE_ALIGN_ARG_POINTER __has_attribute(__force_align_arg_pointer__
) |
| 737 +#elif defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) && !defi
ned(__arm__) |
| 738 +#define HAS_FORCE_ALIGN_ARG_POINTER 1 |
| 739 +#else |
| 740 +#define HAS_FORCE_ALIGN_ARG_POINTER 0 |
| 741 +#endif |
| 742 + |
| 743 +#if HAS_FORCE_ALIGN_ARG_POINTER |
| 744 /* we need this to avoid crashes when gcc assumes the stack is 128bit aligned *
/ |
| 745 __attribute__((__force_align_arg_pointer__)) |
728 #endif | 746 #endif |
729 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size
_t length) | 747 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size
_t length) |
730 { | 748 { |
731 - transform->transform_fn(transform, src, dest, length); | 749 - transform->transform_fn(transform, src, dest, length); |
732 + static const struct _qcms_format_type output_rgbx = { 0, 2 }; | 750 + static const struct _qcms_format_type output_rgbx = { 0, 2 }; |
733 + | 751 + |
734 + transform->transform_fn(transform, src, dest, length, output_rgbx); | 752 + transform->transform_fn(transform, src, dest, length, output_rgbx); |
735 +} | 753 +} |
736 + | 754 + |
737 +void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest,
size_t length, qcms_output_type type) | 755 +void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest,
size_t length, qcms_output_type type) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 } | 792 } |
775 } | 793 } |
776 - return gamma_table; | 794 - return gamma_table; |
777 + | 795 + |
778 + validate_gamma_table(gamma_table); | 796 + validate_gamma_table(gamma_table); |
779 + | 797 + |
780 + return gamma_table; | 798 + return gamma_table; |
781 } | 799 } |
782 | 800 |
783 struct matrix build_colorant_matrix(qcms_profile *p) | 801 struct matrix build_colorant_matrix(qcms_profile *p) |
784 diff --git a/third_party/qcms/src/transform.c b/third_party/qcms/src/transform.c | |
785 index 976c498..44ce9b5 100644 | |
786 --- a/third_party/qcms/src/transform.c | |
787 +++ b/third_party/qcms/src/transform.c | |
788 @@ -1324,8 +1324,18 @@ qcms_transform* qcms_transform_create( | |
789 } | |
790 | |
791 #if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__) | |
792 +#if !defined(__has_attribute) | |
793 +/* Assume that the compiler supports the provided attribute. */ | |
794 +#define __has_attribute(x) 1 | |
795 +#endif | |
796 +#if __has_attribute(__force_align_arg_pointer__) | |
797 /* we need this to avoid crashes when gcc assumes the stack is 128bit aligned *
/ | |
798 __attribute__((__force_align_arg_pointer__)) | |
799 +#else | |
800 +/* __force_align_arg_pointer__ is an x86-only attribute, and clang warns on use
d | |
801 + * attributes. Don't use this on ARM. | |
802 + */ | |
803 +#endif | |
804 #endif | |
805 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size
_t length) | |
806 { | |
807 | |
OLD | NEW |