11 #define JPEG_INTERNALS 59 #define CBCR_OFFSET ((INT32) CENTERJSAMPLE << SCALEBITS) 60 #define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) 61 #define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) 70 #define G_Y_OFF (1*(MAXJSAMPLE+1)) 71 #define B_Y_OFF (2*(MAXJSAMPLE+1)) 72 #define R_CB_OFF (3*(MAXJSAMPLE+1)) 73 #define G_CB_OFF (4*(MAXJSAMPLE+1)) 74 #define B_CB_OFF (5*(MAXJSAMPLE+1)) 75 #define R_CR_OFF B_CB_OFF 76 #define G_CR_OFF (6*(MAXJSAMPLE+1)) 77 #define B_CR_OFF (7*(MAXJSAMPLE+1)) 78 #define TABLE_SIZE (8*(MAXJSAMPLE+1)) 93 cconvert->rgb_ycc_tab = rgb_ycc_tab = (
INT32 *)
135 register int r,
g,
b;
136 register INT32 * ctab = cconvert->rgb_ycc_tab;
138 register JSAMPROW outptr0, outptr1, outptr2;
143 inptr = *input_buf++;
148 for (col = 0; col <
num_cols; col++) {
152 inptr += RGB_PIXELSIZE;
191 register int r,
g,
b;
192 register INT32 * ctab = cconvert->rgb_ycc_tab;
199 inptr = *input_buf++;
202 for (col = 0; col <
num_cols; col++) {
206 inptr += RGB_PIXELSIZE;
230 register int r,
g,
b;
231 register INT32 * ctab = cconvert->rgb_ycc_tab;
233 register JSAMPROW outptr0, outptr1, outptr2, outptr3;
238 inptr = *input_buf++;
244 for (col = 0; col <
num_cols; col++) {
249 outptr3[col] = inptr[3];
288 int instride = cinfo->input_components;
291 inptr = *input_buf++;
294 for (col = 0; col <
num_cols; col++) {
295 outptr[col] = inptr[0];
317 int nc = cinfo->num_components;
322 for (ci = 0; ci < nc; ci++) {
325 for (col = 0; col <
num_cols; col++) {
326 outptr[col] = inptr[ci];
358 SIZEOF(my_color_converter));
364 switch (cinfo->in_color_space) {
366 if (cinfo->input_components != 1)
367 ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
371 #if RGB_PIXELSIZE != 3 372 if (cinfo->input_components != RGB_PIXELSIZE)
373 ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
378 if (cinfo->input_components != 3)
379 ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
384 if (cinfo->input_components != 4)
385 ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
389 if (cinfo->input_components < 1)
390 ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
395 switch (cinfo->jpeg_color_space) {
397 if (cinfo->num_components != 1)
398 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
401 else if (cinfo->in_color_space ==
JCS_RGB) {
404 }
else if (cinfo->in_color_space ==
JCS_YCbCr)
407 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
411 if (cinfo->num_components != 3)
412 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
413 if (cinfo->in_color_space ==
JCS_RGB && RGB_PIXELSIZE == 3)
416 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
420 if (cinfo->num_components != 3)
421 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
422 if (cinfo->in_color_space ==
JCS_RGB) {
425 }
else if (cinfo->in_color_space ==
JCS_YCbCr)
428 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
432 if (cinfo->num_components != 4)
433 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
434 if (cinfo->in_color_space ==
JCS_CMYK)
437 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
441 if (cinfo->num_components != 4)
442 ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
443 if (cinfo->in_color_space ==
JCS_CMYK) {
446 }
else if (cinfo->in_color_space ==
JCS_YCCK)
449 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
453 if (cinfo->jpeg_color_space != cinfo->in_color_space ||
454 cinfo->num_components != cinfo->input_components)
455 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
struct jpeg_common_struct * j_common_ptr
my_color_converter * my_cconvert_ptr
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
GLboolean GLboolean GLboolean b
grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
jinit_color_converter(j_compress_ptr cinfo)
int JSAMPARRAY int int num_rows
rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
null_method(j_compress_ptr cinfo)
GLdouble GLdouble GLdouble r
rgb_ycc_start(j_compress_ptr cinfo)
int JSAMPARRAY int int JDIMENSION num_cols
jpeg_component_info JCOEFPTR JSAMPARRAY output_buf