OLD | NEW |
1 /* | 1 /* |
2 * jccolext.c | 2 * jccolext.c |
3 * | 3 * |
4 * Copyright (C) 1991-1996, Thomas G. Lane. | 4 * Copyright (C) 1991-1996, Thomas G. Lane. |
5 * Copyright (C) 2009-2011, D. R. Commander. | 5 * Copyright (C) 2009-2012, D. R. Commander. |
6 * This file is part of the Independent JPEG Group's software. | 6 * This file is part of the Independent JPEG Group's software. |
7 * For conditions of distribution and use, see the accompanying README file. | 7 * For conditions of distribution and use, see the accompanying README file. |
8 * | 8 * |
9 * This file contains input colorspace conversion routines. | 9 * This file contains input colorspace conversion routines. |
10 */ | 10 */ |
11 | 11 |
12 | 12 |
13 /* This file is included by jccolor.c */ | 13 /* This file is included by jccolor.c */ |
14 | 14 |
15 | 15 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 g = GETJSAMPLE(inptr[RGB_GREEN]); | 105 g = GETJSAMPLE(inptr[RGB_GREEN]); |
106 b = GETJSAMPLE(inptr[RGB_BLUE]); | 106 b = GETJSAMPLE(inptr[RGB_BLUE]); |
107 inptr += RGB_PIXELSIZE; | 107 inptr += RGB_PIXELSIZE; |
108 /* Y */ | 108 /* Y */ |
109 outptr[col] = (JSAMPLE) | 109 outptr[col] = (JSAMPLE) |
110 ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) | 110 ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) |
111 >> SCALEBITS); | 111 >> SCALEBITS); |
112 } | 112 } |
113 } | 113 } |
114 } | 114 } |
| 115 |
| 116 |
| 117 /* |
| 118 * Convert some rows of samples to the JPEG colorspace. |
| 119 * This version handles extended RGB->plain RGB conversion |
| 120 */ |
| 121 |
| 122 INLINE |
| 123 LOCAL(void) |
| 124 rgb_rgb_convert_internal (j_compress_ptr cinfo, |
| 125 JSAMPARRAY input_buf, JSAMPIMAGE output_buf, |
| 126 JDIMENSION output_row, int num_rows) |
| 127 { |
| 128 register JSAMPROW inptr; |
| 129 register JSAMPROW outptr0, outptr1, outptr2; |
| 130 register JDIMENSION col; |
| 131 JDIMENSION num_cols = cinfo->image_width; |
| 132 |
| 133 while (--num_rows >= 0) { |
| 134 inptr = *input_buf++; |
| 135 outptr0 = output_buf[0][output_row]; |
| 136 outptr1 = output_buf[1][output_row]; |
| 137 outptr2 = output_buf[2][output_row]; |
| 138 output_row++; |
| 139 for (col = 0; col < num_cols; col++) { |
| 140 outptr0[col] = GETJSAMPLE(inptr[RGB_RED]); |
| 141 outptr1[col] = GETJSAMPLE(inptr[RGB_GREEN]); |
| 142 outptr2[col] = GETJSAMPLE(inptr[RGB_BLUE]); |
| 143 inptr += RGB_PIXELSIZE; |
| 144 } |
| 145 } |
| 146 } |
OLD | NEW |