32 #if BITS_IN_JSAMPLE != 8
33 Sorry,
this code only copes with 8-bit JSAMPLEs.
51 #define CMAPLENGTH (1<<(CMAPBITS))
62 typedef rle_dest_struct * rle_dest_ptr;
79 rle_dest_ptr dest = (rle_dest_ptr) dinfo;
82 #ifdef PROGRESS_REPORT
105 ERREXIT(cinfo, JERR_RLE_COLORSPACE);
112 dest->colormap = NULL;
117 dest->colormap = (rle_map *) (*cinfo->mem->alloc_small)
119 MEMZERO(dest->colormap, cmapsize);
125 dest->colormap[ci * CMAPLENGTH +
i] =
132 dest->pub.buffer = (*cinfo->mem->access_virt_sarray)
134 dest->pub.buffer_height = 1;
136 dest->pub.put_pixel_rows = rle_put_pixel_rows;
138 #ifdef PROGRESS_REPORT
156 rle_dest_ptr dest = (rle_dest_ptr) dinfo;
159 dest->pub.buffer = (*cinfo->mem->access_virt_sarray)
174 rle_dest_ptr dest = (rle_dest_ptr) dinfo;
176 rle_pixel **rle_row, *
red, *
green, *blue;
178 char cmapcomment[80];
181 #ifdef PROGRESS_REPORT
186 header = *rle_hdr_init(NULL);
187 header.rle_file = dest->pub.output_file;
195 RLE_SET_BIT(header, ci);
199 header.cmaplen = CMAPBITS;
200 header.cmap = dest->colormap;
203 rle_putcom(cmapcomment, &header);
207 rle_put_setup(&header);
214 #ifdef PROGRESS_REPORT
224 rle_row = (rle_pixel **) (*cinfo->mem->access_virt_sarray)
227 rle_putrow(rle_row, (
int) cinfo->
output_width, &header);
228 #ifdef PROGRESS_REPORT
237 rle_row = (rle_pixel **) dest->rle_row;
238 output_row = * (*cinfo->mem->access_virt_sarray)
249 rle_putrow(rle_row, (
int) cinfo->
output_width, &header);
250 #ifdef PROGRESS_REPORT
259 #ifdef PROGRESS_REPORT
266 fflush(dest->pub.output_file);
267 if (ferror(dest->pub.output_file))
268 ERREXIT(cinfo, JERR_FILE_WRITE);
282 dest = (rle_dest_ptr)
285 dest->pub.start_output = start_output_rle;
286 dest->pub.finish_output = finish_output_rle;
292 dest->rle_row = (*cinfo->mem->alloc_sarray)
297 dest->image = (*cinfo->mem->request_virt_sarray)