Lines Matching refs:dinfo
81 flush_packet (gif_dest_ptr dinfo) in flush_packet() argument
84 if (dinfo->bytesinpkt > 0) { /* never write zero-length packet */ in flush_packet()
85 dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++; in flush_packet()
86 if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt) in flush_packet()
87 != (size_t) dinfo->bytesinpkt) in flush_packet()
88 ERREXIT(dinfo->cinfo, JERR_FILE_WRITE); in flush_packet()
89 dinfo->bytesinpkt = 0; in flush_packet()
95 #define CHAR_OUT(dinfo,c) \ argument
96 { (dinfo)->packetbuf[++(dinfo)->bytesinpkt] = (char) (c); \
97 if ((dinfo)->bytesinpkt >= 255) \
98 flush_packet(dinfo); \
105 output (gif_dest_ptr dinfo, int code) in output() argument
109 dinfo->cur_accum |= ((INT32) code) << dinfo->cur_bits; in output()
110 dinfo->cur_bits += dinfo->n_bits; in output()
112 while (dinfo->cur_bits >= 8) { in output()
113 CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF); in output()
114 dinfo->cur_accum >>= 8; in output()
115 dinfo->cur_bits -= 8; in output()
143 compress_init (gif_dest_ptr dinfo, int i_bits) in compress_init() argument
147 dinfo->n_bits = i_bits; in compress_init()
148 dinfo->maxcode = MAXCODE(dinfo->n_bits); in compress_init()
149 dinfo->ClearCode = (1 << (i_bits - 1)); in compress_init()
150 dinfo->EOFCode = dinfo->ClearCode + 1; in compress_init()
151 dinfo->code_counter = dinfo->ClearCode + 2; in compress_init()
153 dinfo->bytesinpkt = 0; in compress_init()
154 dinfo->cur_accum = 0; in compress_init()
155 dinfo->cur_bits = 0; in compress_init()
157 output(dinfo, dinfo->ClearCode); in compress_init()
162 compress_pixel (gif_dest_ptr dinfo, int c) in compress_pixel() argument
168 output(dinfo, c); in compress_pixel()
172 if (dinfo->code_counter < dinfo->maxcode) { in compress_pixel()
173 dinfo->code_counter++; in compress_pixel()
175 output(dinfo, dinfo->ClearCode); in compress_pixel()
176 dinfo->code_counter = dinfo->ClearCode + 2; /* reset the counter */ in compress_pixel()
182 compress_term (gif_dest_ptr dinfo) in compress_term() argument
186 output(dinfo, dinfo->EOFCode); in compress_term()
188 if (dinfo->cur_bits > 0) { in compress_term()
189 CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF); in compress_term()
192 flush_packet(dinfo); in compress_term()
200 put_word (gif_dest_ptr dinfo, unsigned int w) in put_word() argument
203 putc(w & 0xFF, dinfo->pub.output_file); in put_word()
204 putc((w >> 8) & 0xFF, dinfo->pub.output_file); in put_word()
209 put_3bytes (gif_dest_ptr dinfo, int val) in put_3bytes() argument
212 putc(val, dinfo->pub.output_file); in put_3bytes()
213 putc(val, dinfo->pub.output_file); in put_3bytes()
214 putc(val, dinfo->pub.output_file); in put_3bytes()
219 emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) in emit_header() argument
224 int cshift = dinfo->cinfo->data_precision - 8; in emit_header()
228 ERREXIT1(dinfo->cinfo, JERR_TOO_MANY_COLORS, num_colors); in emit_header()
242 putc('G', dinfo->pub.output_file); in emit_header()
243 putc('I', dinfo->pub.output_file); in emit_header()
244 putc('F', dinfo->pub.output_file); in emit_header()
245 putc('8', dinfo->pub.output_file); in emit_header()
246 putc('7', dinfo->pub.output_file); in emit_header()
247 putc('a', dinfo->pub.output_file); in emit_header()
249 put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); in emit_header()
250 put_word(dinfo, (unsigned int) dinfo->cinfo->output_height); in emit_header()
254 putc(FlagByte, dinfo->pub.output_file); in emit_header()
255 putc(0, dinfo->pub.output_file); /* Background color index */ in emit_header()
256 putc(0, dinfo->pub.output_file); /* Reserved (aspect ratio in GIF89) */ in emit_header()
263 if (dinfo->cinfo->out_color_space == JCS_RGB) { in emit_header()
265 putc(GETJSAMPLE(colormap[0][i]) >> cshift, dinfo->pub.output_file); in emit_header()
266 putc(GETJSAMPLE(colormap[1][i]) >> cshift, dinfo->pub.output_file); in emit_header()
267 putc(GETJSAMPLE(colormap[2][i]) >> cshift, dinfo->pub.output_file); in emit_header()
270 put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift); in emit_header()
274 put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1)); in emit_header()
278 put_3bytes(dinfo, 0); in emit_header()
282 putc(',', dinfo->pub.output_file); /* separator */ in emit_header()
283 put_word(dinfo, 0); /* left/top offset */ in emit_header()
284 put_word(dinfo, 0); in emit_header()
285 put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); /* image size */ in emit_header()
286 put_word(dinfo, (unsigned int) dinfo->cinfo->output_height); in emit_header()
288 putc(0x00, dinfo->pub.output_file); in emit_header()
290 putc(InitCodeSize, dinfo->pub.output_file); in emit_header()
293 compress_init(dinfo, InitCodeSize+1); in emit_header()
302 start_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) in start_output_gif() argument
304 gif_dest_ptr dest = (gif_dest_ptr) dinfo; in start_output_gif()
319 put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo, in put_pixel_rows() argument
322 gif_dest_ptr dest = (gif_dest_ptr) dinfo; in put_pixel_rows()
338 finish_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo) in finish_output_gif() argument
340 gif_dest_ptr dest = (gif_dest_ptr) dinfo; in finish_output_gif()