10 #define JPEG_INTERNALS 59 #define ONE_HALF ((INT32)1 << (SCALEBITS - 1)) 60 #define FIX(x) ((INT32)((x) * (1L << SCALEBITS) + 0.5)) 74 cconvert->Cr_r_tab = (
int*)(*cinfo->mem->alloc_small)(
76 cconvert->Cb_b_tab = (
int*)(*cinfo->mem->alloc_small)(
78 cconvert->Cr_g_tab = (
INT32*)(*cinfo->mem->alloc_small)(
80 cconvert->Cb_g_tab = (
INT32*)(*cinfo->mem->alloc_small)(
88 cconvert->Cr_r_tab[i] =
91 cconvert->Cb_b_tab[i] =
94 cconvert->Cr_g_tab[i] = (-
FIX(0.71414)) *
x;
125 int* Crrtab = cconvert->Cr_r_tab;
126 int* Cbbtab = cconvert->Cb_b_tab;
127 INT32* Crgtab = cconvert->Cr_g_tab;
128 INT32* Cbgtab = cconvert->Cb_g_tab;
131 while (--num_rows >= 0)
133 inptr0 = input_buf[0][input_row];
134 inptr1 = input_buf[1][input_row];
135 inptr2 = input_buf[2][input_row];
138 for (col = 0; col < num_cols; col++)
169 int num_components = cinfo->num_components;
173 while (--num_rows >= 0)
175 for (ci = 0; ci < num_components; ci++)
177 inptr = input_buf[ci][input_row];
202 input_buf[0], (
int)input_row,
output_buf, 0, num_rows,
203 cinfo->output_width);
221 while (--num_rows >= 0)
223 inptr = input_buf[0][input_row++];
225 for (col = 0; col < num_cols; col++)
249 JSAMPROW inptr0, inptr1, inptr2, inptr3;
254 int* Crrtab = cconvert->Cr_r_tab;
255 int* Cbbtab = cconvert->Cb_b_tab;
256 INT32* Crgtab = cconvert->Cr_g_tab;
257 INT32* Cbgtab = cconvert->Cb_g_tab;
260 while (--num_rows >= 0)
262 inptr0 = input_buf[0][input_row];
263 inptr1 = input_buf[1][input_row];
264 inptr2 = input_buf[2][input_row];
265 inptr3 = input_buf[3][input_row];
268 for (col = 0; col < num_cols; col++)
310 switch (cinfo->jpeg_color_space)
313 if (cinfo->num_components != 1)
314 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
319 if (cinfo->num_components != 3)
320 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
325 if (cinfo->num_components != 4)
326 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
330 if (cinfo->num_components < 1)
331 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
340 switch (cinfo->out_color_space)
343 cinfo->out_color_components = 1;
350 for (ci = 1; ci < cinfo->num_components; ci++)
351 cinfo->comp_info[ci].component_needed =
FALSE;
354 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
358 cinfo->out_color_components = RGB_PIXELSIZE;
359 if (cinfo->jpeg_color_space ==
JCS_YCbCr)
368 else if (cinfo->jpeg_color_space ==
JCS_RGB && RGB_PIXELSIZE == 3)
373 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
377 cinfo->out_color_components = 4;
378 if (cinfo->jpeg_color_space ==
JCS_YCCK)
383 else if (cinfo->jpeg_color_space ==
JCS_CMYK)
388 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
393 if (cinfo->out_color_space == cinfo->jpeg_color_space)
395 cinfo->out_color_components = cinfo->num_components;
399 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
403 if (cinfo->quantize_colors)
404 cinfo->output_components = 1;
406 cinfo->output_components = cinfo->out_color_components;
GLuint GLuint GLsizei count
start_pass_dcolor(j_decompress_ptr)
null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
struct jpeg_common_struct * j_common_ptr
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, JSAMPARRAY output_array, int dest_row, int num_rows, JDIMENSION num_cols)
ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
jinit_color_deconverter(j_decompress_ptr cinfo)
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf
ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
my_color_deconverter * my_cconvert_ptr
struct jpeg_color_converter pub
build_ycc_rgb_table(j_decompress_ptr cinfo)
gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
#define RIGHT_SHIFT(x, shft)
grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)