More cleanups in color conversion interface.
This commit is contained in:
parent
11f7b31e98
commit
388ee2af07
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_color.c,v 1.4 2003-12-19 12:14:02 dron Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_color.c,v 1.5 2003-12-21 22:13:14 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -115,8 +115,8 @@ TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
|
||||
* the Yr,Yb,Yg <=> r,g,b conversions.
|
||||
*/
|
||||
int
|
||||
TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab, TIFFDisplay *display,
|
||||
float X0, float Y0, float Z0)
|
||||
TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
|
||||
TIFFDisplay *display, float *refWhite)
|
||||
{
|
||||
static char module[] = "TIFFCIELabToRGBInit";
|
||||
|
||||
@ -155,9 +155,9 @@ TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab, TIFFDisplay *display,
|
||||
}
|
||||
|
||||
/* Init reference white point */
|
||||
cielab->X0 = X0;
|
||||
cielab->Y0 = Y0;
|
||||
cielab->Z0 = Z0;
|
||||
cielab->X0 = refWhite[0];
|
||||
cielab->Y0 = refWhite[1];
|
||||
cielab->Z0 = refWhite[2];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -238,9 +238,6 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
|
||||
* they are in a range defined by the ReferenceBlackWhite
|
||||
* tag) so there is some range shifting to do here when
|
||||
* constructing tables indexed by the raw pixel data.
|
||||
*
|
||||
* XXX handle ReferenceBlackWhite correctly to calculate
|
||||
* Cb/Cr values to use in constructing the tables.
|
||||
*/
|
||||
for (i = 0, x = -128; i < 256; i++, x++) {
|
||||
int Cr = Code2V(x, refBlackWhite[4] - 128.0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.35 2003-12-19 12:14:02 dron Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.36 2003-12-21 22:13:14 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991-1997 Sam Leffler
|
||||
@ -2049,7 +2049,8 @@ initCIELabConversion(TIFFRGBAImage* img)
|
||||
{
|
||||
static char module[] = "initCIELabConversion";
|
||||
|
||||
float *coeffs, X0, Y0, Z0;
|
||||
float *whitePoint;
|
||||
float refWhite[3];
|
||||
|
||||
if (!img->cielab) {
|
||||
img->cielab = (TIFFCIELabToRGB *)
|
||||
@ -2061,11 +2062,12 @@ initCIELabConversion(TIFFRGBAImage* img)
|
||||
}
|
||||
}
|
||||
|
||||
TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &coeffs);
|
||||
Y0 = 100.0F;
|
||||
X0 = coeffs[0] / coeffs[1] * Y0;
|
||||
Z0 = (1.0F - coeffs[0] - coeffs[1]) / coeffs[1] * Y0;
|
||||
if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, X0, Y0, Z0) < 0) {
|
||||
TIFFGetFieldDefaulted(img->tif, TIFFTAG_WHITEPOINT, &whitePoint);
|
||||
refWhite[1] = 100.0F;
|
||||
refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
|
||||
refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
|
||||
/ whitePoint[1] * refWhite[1];
|
||||
if (TIFFCIELabToRGBInit(img->cielab, &display_sRGB, refWhite) < 0) {
|
||||
TIFFError(module,
|
||||
"Failed to initialize CIE L*a*b*->RGB conversion state.");
|
||||
_TIFFfree(img->cielab);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tiffio.h,v 1.25 2003-12-19 12:14:02 dron Exp $ */
|
||||
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tiffio.h,v 1.26 2003-12-21 22:13:14 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
@ -167,8 +167,7 @@ typedef struct { /* CIE Lab 1976->RGB support */
|
||||
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
|
||||
} TIFFCIELabToRGB;
|
||||
|
||||
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *,
|
||||
float, float, float);
|
||||
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
|
||||
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
|
||||
float *, float *, float *);
|
||||
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
|
||||
|
Loading…
Reference in New Issue
Block a user