@@ -438,8 +438,9 @@ vips_icc_build( VipsObject *object )
438
438
439
439
/* Use cmsFLAGS_NOCACHE to disable the 1-pixel cache and make
440
440
* calling cmsDoTransform() from multiple threads safe.
441
+ * Use cmsFLAGS_NOOPTIMIZE to ensure we keep all precision.
441
442
*/
442
- flags = cmsFLAGS_NOCACHE ;
443
+ flags = cmsFLAGS_NOCACHE | cmsFLAGS_NOOPTIMIZE ;
443
444
444
445
if ( icc -> black_point_compensation )
445
446
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION ;
@@ -773,7 +774,7 @@ vips_icc_import_build( VipsObject *object )
773
774
774
775
if ( icc -> pcs == VIPS_PCS_LAB ) {
775
776
cmsCIExyY white ;
776
- cmsWhitePointFromTemp ( & white , 6500 );
777
+ cmsWhitePointFromTemp ( & white , 6504 );
777
778
778
779
icc -> out_profile = cmsCreateLab4Profile ( & white );
779
780
}
@@ -808,6 +809,13 @@ decode_lab( guint16 *fixed, float *lab, int n )
808
809
int i ;
809
810
810
811
for ( i = 0 ; i < n ; i ++ ) {
812
+ /*cmsCIELab Lab;
813
+ cmsLabEncoded2FloatV2(&Lab, fixed);
814
+
815
+ lab[0] = (float) Lab.L;
816
+ lab[1] = (float) Lab.a;
817
+ lab[2] = (float) Lab.b;*/
818
+
811
819
lab [0 ] = (double ) fixed [0 ] / 652.800 ;
812
820
lab [1 ] = ((double ) fixed [1 ] / 256.0 ) - 128.0 ;
813
821
lab [2 ] = ((double ) fixed [2 ] / 256.0 ) - 128.0 ;
@@ -827,6 +835,13 @@ decode_xyz( guint16 *fixed, float *xyz, int n )
827
835
int i ;
828
836
829
837
for ( i = 0 ; i < n ; i ++ ) {
838
+ /*cmsCIEXYZ XYZ;
839
+ cmsXYZEncoded2Float(&XYZ, fixed);
840
+
841
+ xyz[0] = XYZ.X * 100;
842
+ xyz[1] = XYZ.Y * 100;
843
+ xyz[2] = XYZ.Z * 100;*/
844
+
830
845
xyz [0 ] = (double ) fixed [0 ] / X_FAC ;
831
846
xyz [1 ] = (double ) fixed [1 ] / Y_FAC ;
832
847
xyz [2 ] = (double ) fixed [2 ] / Z_FAC ;
@@ -936,7 +951,7 @@ vips_icc_export_build( VipsObject *object )
936
951
937
952
if ( icc -> pcs == VIPS_PCS_LAB ) {
938
953
cmsCIExyY white ;
939
- cmsWhitePointFromTemp ( & white , 6500 );
954
+ cmsWhitePointFromTemp ( & white , 6504 );
940
955
941
956
icc -> in_profile = cmsCreateLab4Profile ( & white );
942
957
}
@@ -977,6 +992,9 @@ encode_lab( float *lab, guint16 *fixed, int n )
977
992
int i ;
978
993
979
994
for ( i = 0 ; i < n ; i ++ ) {
995
+ /*cmsCIELab Lab = {.L = lab[0], .a = lab[1], .b = lab[2]};
996
+ cmsFloat2LabEncodedV2(fixed, &Lab);*/
997
+
980
998
float L = lab [0 ];
981
999
float a = lab [1 ];
982
1000
float b = lab [2 ];
@@ -1014,6 +1032,9 @@ encode_xyz( float *xyz, guint16 *fixed, int n )
1014
1032
int i ;
1015
1033
1016
1034
for ( i = 0 ; i < n ; i ++ ) {
1035
+ /*cmsCIEXYZ XYZ = {.X = xyz[0], .Y = xyz[1], .Z = xyz[2]};
1036
+ cmsFloat2XYZEncoded(fixed, &XYZ);*/
1037
+
1017
1038
float X = xyz [0 ];
1018
1039
float Y = xyz [1 ];
1019
1040
float Z = xyz [2 ];
@@ -1228,7 +1249,7 @@ vips_icc_transform_init( VipsIccTransform *transform )
1228
1249
* @out: (out): output image
1229
1250
* @profile_filename: use this profile
1230
1251
*
1231
- * Transform an image from absolute to relative colorimetry using the
1252
+ * Transform an image from absolute to relative colorimetric using the
1232
1253
* MediaWhitePoint stored in the ICC profile.
1233
1254
*
1234
1255
* See also: vips_icc_transform(), vips_icc_import().
0 commit comments