ReactOS  0.4.14-dev-77-gd9e7c48
tif_color.c File Reference
#include <precomp.h>
#include <math.h>
Include dependency graph for tif_color.c:

Go to the source code of this file.

Macros

#define RINT(R)   ((uint32)((R)>0?((R)+0.5):((R)-0.5)))
 
#define SHIFT   16
 
#define FIX(x)   ((int32)((x) * (1L<<SHIFT) + 0.5))
 
#define ONE_HALF   ((int32)(1<<(SHIFT-1)))
 
#define Code2V(c, RB, RW, CR)   ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)!=0) ? ((RW)-(RB)) : 1))
 
#define CLAMP(f, min, max)   ((f)<(min)?(min):(f)>(max)?(max):(f))
 
#define HICLAMP(f, max)   ((f)>(max)?(max):(f))
 
#define LumaRed   luma[0]
 
#define LumaGreen   luma[1]
 
#define LumaBlue   luma[2]
 

Functions

void TIFFCIELabToXYZ (TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b, float *X, float *Y, float *Z)
 
void TIFFXYZToRGB (TIFFCIELabToRGB *cielab, float X, float Y, float Z, uint32 *r, uint32 *g, uint32 *b)
 
int TIFFCIELabToRGBInit (TIFFCIELabToRGB *cielab, const TIFFDisplay *display, float *refWhite)
 
void TIFFYCbCrtoRGB (TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr, uint32 *r, uint32 *g, uint32 *b)
 
static float CLAMPw (float v, float vmin, float vmax)
 
int TIFFYCbCrToRGBInit (TIFFYCbCrToRGB *ycbcr, float *luma, float *refBlackWhite)
 

Macro Definition Documentation

◆ CLAMP

#define CLAMP (   f,
  min,
  max 
)    ((f)<(min)?(min):(f)>(max)?(max):(f))

Definition at line 177 of file tif_color.c.

◆ Code2V

#define Code2V (   c,
  RB,
  RW,
  CR 
)    ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)!=0) ? ((RW)-(RB)) : 1))

Definition at line 176 of file tif_color.c.

◆ FIX

#define FIX (   x)    ((int32)((x) * (1L<<SHIFT) + 0.5))

Definition at line 174 of file tif_color.c.

◆ HICLAMP

#define HICLAMP (   f,
  max 
)    ((f)>(max)?(max):(f))

Definition at line 178 of file tif_color.c.

◆ LumaBlue

#define LumaBlue   luma[2]

◆ LumaGreen

#define LumaGreen   luma[1]

◆ LumaRed

#define LumaRed   luma[0]

◆ ONE_HALF

#define ONE_HALF   ((int32)(1<<(SHIFT-1)))

Definition at line 175 of file tif_color.c.

◆ RINT

#define RINT (   R)    ((uint32)((R)>0?((R)+0.5):((R)-0.5)))

Definition at line 71 of file tif_color.c.

◆ SHIFT

#define SHIFT   16

Definition at line 173 of file tif_color.c.

Function Documentation

◆ CLAMPw()

static float CLAMPw ( float  v,
float  vmin,
float  vmax 
)
static

Definition at line 202 of file tif_color.c.

203 {
204  if( v < vmin )
205  {
206  /* printf("%f clamped to %f\n", v, vmin); */
207  return vmin;
208  }
209  if( v > vmax )
210  {
211  /* printf("%f clamped to %f\n", v, vmax); */
212  return vmax;
213  }
214  return v;
215 }
const GLdouble * v
Definition: gl.h:2040

Referenced by TIFFYCbCrToRGBInit().

◆ TIFFCIELabToRGBInit()

int TIFFCIELabToRGBInit ( TIFFCIELabToRGB cielab,
const TIFFDisplay display,
float *  refWhite 
)

Definition at line 123 of file tif_color.c.

