Lines Matching refs:cinfo

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