aboutsummaryrefslogtreecommitdiff
path: root/jdcolor.c
diff options
context:
space:
mode:
authordcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db>2011-09-07 02:32:02 +0000
committerdcommander <dcommander@632fc199-4ca6-4c93-a231-07263d6284db>2011-09-07 02:32:02 +0000
commit397631278aabc0dccaa398db2a73b60aef60d04f (patch)
tree6fd6e72e5f0b79b08987e9a8da8fa4b635616f67 /jdcolor.c
parent9ecf54cfb06da6458add74b2cb669719663476ed (diff)
Back out CMYK-to-RGB conversions. There is really no way to properly do CMYK-to-RGB conversion without color management, which is out of scope for libjpeg-turbo. Applications wishing to do a trivial conversion, such as was implemented in these routines, can simply request CMYK output and do the trivial conversion themselves (or, even better, use an OSS color management library.) We should not encourage the use of in-library CMYK-to-RGB conversion as a substitute for color management.
git-svn-id: svn://svn.code.sf.net/p/libjpeg-turbo/code/trunk@695 632fc199-4ca6-4c93-a231-07263d6284db
Diffstat (limited to 'jdcolor.c')
-rw-r--r--jdcolor.c103
1 files changed, 0 insertions, 103 deletions
diff --git a/jdcolor.c b/jdcolor.c
index f8b176e..0af024c 100644
--- a/jdcolor.c
+++ b/jdcolor.c
@@ -107,104 +107,6 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
}
}
-/*
- * Convert inverted CMYK to RGB
- */
-METHODDEF(void)
-cmyk_rgb_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
-{
- JSAMPLE cyan, magenta, yellow, black;
- register JSAMPROW outptr;
- register JSAMPROW inptr0, inptr1, inptr2, inptr3;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->output_width;
- int rindex = rgb_red[cinfo->out_color_space];
- int gindex = rgb_green[cinfo->out_color_space];
- int bindex = rgb_blue[cinfo->out_color_space];
- int rgbstride = rgb_pixelsize[cinfo->out_color_space];
-
- while (--num_rows >= 0) {
- inptr0 = input_buf[0][input_row];
- inptr1 = input_buf[1][input_row];
- inptr2 = input_buf[2][input_row];
- inptr3 = input_buf[3][input_row];
- input_row++;
- outptr = *output_buf++;
- for (col = 0; col < num_cols; col++) {
- cyan = GETJSAMPLE(inptr0[col]);
- magenta = GETJSAMPLE(inptr1[col]);
- yellow = GETJSAMPLE(inptr2[col]);
- black = GETJSAMPLE(inptr3[col]);
-
- outptr[rindex] = (JSAMPLE)((int)cyan * (int)black / MAXJSAMPLE);
- outptr[gindex] = (JSAMPLE)((int)magenta * (int)black / MAXJSAMPLE);
- outptr[bindex] = (JSAMPLE)((int)yellow * (int)black / MAXJSAMPLE);
- outptr += rgbstride;
- }
- }
-}
-
-/*
- * Convert YCCK to RGB
- */
-METHODDEF(void)
-ycck_rgb_convert (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- JSAMPLE cyan, magenta, yellow, black;
- register int y, cb, cr;
- register JSAMPROW outptr;
- register JSAMPROW inptr0, inptr1, inptr2, inptr3;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->output_width;
- int rindex = rgb_red[cinfo->out_color_space];
- int gindex = rgb_green[cinfo->out_color_space];
- int bindex = rgb_blue[cinfo->out_color_space];
- int rgbstride = rgb_pixelsize[cinfo->out_color_space];
-
- /* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- register int * Crrtab = cconvert->Cr_r_tab;
- register int * Cbbtab = cconvert->Cb_b_tab;
- register INT32 * Crgtab = cconvert->Cr_g_tab;
- register INT32 * Cbgtab = cconvert->Cb_g_tab;
- SHIFT_TEMPS
-
- while (--num_rows >= 0) {
- inptr0 = input_buf[0][input_row];
- inptr1 = input_buf[1][input_row];
- inptr2 = input_buf[2][input_row];
- inptr3 = input_buf[3][input_row];
- input_row++;
- outptr = *output_buf++;
- for (col = 0; col < num_cols; col++) {
-
- /********* Read YCCK Pixel **********/
- y = GETJSAMPLE(inptr0[col]);
- cb = GETJSAMPLE(inptr1[col]);
- cr = GETJSAMPLE(inptr2[col]);
- black = GETJSAMPLE(inptr3[col]);
-
- /********* Convert YCCK to CMYK **********/
- /* Range-limiting is essential due to noise introduced by DCT losses. */
- cyan = range_limit[MAXJSAMPLE - (y + Crrtab[cr])];
- magenta = range_limit[MAXJSAMPLE - (y +
- ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
- SCALEBITS)))];
- yellow = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])];
-
- /********* Convert CMYK to RGB **********/
- outptr[rindex] = (JSAMPLE)((int)cyan * (int)black / MAXJSAMPLE);
- outptr[gindex] = (JSAMPLE)((int)magenta * (int)black / MAXJSAMPLE);
- outptr[bindex] = (JSAMPLE)((int)yellow * (int)black / MAXJSAMPLE);
- outptr += rgbstride;
- }
- }
-}
/*
* Convert some rows of samples to the output colorspace.
@@ -484,11 +386,6 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
} else if (cinfo->jpeg_color_space == cinfo->out_color_space &&
rgb_pixelsize[cinfo->out_color_space] == 3) {
cconvert->pub.color_convert = null_convert;
- } else if (cinfo->jpeg_color_space == JCS_CMYK) {
- cconvert->pub.color_convert = cmyk_rgb_convert;
- } else if (cinfo->jpeg_color_space == JCS_YCCK) {
- cconvert->pub.color_convert = ycck_rgb_convert;
- build_ycc_rgb_table(cinfo);
} else
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
break;