2018.11.30 09:53 "[Tiff] TIFF mailing list migrated to @lists.osgeo.org", by Even Rouault

2018.12.01 15:25 "[Tiff] Fwd: Libtiff 4.0.10 - Possible small error", by

[Originally sent to list on 2018-11-24, but still hasn’t appeared.]

Hello,

While perusing the new Libtiff 4.0.10 source I spotted the following - which looks like a possible error:

tif_color.c:
   TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
               const TIFFDisplay *display, float *refWhite)
   {
   ...
       cielab->rstep =
           (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
   ...
       cielab->gstep =
           (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
   ...
       cielab->bstep =
           (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
   ...
   }

Should this be something like:

cielab->rstep = (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
...

   cielab->gstep = (cielab->display.d_YCG - cielab->display.d_Y0G) / cielab->range;
   ...                                  ^                       ^
   cielab->bstep = (cielab->display.d_YCB - cielab->display.d_Y0B) / cielab->range;
                                        ^                       ^
                                        |______ Note here ______|

or is it just a case of redundant evaluation?

Also 9 occurrences of `cielab->range` could probably be replaced with the constant `CIELABTORGB_TABLE_RANGE`. (Potentially saving > 9,000 memory accesses.)

[I realise it has been like this for ages.]

Also, in tiffio.h:

   #define D65_X0 (95.0470F)
   #define D65_Y0 (100.0F)
   #define D65_Z0 (108.8827F)

   #define D50_X0 (96.4250F)
   #define D50_Y0 (100.0F)
   #define D50_Z0 (82.4680F)

All the references I can find state that these values are usually more like:

D65-white-XYZ = { 95.05f, 100.0f, 108.91f }
D50-white-XYZ = { 96.42f, 100.0f, 82.49f }

Is there any reason they differ? Perhaps a code comment would elucidate.

Also, the function putcontig8bitYCbCrGenericTile in tif_getimage.c (although disabled) contains syntax errors. To me it is begging to be fixed or deleted.

I hope this feedback proves useful.

Regards,

CHRIS