Lines Matching refs:cinfo

108 emit_byte (j_compress_ptr cinfo, int val)
111 struct jpeg_destination_mgr * dest = cinfo->dest;
115 if (! (*dest->empty_output_buffer) (cinfo))
116 ERREXIT(cinfo, JERR_CANT_SUSPEND);
122 emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark)
125 emit_byte(cinfo, 0xFF);
126 emit_byte(cinfo, (int) mark);
131 emit_2bytes (j_compress_ptr cinfo, int value)
134 emit_byte(cinfo, (value >> 8) & 0xFF);
135 emit_byte(cinfo, value & 0xFF);
144 emit_dqt (j_compress_ptr cinfo, int index)
148 JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
153 ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
162 emit_marker(cinfo, M_DQT);
164 emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
166 emit_byte(cinfo, index + (prec<<4));
172 emit_byte(cinfo, (int) (qval >> 8));
173 emit_byte(cinfo, (int) (qval & 0xFF));
184 emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
191 htbl = cinfo->ac_huff_tbl_ptrs[index];
194 htbl = cinfo->dc_huff_tbl_ptrs[index];
198 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
201 emit_marker(cinfo, M_DHT);
207 emit_2bytes(cinfo, length + 2 + 1 + 16);
208 emit_byte(cinfo, index);
211 emit_byte(cinfo, htbl->bits[i]);
214 emit_byte(cinfo, htbl->huffval[i]);
222 emit_dac (j_compress_ptr cinfo)
236 for (i = 0; i < cinfo->comps_in_scan; i++) {
237 compptr = cinfo->cur_comp_info[i];
246 emit_marker(cinfo, M_DAC);
248 emit_2bytes(cinfo, length*2 + 2);
252 emit_byte(cinfo, i);
253 emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
256 emit_byte(cinfo, i + 0x10);
257 emit_byte(cinfo, cinfo->arith_ac_K[i]);
265 emit_dri (j_compress_ptr cinfo)
268 emit_marker(cinfo, M_DRI);
270 emit_2bytes(cinfo, 4); /* fixed length */
272 emit_2bytes(cinfo, (int) cinfo->restart_interval);
277 emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
283 emit_marker(cinfo, code);
285 emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
288 if ((long) cinfo->image_height > 65535L ||
289 (long) cinfo->image_width > 65535L)
290 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
292 emit_byte(cinfo, cinfo->data_precision);
293 emit_2bytes(cinfo, (int) cinfo->image_height);
294 emit_2bytes(cinfo, (int) cinfo->image_width);
296 emit_byte(cinfo, cinfo->num_components);
298 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
300 emit_byte(cinfo, compptr->component_id);
301 emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
302 emit_byte(cinfo, compptr->quant_tbl_no);
308 emit_sos (j_compress_ptr cinfo)
314 emit_marker(cinfo, M_SOS);
316 emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
318 emit_byte(cinfo, cinfo->comps_in_scan);
320 for (i = 0; i < cinfo->comps_in_scan; i++) {
321 compptr = cinfo->cur_comp_info[i];
322 emit_byte(cinfo, compptr->component_id);
325 if (cinfo->progressive_mode) {
331 if (cinfo->Ss == 0) {
333 if (cinfo->Ah != 0 && !cinfo->arith_code)
339 emit_byte(cinfo, (td << 4) + ta);
342 emit_byte(cinfo, cinfo->Ss);
343 emit_byte(cinfo, cinfo->Se);
344 emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
349 emit_jfif_app0 (j_compress_ptr cinfo)
364 emit_marker(cinfo, M_APP0);
366 emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
368 emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */
369 emit_byte(cinfo, 0x46);
370 emit_byte(cinfo, 0x49);
371 emit_byte(cinfo, 0x46);
372 emit_byte(cinfo, 0);
373 emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */
374 emit_byte(cinfo, cinfo->JFIF_minor_version);
375 emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
376 emit_2bytes(cinfo, (int) cinfo->X_density);
377 emit_2bytes(cinfo, (int) cinfo->Y_density);
378 emit_byte(cinfo, 0); /* No thumbnail image */
379 emit_byte(cinfo, 0);
384 emit_adobe_app14 (j_compress_ptr cinfo)
403 emit_marker(cinfo, M_APP14);
405 emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
407 emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */
408 emit_byte(cinfo, 0x64);
409 emit_byte(cinfo, 0x6F);
410 emit_byte(cinfo, 0x62);
411 emit_byte(cinfo, 0x65);
412 emit_2bytes(cinfo, 100); /* Version */
413 emit_2bytes(cinfo, 0); /* Flags0 */
414 emit_2bytes(cinfo, 0); /* Flags1 */
415 switch (cinfo->jpeg_color_space) {
417 emit_byte(cinfo, 1); /* Color transform = 1 */
420 emit_byte(cinfo, 2); /* Color transform = 2 */
423 emit_byte(cinfo, 0); /* Color transform = 0 */
438 write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen)
442 ERREXIT(cinfo, JERR_BAD_LENGTH);
444 emit_marker(cinfo, (JPEG_MARKER) marker);
446 emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */
450 write_marker_byte (j_compress_ptr cinfo, int val)
453 emit_byte(cinfo, val);
469 write_file_header (j_compress_ptr cinfo)
471 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
473 emit_marker(cinfo, M_SOI); /* first the SOI */
478 if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
479 emit_jfif_app0(cinfo);
480 if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
481 emit_adobe_app14(cinfo);
494 write_frame_header (j_compress_ptr cinfo)
504 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
506 prec += emit_dqt(cinfo, compptr->quant_tbl_no);
513 if (cinfo->arith_code || cinfo->progressive_mode ||
514 cinfo->data_precision != 8) {
518 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
526 TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
531 if (cinfo->arith_code) {
532 emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */
534 if (cinfo->progressive_mode)
535 emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */
537 emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */
539 emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */
551 write_scan_header (j_compress_ptr cinfo)
553 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
557 if (cinfo->arith_code) {
562 emit_dac(cinfo);
567 for (i = 0; i < cinfo->comps_in_scan; i++) {
568 compptr = cinfo->cur_comp_info[i];
569 if (cinfo->progressive_mode) {
571 if (cinfo->Ss == 0) {
572 if (cinfo->Ah == 0) /* DC needs no table for refinement scan */
573 emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
575 emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
579 emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
580 emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
588 if (cinfo->restart_interval != marker->last_restart_interval) {
589 emit_dri(cinfo);
590 marker->last_restart_interval = cinfo->restart_interval;
593 emit_sos(cinfo);
602 write_file_trailer (j_compress_ptr cinfo)
604 emit_marker(cinfo, M_EOI);
616 write_tables_only (j_compress_ptr cinfo)
620 emit_marker(cinfo, M_SOI);
623 if (cinfo->quant_tbl_ptrs[i] != NULL)
624 (void) emit_dqt(cinfo, i);
627 if (! cinfo->arith_code) {
629 if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
630 emit_dht(cinfo, i, FALSE);
631 if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
632 emit_dht(cinfo, i, TRUE);
636 emit_marker(cinfo, M_EOI);
645 jinit_marker_writer (j_compress_ptr cinfo)
651 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
653 cinfo->marker = (struct jpeg_marker_writer *) marker;