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

Side by Side Diff: third_party/qcms/google.patch

Issue 11645034: Make qcms compile on Win64 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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 | Annotate | Revision Log
OLDNEW
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..d3c3dfe 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))
11 return false; 11 return false;
12 12
(...skipping 14 matching lines...) Expand all
27 tolerance[1] = 0.02; 27 tolerance[1] = 0.02;
28 tolerance[2] = 0.04; 28 tolerance[2] = 0.04;
29 29
30 +#if defined (_MSC_VER) 30 +#if defined (_MSC_VER)
31 +/* Restore warnings */ 31 +/* Restore warnings */
32 +#pragma warning(pop) 32 +#pragma warning(pop)
33 +#endif 33 +#endif
34 // Compare with our tolerance 34 // Compare with our tolerance
35 for (i = 0; i < 3; ++i) { 35 for (i = 0; i < 3; ++i) {
36 if (!(((sum[i] - tolerance[i]) <= target[i]) && 36 if (!(((sum[i] - tolerance[i]) <= target[i]) &&
37 @@ -402,7 +411,7 @@ static struct XYZNumber read_tag_XYZType(struct mem_source * src, struct tag_inde
38 // present that are not part of the tag_index.
39 static struct curveType *read_curveType(struct mem_source *src, uint32_t offset , uint32_t *len)
40 {
41 - static const size_t COUNT_TO_LENGTH[5] = {1, 3, 4, 5, 7};
42 + static const uint32_t COUNT_TO_LENGTH[5] = {1, 3, 4, 5, 7};
43 struct curveType *curve = NULL;
44 uint32_t type = read_u32(src, offset);
45 uint32_t count;
46 @@ -657,7 +666,7 @@ static struct lutType *read_tag_lutType(struct mem_source *s rc, struct tag_index
47 uint16_t num_input_table_entries;
48 uint16_t num_output_table_entries;
49 uint8_t in_chan, grid_points, out_chan;
50 - uint32_t clut_offset, output_offset;
51 + size_t clut_offset, output_offset;
52 uint32_t clut_size;
53 size_t entry_size;
54 struct lutType *lut;
37 diff --git a/third_party/qcms/src/qcms.h b/third_party/qcms/src/qcms.h 55 diff --git a/third_party/qcms/src/qcms.h b/third_party/qcms/src/qcms.h
38 index 7d83623..1e3e125 100644 56 index 7d83623..1e3e125 100644
39 --- a/third_party/qcms/src/qcms.h 57 --- a/third_party/qcms/src/qcms.h
40 +++ b/third_party/qcms/src/qcms.h 58 +++ b/third_party/qcms/src/qcms.h
41 @@ -102,6 +102,12 @@ typedef enum { 59 @@ -102,6 +102,12 @@ typedef enum {
42 QCMS_DATA_GRAYA_8 60 QCMS_DATA_GRAYA_8
43 } qcms_data_type; 61 } qcms_data_type;
44 62
45 +/* Format of the output data for qcms_transform_data_type() */ 63 +/* Format of the output data for qcms_transform_data_type() */
46 +typedef enum { 64 +typedef enum {
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 +void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest, size_t length, qcms_output_type type) 773 +void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest, size_t length, qcms_output_type type)
756 +{ 774 +{
757 + static const struct _qcms_format_type output_rgbx = { 0, 2 }; 775 + static const struct _qcms_format_type output_rgbx = { 0, 2 };
758 + static const struct _qcms_format_type output_bgrx = { 2, 0 }; 776 + static const struct _qcms_format_type output_bgrx = { 2, 0 };
759 + 777 +
760 + transform->transform_fn(transform, src, dest, length, type == QCMS_OUTPU T_BGRX ? output_bgrx : output_rgbx); 778 + transform->transform_fn(transform, src, dest, length, type == QCMS_OUTPU T_BGRX ? output_bgrx : output_rgbx);
761 } 779 }
762 780
763 qcms_bool qcms_supports_iccv4; 781 qcms_bool qcms_supports_iccv4;
764 diff --git a/third_party/qcms/src/transform_util.c b/third_party/qcms/src/transf orm_util.c 782 diff --git a/third_party/qcms/src/transform_util.c b/third_party/qcms/src/transf orm_util.c
765 index e8447e5..f68699d 100644 783 index e8447e5..f4338b2 100644
766 --- a/third_party/qcms/src/transform_util.c 784 --- a/third_party/qcms/src/transform_util.c
767 +++ b/third_party/qcms/src/transform_util.c 785 +++ b/third_party/qcms/src/transform_util.c
786 @@ -36,7 +36,7 @@
787
788 /* value must be a value between 0 and 1 */
789 //XXX: is the above a good restriction to have?
790 -float lut_interp_linear(double value, uint16_t *table, int length)
791 +float lut_interp_linear(double value, uint16_t *table, size_t length)
792 {
793 int upper, lower;
794 value = value * (length - 1); // scale to length of the array
795 @@ -49,11 +49,11 @@ float lut_interp_linear(double value, uint16_t *table, int l ength)
796 }
797
798 /* same as above but takes and returns a uint16_t value representing a range fr om 0..1 */
799 -uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, int length)
800 +uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, size_t leng th)
801 {
802 /* Start scaling input_value to the length of the array: 65535*(length-1 ).
803 * We'll divide out the 65535 next */
804 - uint32_t value = (input_value * (length - 1));
805 + uintptr_t value = (input_value * (length - 1));
806 uint32_t upper = (value + 65534) / 65535; /* equivalent to ceil(value/65 535) */
807 uint32_t lower = value / 65535; /* equivalent to floor(value/6 5535) */
808 /* interp is the distance from upper to value scaled to 0..65535 */
809 @@ -67,11 +67,11 @@ uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, int length)
810 /* same as above but takes an input_value from 0..PRECACHE_OUTPUT_MAX
811 * and returns a uint8_t value representing a range from 0..1 */
812 static
813 -uint8_t lut_interp_linear_precache_output(uint32_t input_value, uint16_t *table , int length)
814 +uint8_t lut_interp_linear_precache_output(uint32_t input_value, uint16_t *table , size_t length)
815 {
816 /* Start scaling input_value to the length of the array: PRECACHE_OUTPUT _MAX*(length-1).
817 * We'll divide out the PRECACHE_OUTPUT_MAX next */
818 - uint32_t value = (input_value * (length - 1));
819 + uintptr_t value = (input_value * (length - 1));
820
821 /* equivalent to ceil(value/PRECACHE_OUTPUT_MAX) */
822 uint32_t upper = (value + PRECACHE_OUTPUT_MAX-1) / PRECACHE_OUTPUT_MAX;
823 @@ -91,7 +91,7 @@ uint8_t lut_interp_linear_precache_output(uint32_t input_value , uint16_t *table,
824
825 /* value must be a value between 0 and 1 */
826 //XXX: is the above a good restriction to have?
827 -float lut_interp_linear_float(float value, float *table, int length)
828 +float lut_interp_linear_float(float value, float *table, size_t length)
829 {
830 int upper, lower;
831 value = value * (length - 1);
768 @@ -235,6 +235,21 @@ float u8Fixed8Number_to_float(uint16_t x) 832 @@ -235,6 +235,21 @@ float u8Fixed8Number_to_float(uint16_t x)
769 return x/256.; 833 return x/256.;
770 } 834 }
771 835
772 +/* The SSE2 code uses min & max which let NaNs pass through. 836 +/* The SSE2 code uses min & max which let NaNs pass through.
773 + We want to try to prevent that here by ensuring that 837 + We want to try to prevent that here by ensuring that
774 + gamma table is within expected values. */ 838 + gamma table is within expected values. */
775 +void validate_gamma_table(float gamma_table[256]) 839 +void validate_gamma_table(float gamma_table[256])
776 +{ 840 +{
777 + int i; 841 + int i;
(...skipping 14 matching lines...) Expand all
792 } 856 }
793 } 857 }
794 - return gamma_table; 858 - return gamma_table;
795 + 859 +
796 + validate_gamma_table(gamma_table); 860 + validate_gamma_table(gamma_table);
797 + 861 +
798 + return gamma_table; 862 + return gamma_table;
799 } 863 }
800 864
801 struct matrix build_colorant_matrix(qcms_profile *p) 865 struct matrix build_colorant_matrix(qcms_profile *p)
866 @@ -390,7 +408,7 @@ uint16_fract_t lut_inverse_interp16(uint16_t Value, uint16_t LutTable[], int len
867 which has an maximum error of about 9855 (pixel difference of ~38.346)
868
869 For now, we punt the decision of output size to the caller. */
870 -static uint16_t *invert_lut(uint16_t *table, int length, int out_length)
871 +static uint16_t *invert_lut(uint16_t *table, int length, size_t out_length)
872 {
873 int i;
874 /* for now we invert the lut by creating a lut of size out_length
875 diff --git a/third_party/qcms/src/transform_util.h b/third_party/qcms/src/transf orm_util.h
876 index 8f358a8..de465f4 100644
877 --- a/third_party/qcms/src/transform_util.h
878 +++ b/third_party/qcms/src/transform_util.h
879 @@ -31,9 +31,9 @@
880 //XXX: could use a bettername
881 typedef uint16_t uint16_fract_t;
882
883 -float lut_interp_linear(double value, uint16_t *table, int length);
884 -float lut_interp_linear_float(float value, float *table, int length);
885 -uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, int length) ;
886 +float lut_interp_linear(double value, uint16_t *table, size_t length);
887 +float lut_interp_linear_float(float value, float *table, size_t length);
888 +uint16_t lut_interp_linear16(uint16_t input_value, uint16_t *table, size_t leng th);
889
890
891 static inline float lerp(float a, float b, float t)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698