10 #define JPEG_INTERNALS 60 #define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) 61 #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) 76 cconvert->Cr_r_tab = (
int *)
79 cconvert->Cb_b_tab = (
int *)
82 cconvert->Cr_g_tab = (
INT32 *)
85 cconvert->Cb_g_tab = (
INT32 *)
93 cconvert->Cr_r_tab[i] = (int)
96 cconvert->Cb_b_tab[i] = (int)
99 cconvert->Cr_g_tab[i] = (-
FIX(0.71414)) *
x;
102 cconvert->Cb_g_tab[i] = (-
FIX(0.34414)) *
x +
ONE_HALF;
130 JSAMPLE * range_limit = cinfo->sample_range_limit;
131 int * Crrtab = cconvert->Cr_r_tab;
132 int * Cbbtab = cconvert->Cb_b_tab;
133 INT32 * Crgtab = cconvert->Cr_g_tab;
134 INT32 * Cbgtab = cconvert->Cb_g_tab;
143 for (col = 0; col <
num_cols; col++) {
148 outptr[RGB_RED] = range_limit[
y + Crrtab[cr]];
149 outptr[RGB_GREEN] = range_limit[
y +
152 outptr[RGB_BLUE] = range_limit[
y + Cbbtab[cb]];
153 outptr += RGB_PIXELSIZE;
174 int num_components = cinfo->num_components;
179 for (ci = 0; ci < num_components; ci++) {
184 outptr += num_components;
227 for (col = 0; col <
num_cols; col++) {
229 outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
230 outptr += RGB_PIXELSIZE;
251 JSAMPROW inptr0, inptr1, inptr2, inptr3;
255 JSAMPLE * range_limit = cinfo->sample_range_limit;
256 int * Crrtab = cconvert->Cr_r_tab;
257 int * Cbbtab = cconvert->Cb_b_tab;
258 INT32 * Crgtab = cconvert->Cr_g_tab;
259 INT32 * Cbgtab = cconvert->Cb_g_tab;
269 for (col = 0; col <
num_cols; col++) {
274 outptr[0] = range_limit[
MAXJSAMPLE - (
y + Crrtab[cr])];
278 outptr[2] = range_limit[
MAXJSAMPLE - (
y + Cbbtab[cb])];
280 outptr[3] = inptr3[col];
315 switch (cinfo->jpeg_color_space) {
317 if (cinfo->num_components != 1)
318 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
323 if (cinfo->num_components != 3)
324 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
329 if (cinfo->num_components != 4)
330 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
334 if (cinfo->num_components < 1)
335 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
344 switch (cinfo->out_color_space) {
346 cinfo->out_color_components = 1;
351 for (ci = 1; ci < cinfo->num_components; ci++)
352 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) {
364 }
else if (cinfo->jpeg_color_space ==
JCS_RGB && RGB_PIXELSIZE == 3) {
367 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
371 cinfo->out_color_components = 4;
372 if (cinfo->jpeg_color_space ==
JCS_YCCK) {
375 }
else if (cinfo->jpeg_color_space ==
JCS_CMYK) {
378 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
383 if (cinfo->out_color_space == cinfo->jpeg_color_space) {
384 cinfo->out_color_components = cinfo->num_components;
387 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
391 if (cinfo->quantize_colors)
392 cinfo->output_components = 1;
394 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)
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
int JSAMPARRAY int int num_rows
build_ycc_rgb_table(j_decompress_ptr cinfo)
int JSAMPARRAY int int JDIMENSION num_cols
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)