125 {
126  int i;
127  double dfGamma;
128 
129  cielab->range = CIELABTORGB_TABLE_RANGE;
130 
131  _TIFFmemcpy(&cielab->display, display, sizeof(TIFFDisplay));
132 
133  /* Red */
134  dfGamma = 1.0 / cielab->display.d_gammaR ;
135  cielab->rstep =
136  (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
137  for(i = 0; i <= cielab->range; i++) {
138  cielab->Yr2r[i] = cielab->display.d_Vrwr
139  * ((float)pow((double)i / cielab->range, dfGamma));
140  }
141 
142  /* Green */
143  dfGamma = 1.0 / cielab->display.d_gammaG ;
144  cielab->gstep =
145  (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
146  for(i = 0; i <= cielab->range; i++) {
147  cielab->Yg2g[i] = cielab->display.d_Vrwg
148  * ((float)pow((double)i / cielab->range, dfGamma));
149  }
150 
151  /* Blue */
152  dfGamma = 1.0 / cielab->display.d_gammaB ;
153  cielab->bstep =
154  (cielab->display.d_YCR - cielab->display.d_Y0R) / cielab->range;
155  for(i = 0; i <= cielab->range; i++) {
156  cielab->Yb2b[i] = cielab->display.d_Vrwb
157  * ((float)pow((double)i / cielab->range, dfGamma));
158  }
159 
160  /* Init reference white point */
161  cielab->X0 = refWhite[0];
162  cielab->Y0 = refWhite[1];
163  cielab->Z0 = refWhite[2];
164 
165  return 0;
166 }
float Yg2g[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:175
float rstep
Definition: tiffio.h:171
float d_YCR
Definition: tiffio.h:145
int * display
Definition: x11stubs.c:12
float bstep
Definition: tiffio.h:171
TIFFDisplay display
Definition: tiffio.h:173
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
float pow(float __x, int __y)
Definition: _cmath.h:458
float d_gammaG
Definition: tiffio.h:155
#define CIELABTORGB_TABLE_RANGE
Definition: tiffio.h:170
float Yb2b[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:176
uint32 d_Vrwg
Definition: tiffio.h:149
uint32 d_Vrwb
Definition: tiffio.h:150
float Yr2r[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:174
float d_gammaR
Definition: tiffio.h:154
GLenum GLint * range
Definition: glext.h:7539
float gstep
Definition: tiffio.h:171
uint32 d_Vrwr
Definition: tiffio.h:148
float d_gammaB
Definition: tiffio.h:156
float d_Y0R
Definition: tiffio.h:151
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Definition: tif_unix.c:344

Referenced by initCIELabConversion().

◆ TIFFCIELabToXYZ()

void TIFFCIELabToXYZ ( TIFFCIELabToRGB cielab,
uint32  l,
int32  a,
int32  b,
float *  X,
float *  Y,
float *  Z 
)

Definition at line 44 of file tif_color.c.

46 {
47  float L = (float)l * 100.0F / 255.0F;
48  float cby, tmp;
49 
50  if( L < 8.856F ) {
51  *Y = (L * cielab->Y0) / 903.292F;
52  cby = 7.787F * (*Y / cielab->Y0) + 16.0F / 116.0F;
53  } else {
54  cby = (L + 16.0F) / 116.0F;
55  *Y = cielab->Y0 * cby * cby * cby;
56  }
57 
58  tmp = (float)a / 500.0F + cby;
59  if( tmp < 0.2069F )
60  *X = cielab->X0 * (tmp - 0.13793F) / 7.787F;
61  else
62  *X = cielab->X0 * tmp * tmp * tmp;
63 
64  tmp = cby - (float)b / 200.0F;
65  if( tmp < 0.2069F )
66  *Z = cielab->Z0 * (tmp - 0.13793F) / 7.787F;
67  else
68  *Z = cielab->Z0 * tmp * tmp * tmp;
69 }
#define Y(I)
#define Z(I)
r l[0]
Definition: byte_order.h:167
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static const WCHAR L[]
Definition: oid.c:1250
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define F(x, y, z)
Definition: md5.c:51

Referenced by DECLAREContigPutFunc().

◆ TIFFXYZToRGB()

void TIFFXYZToRGB ( TIFFCIELabToRGB cielab,
float  X,
float  Y,
float  Z,
uint32 r,
uint32 g,
uint32 b 
)

Definition at line 76 of file tif_color.c.

78 {
79  int i;
80  float Yr, Yg, Yb;
81  float *matrix = &cielab->display.d_mat[0][0];
82 
83  /* Multiply through the matrix to get luminosity values. */
84  Yr = matrix[0] * X + matrix[1] * Y + matrix[2] * Z;
85  Yg = matrix[3] * X + matrix[4] * Y + matrix[5] * Z;
86  Yb = matrix[6] * X + matrix[7] * Y + matrix[8] * Z;
87 
88  /* Clip input */
89  Yr = TIFFmax(Yr, cielab->display.d_Y0R);
90  Yg = TIFFmax(Yg, cielab->display.d_Y0G);
91  Yb = TIFFmax(Yb, cielab->display.d_Y0B);
92 
93  /* Avoid overflow in case of wrong input values */
94  Yr = TIFFmin(Yr, cielab->display.d_YCR);
95  Yg = TIFFmin(Yg, cielab->display.d_YCG);
96  Yb = TIFFmin(Yb, cielab->display.d_YCB);
97 
98  /* Turn luminosity to colour value. */
99  i = (int)((Yr - cielab->display.d_Y0R) / cielab->rstep);
100  i = TIFFmin(cielab->range, i);
101  *r = RINT(cielab->Yr2r[i]);
102 
103  i = (int)((Yg - cielab->display.d_Y0G) / cielab->gstep);
104  i = TIFFmin(cielab->range, i);
105  *g = RINT(cielab->Yg2g[i]);
106 
107  i = (int)((Yb - cielab->display.d_Y0B) / cielab->bstep);
108  i = TIFFmin(cielab->range, i);
109  *b = RINT(cielab->Yb2b[i]);
110 
111  /* Clip output. */
112  *r = TIFFmin(*r, cielab->display.d_Vrwr);
113  *g = TIFFmin(*g, cielab->display.d_Vrwg);
114  *b = TIFFmin(*b, cielab->display.d_Vrwb);
115 }
#define Yb
Definition: i386-dis.c:427
float Yg2g[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:175
#define Y(I)
#define RINT(R)
Definition: tif_color.c:71
GLuint GLenum matrix
Definition: glext.h:9407
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
float d_mat[3][3]
Definition: tiffio.h:144
float rstep
Definition: tiffio.h:171
float d_YCR
Definition: tiffio.h:145
float d_YCG
Definition: tiffio.h:146
float bstep
Definition: tiffio.h:171
TIFFDisplay display
Definition: tiffio.h:173
#define Z(I)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
float Yb2b[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:176
float d_Y0B
Definition: tiffio.h:153
GLboolean GLboolean g
Definition: glext.h:6204
uint32 d_Vrwg
Definition: tiffio.h:149
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
float d_Y0G
Definition: tiffio.h:152
#define TIFFmax(A, B)
Definition: tiffiop.h:264
uint32 d_Vrwb
Definition: tiffio.h:150
float Yr2r[CIELABTORGB_TABLE_RANGE+1]
Definition: tiffio.h:174
float gstep
Definition: tiffio.h:171
uint32 d_Vrwr
Definition: tiffio.h:148
float d_YCB
Definition: tiffio.h:147
float d_Y0R
Definition: tiffio.h:151
#define TIFFmin(A, B)
Definition: tiffiop.h:265
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by DECLAREContigPutFunc().

◆ TIFFYCbCrtoRGB()

void TIFFYCbCrtoRGB ( TIFFYCbCrToRGB ycbcr,
uint32  Y,
int32  Cb,
int32  Cr,
uint32 r,
uint32 g,
uint32 b 
)

Definition at line 181 of file tif_color.c.

183 {
184  int32 i;
185 
186  /* XXX: Only 8-bit YCbCr input supported for now */
187  Y = HICLAMP(Y, 255);
188  Cb = CLAMP(Cb, 0, 255);
189  Cr = CLAMP(Cr, 0, 255);
190 
191  i = ycbcr->Y_tab[Y] + ycbcr->Cr_r_tab[Cr];
192  *r = CLAMP(i, 0, 255);
193  i = ycbcr->Y_tab[Y]
194  + (int)((ycbcr->Cb_g_tab[Cb] + ycbcr->Cr_g_tab[Cr]) >> SHIFT);
195  *g = CLAMP(i, 0, 255);
196  i = ycbcr->Y_tab[Y] + ycbcr->Cb_b_tab[Cb];
197  *b = CLAMP(i, 0, 255);
198 }
#define Y(I)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CLAMP(f, min, max)
Definition: tif_color.c:177
int * Cr_r_tab
Definition: tiffio.h:161
GLboolean GLboolean g
Definition: glext.h:6204
int * Cb_b_tab
Definition: tiffio.h:162
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
int32 * Cb_g_tab
Definition: tiffio.h:164
#define HICLAMP(f, max)
Definition: tif_color.c:178
#define SHIFT
Definition: tif_color.c:173
int32 * Y_tab
Definition: tiffio.h:165
int32 * Cr_g_tab
Definition: tiffio.h:163
long int32
Definition: platform.h:12
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by DECLARESepPutFunc().

◆ TIFFYCbCrToRGBInit()

int TIFFYCbCrToRGBInit ( TIFFYCbCrToRGB ycbcr,
float *  luma,
float *  refBlackWhite 
)

Definition at line 234 of file tif_color.c.

235 {
236  TIFFRGBValue* clamptab;
237  int i;
238 
239 #define LumaRed luma[0]
240 #define LumaGreen luma[1]
241 #define LumaBlue luma[2]
242 
243  clamptab = (TIFFRGBValue*)(
244  (uint8*) ycbcr+TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long)));
245  _TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
246  ycbcr->clamptab = (clamptab += 256);
247  for (i = 0; i < 256; i++)
248  clamptab[i] = (TIFFRGBValue) i;
249  _TIFFmemset(clamptab+256, 255, 2*256); /* v > 255 => 255 */
250  ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);
251  ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
252  ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256);
253  ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
254  ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
255 
256  { float f1 = 2-2*LumaRed; int32 D1 = FIX(CLAMP(f1,0.0F,2.0F));
257  float f2 = LumaRed*f1/LumaGreen; int32 D2 = -FIX(CLAMP(f2,0.0F,2.0F));
258  float f3 = 2-2*LumaBlue; int32 D3 = FIX(CLAMP(f3,0.0F,2.0F));
259  float f4 = LumaBlue*f3/LumaGreen; int32 D4 = -FIX(CLAMP(f4,0.0F,2.0F));
260  int x;
261 
262 #undef LumaBlue
263 #undef LumaGreen
264 #undef LumaRed
265 
266  /*
267  * i is the actual input pixel value in the range 0..255
268  * Cb and Cr values are in the range -128..127 (actually
269  * they are in a range defined by the ReferenceBlackWhite
270  * tag) so there is some range shifting to do here when
271  * constructing tables indexed by the raw pixel data.
272  */
273  for (i = 0, x = -128; i < 256; i++, x++) {
274  int32 Cr = (int32)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0F,
275  refBlackWhite[5] - 128.0F, 127),
276  -128.0F * 32, 128.0F * 32);
277  int32 Cb = (int32)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0F,
278  refBlackWhite[3] - 128.0F, 127),
279  -128.0F * 32, 128.0F * 32);
280 
281  ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);
282  ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);
283  ycbcr->Cr_g_tab[i] = D2*Cr;
284  ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF;
285  ycbcr->Y_tab[i] =
286  (int32)CLAMPw(Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255),
287  -128.0F * 32, 128.0F * 32);
288  }
289  }
290 
291  return 0;
292 }
#define LumaBlue
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:338
#define f3(x, y, z)
Definition: sha1.c:32
TIFFRGBValue * clamptab
Definition: tiffio.h:160
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned char TIFFRGBValue
Definition: tiffio.h:141
#define FIX(x)
Definition: tif_color.c:174
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CLAMP(f, min, max)
Definition: tif_color.c:177
#define LumaRed
int * Cr_r_tab
Definition: tiffio.h:161
int * Cb_b_tab
Definition: tiffio.h:162
int32 * Cb_g_tab
Definition: tiffio.h:164
unsigned char uint8
Definition: types.h:28
#define SHIFT
Definition: tif_color.c:173
int32 * Y_tab
Definition: tiffio.h:165
static float CLAMPw(float v, float vmin, float vmax)
Definition: tif_color.c:202
#define f4(x, y, z)
Definition: sha1.c:33
#define LumaGreen
#define f1(x, y, z)
Definition: sha1.c:30
#define ONE_HALF
Definition: tif_color.c:175
int32 * Cr_g_tab
Definition: tiffio.h:163
long int32
Definition: platform.h:12
int f2(S1 &, S2 &)
#define Code2V(c, RB, RW, CR)
Definition: tif_color.c:176
#define TIFFroundup_32(x, y)
Definition: tiffiop.h:256
#define F(x, y, z)
Definition: md5.c:51

Referenced by initYCbCrConversion().