47 float *X,
float *Y,
float *Z)
49 float L = (float)l * 100.0
F / 255.0
F;
53 *Y = (L * cielab->
Y0) / 903.292
F;
54 cby = 7.787F * (*Y / cielab->
Y0) + 16.0
F / 116.0
F;
56 cby = (L + 16.0F) / 116.0
F;
57 *Y = cielab->
Y0 * cby * cby * cby;
60 tmp = (float)a / 500.0
F + cby;
62 *X = cielab->
X0 * (tmp - 0.13793F) / 7.787
F;
64 *X = cielab->
X0 * tmp * tmp * tmp;
66 tmp = cby - (float)b / 200.0
F;
68 *Z = cielab->
Z0 * (tmp - 0.13793F) / 7.787
F;
70 *Z = cielab->
Z0 * tmp * tmp * tmp;
73 #define RINT(R) ((uint32)((R)>0?((R)+0.5):((R)-0.5))) 86 Yr = matrix[0] * X + matrix[1] * Y + matrix[2] * Z;
87 Yg = matrix[3] * X + matrix[4] * Y + matrix[5] * Z;
88 Yb = matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
139 for(i = 0; i <= cielab->
range; i++) {
141 * ((float)
pow((
double)i / cielab->
range, gamma));
148 for(i = 0; i <= cielab->
range; i++) {
150 * ((float)
pow((
double)i / cielab->
range, gamma));
157 for(i = 0; i <= cielab->
range; i++) {
159 * ((float)
pow((
double)i / cielab->
range, gamma));
163 cielab->
X0 = refWhite[0];
164 cielab->
Y0 = refWhite[1];
165 cielab->
Z0 = refWhite[2];
176 #define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5)) 177 #define ONE_HALF ((int32)(1<<(SHIFT-1))) 178 #define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)) ? ((RW)-(RB)) : 1)) 179 #define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f)) 180 #define HICLAMP(f,max) ((f)>(max)?(max):(f)) 217 #define LumaRed luma[0] 218 #define LumaGreen luma[1] 219 #define LumaBlue luma[2] 224 ycbcr->
clamptab = (clamptab += 256);
225 for (i = 0; i < 256; i++)
228 ycbcr->
Cr_r_tab = (
int*) (clamptab + 3*256);
251 for (i = 0, x = -128; i < 256; i++, x++) {
252 int32 Cr = (int32)
Code2V(x, refBlackWhite[4] - 128.0
F,
253 refBlackWhite[5] - 128.0
F, 127);
254 int32 Cb = (int32)
Code2V(x, refBlackWhite[2] - 128.0
F,
255 refBlackWhite[3] - 128.0
F, 127);
262 (int32)
Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255);
void TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z, uint32 *r, uint32 *g, uint32 *b)
GLboolean GLboolean GLboolean GLboolean a
int TIFFCIELabToRGBInit(TIFFCIELabToRGB *cielab, TIFFDisplay *display, float *refWhite)
GLint GLint GLint GLint GLint x
unsigned char TIFFRGBValue
GLboolean GLboolean GLboolean b
void _TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c)
#define CLAMP(f, min, max)
float Yg2g[CIELABTORGB_TABLE_RANGE+1]
#define CIELABTORGB_TABLE_RANGE
float Yr2r[CIELABTORGB_TABLE_RANGE+1]
float Yb2b[CIELABTORGB_TABLE_RANGE+1]
GLdouble GLdouble GLdouble r
void TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b, float *X, float *Y, float *Z)
#define TIFFroundup(x, y)
int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *ycbcr, float *luma, float *refBlackWhite)
void _TIFFmemset(tdata_t p, int v, tsize_t c)
void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr, uint32 *r, uint32 *g, uint32 *b)
#define Code2V(c, RB, RW, CR)