26 #ifdef QUANT_2PASS_SUPPORTED 48 JSAMPROW colormap0 = cinfo->colormap[0];
49 JSAMPROW colormap1 = cinfo->colormap[1];
50 JSAMPROW colormap2 = cinfo->colormap[2];
51 int ncolors = cinfo->actual_number_of_colors;
55 for (index = 0; index < ncolors; index++) {
67 colormap0[ncolors] = (
JSAMPLE) R;
68 colormap1[ncolors] = (
JSAMPLE) G;
69 colormap2[ncolors] = (
JSAMPLE) B;
70 cinfo->actual_number_of_colors++;
87 for (
i = 1;
i < 13;
i++) {
88 if ((header[
i] = getc(
infile)) == EOF)
89 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
93 if (header[1] !=
'I' || header[2] !=
'F')
94 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
97 if ((header[10] & 0x80) == 0)
98 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
101 colormaplen = 2 << (header[10] & 0x07);
103 for (
i = 0;
i < colormaplen;
i++) {
107 if (R == EOF || G == EOF ||
B == EOF)
108 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
131 }
while (ch !=
'\n' && ch != EOF);
145 register unsigned int val;
151 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
152 }
while (ch ==
' ' || ch ==
'\t' || ch ==
'\n' || ch ==
'\r');
154 if (ch < '0' || ch >
'9')
155 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
174 unsigned int w, h, maxval,
row, col;
185 if (
w <= 0 || h <= 0 || maxval <= 0)
186 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
190 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
195 for (col = 0; col <
w; col++) {
206 for (col = 0; col <
w; col++) {
210 if (R == EOF || G == EOF ||
B == EOF)
211 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
218 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
234 cinfo->colormap = (*cinfo->mem->alloc_sarray)
237 cinfo->actual_number_of_colors = 0;
248 ERREXIT(cinfo, JERR_BAD_CMAP_FILE);
add_map_entry(j_decompress_ptr cinfo, int R, int G, int B)
#define GETJSAMPLE(value)
#define ERREXIT(cinfo, code)
read_pbm_integer(j_decompress_ptr cinfo, FILE *infile)
read_color_map(j_decompress_ptr cinfo, FILE *infile)
read_ppm_map(j_decompress_ptr cinfo, FILE *infile)
read_gif_map(j_decompress_ptr cinfo, FILE *infile)
#define ERREXIT1(cinfo, code, p1)