Lines Matching refs:dinfo
83 flush_packet (gif_dest_ptr dinfo)
86 if (dinfo->bytesinpkt > 0) { /* never write zero-length packet */
87 dinfo->packetbuf[0] = (char) dinfo->bytesinpkt++;
88 if (JFWRITE(dinfo->pub.output_file, dinfo->packetbuf, dinfo->bytesinpkt)
89 != (size_t) dinfo->bytesinpkt)
90 ERREXIT(dinfo->cinfo, JERR_FILE_WRITE);
91 dinfo->bytesinpkt = 0;
97 #define CHAR_OUT(dinfo,c) \
98 { (dinfo)->packetbuf[++(dinfo)->bytesinpkt] = (char) (c); \
99 if ((dinfo)->bytesinpkt >= 255) \
100 flush_packet(dinfo); \
107 output (gif_dest_ptr dinfo, int code)
111 dinfo->cur_accum |= ((INT32) code) << dinfo->cur_bits;
112 dinfo->cur_bits += dinfo->n_bits;
114 while (dinfo->cur_bits >= 8) {
115 CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF);
116 dinfo->cur_accum >>= 8;
117 dinfo->cur_bits -= 8;
145 compress_init (gif_dest_ptr dinfo, int i_bits)
149 dinfo->n_bits = i_bits;
150 dinfo->maxcode = MAXCODE(dinfo->n_bits);
151 dinfo->ClearCode = (1 << (i_bits - 1));
152 dinfo->EOFCode = dinfo->ClearCode + 1;
153 dinfo->code_counter = dinfo->ClearCode + 2;
155 dinfo->bytesinpkt = 0;
156 dinfo->cur_accum = 0;
157 dinfo->cur_bits = 0;
159 output(dinfo, dinfo->ClearCode);
164 compress_pixel (gif_dest_ptr dinfo, int c)
170 output(dinfo, c);
174 if (dinfo->code_counter < dinfo->maxcode) {
175 dinfo->code_counter++;
177 output(dinfo, dinfo->ClearCode);
178 dinfo->code_counter = dinfo->ClearCode + 2; /* reset the counter */
184 compress_term (gif_dest_ptr dinfo)
188 output(dinfo, dinfo->EOFCode);
190 if (dinfo->cur_bits > 0) {
191 CHAR_OUT(dinfo, dinfo->cur_accum & 0xFF);
194 flush_packet(dinfo);
202 put_word (gif_dest_ptr dinfo, unsigned int w)
205 putc(w & 0xFF, dinfo->pub.output_file);
206 putc((w >> 8) & 0xFF, dinfo->pub.output_file);
211 put_3bytes (gif_dest_ptr dinfo, int val)
214 putc(val, dinfo->pub.output_file);
215 putc(val, dinfo->pub.output_file);
216 putc(val, dinfo->pub.output_file);
221 emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap)
226 int cshift = dinfo->cinfo->data_precision - 8;
230 ERREXIT1(dinfo->cinfo, JERR_TOO_MANY_COLORS, num_colors);
244 putc('G', dinfo->pub.output_file);
245 putc('I', dinfo->pub.output_file);
246 putc('F', dinfo->pub.output_file);
247 putc('8', dinfo->pub.output_file);
248 putc('7', dinfo->pub.output_file);
249 putc('a', dinfo->pub.output_file);
251 put_word(dinfo, (unsigned int) dinfo->cinfo->output_width);
252 put_word(dinfo, (unsigned int) dinfo->cinfo->output_height);
256 putc(FlagByte, dinfo->pub.output_file);
257 putc(0, dinfo->pub.output_file); /* Background color index */
258 putc(0, dinfo->pub.output_file); /* Reserved (aspect ratio in GIF89) */
265 if (dinfo->cinfo->out_color_space == JCS_RGB) {
267 putc(GETJSAMPLE(colormap[0][i]) >> cshift, dinfo->pub.output_file);
268 putc(GETJSAMPLE(colormap[1][i]) >> cshift, dinfo->pub.output_file);
269 putc(GETJSAMPLE(colormap[2][i]) >> cshift, dinfo->pub.output_file);
272 put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift);
276 put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1));
280 put_3bytes(dinfo, 0);
284 putc(',', dinfo->pub.output_file); /* separator */
285 put_word(dinfo, 0); /* left/top offset */
286 put_word(dinfo, 0);
287 put_word(dinfo, (unsigned int) dinfo->cinfo->output_width); /* image size */
288 put_word(dinfo, (unsigned int) dinfo->cinfo->output_height);
290 putc(0x00, dinfo->pub.output_file);
292 putc(InitCodeSize, dinfo->pub.output_file);
295 compress_init(dinfo, InitCodeSize+1);
304 start_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
306 gif_dest_ptr dest = (gif_dest_ptr) dinfo;
321 put_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
324 gif_dest_ptr dest = (gif_dest_ptr) dinfo;
340 finish_output_gif (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
342 gif_dest_ptr dest = (gif_dest_ptr) dinfo;