Lines Matching refs:cinfo

110 emit_byte (j_compress_ptr cinfo, int val)  in emit_byte()  argument
113 struct jpeg_destination_mgr * dest = cinfo->dest; in emit_byte()
117 if (! (*dest->empty_output_buffer) (cinfo)) in emit_byte()
118 ERREXIT(cinfo, JERR_CANT_SUSPEND); in emit_byte()
124 emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark) in emit_marker() argument
127 emit_byte(cinfo, 0xFF); in emit_marker()
128 emit_byte(cinfo, (int) mark); in emit_marker()
133 emit_2bytes (j_compress_ptr cinfo, int value) in emit_2bytes() argument
136 emit_byte(cinfo, (value >> 8) & 0xFF); in emit_2bytes()
137 emit_byte(cinfo, value & 0xFF); in emit_2bytes()
146 emit_dqt (j_compress_ptr cinfo, int index) in emit_dqt() argument
150 JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index]; in emit_dqt()
155 ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index); in emit_dqt()
158 for (i = 0; i <= cinfo->lim_Se; i++) { in emit_dqt()
159 if (qtbl->quantval[cinfo->natural_order[i]] > 255) in emit_dqt()
164 emit_marker(cinfo, M_DQT); in emit_dqt()
166 emit_2bytes(cinfo, in emit_dqt()
167 prec ? cinfo->lim_Se * 2 + 2 + 1 + 2 : cinfo->lim_Se + 1 + 1 + 2); in emit_dqt()
169 emit_byte(cinfo, index + (prec<<4)); in emit_dqt()
171 for (i = 0; i <= cinfo->lim_Se; i++) { in emit_dqt()
173 unsigned int qval = qtbl->quantval[cinfo->natural_order[i]]; in emit_dqt()
175 emit_byte(cinfo, (int) (qval >> 8)); in emit_dqt()
176 emit_byte(cinfo, (int) (qval & 0xFF)); in emit_dqt()
187 emit_dht (j_compress_ptr cinfo, int index, boolean is_ac) in emit_dht() argument
194 htbl = cinfo->ac_huff_tbl_ptrs[index]; in emit_dht()
197 htbl = cinfo->dc_huff_tbl_ptrs[index]; in emit_dht()
201 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index); in emit_dht()
204 emit_marker(cinfo, M_DHT); in emit_dht()
210 emit_2bytes(cinfo, length + 2 + 1 + 16); in emit_dht()
211 emit_byte(cinfo, index); in emit_dht()
214 emit_byte(cinfo, htbl->bits[i]); in emit_dht()
217 emit_byte(cinfo, htbl->huffval[i]); in emit_dht()
225 emit_dac (j_compress_ptr cinfo) in emit_dac() argument
239 for (i = 0; i < cinfo->comps_in_scan; i++) { in emit_dac()
240 compptr = cinfo->cur_comp_info[i]; in emit_dac()
242 if (cinfo->Ss == 0 && cinfo->Ah == 0) in emit_dac()
245 if (cinfo->Se) in emit_dac()
254 emit_marker(cinfo, M_DAC); in emit_dac()
256 emit_2bytes(cinfo, length*2 + 2); in emit_dac()
260 emit_byte(cinfo, i); in emit_dac()
261 emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4)); in emit_dac()
264 emit_byte(cinfo, i + 0x10); in emit_dac()
265 emit_byte(cinfo, cinfo->arith_ac_K[i]); in emit_dac()
274 emit_dri (j_compress_ptr cinfo) in emit_dri() argument
277 emit_marker(cinfo, M_DRI); in emit_dri()
279 emit_2bytes(cinfo, 4); /* fixed length */ in emit_dri()
281 emit_2bytes(cinfo, (int) cinfo->restart_interval); in emit_dri()
286 emit_lse_ict (j_compress_ptr cinfo) in emit_lse_ict() argument
290 if (cinfo->color_transform != JCT_SUBTRACT_GREEN || in emit_lse_ict()
291 cinfo->num_components < 3) in emit_lse_ict()
292 ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); in emit_lse_ict()
294 emit_marker(cinfo, M_JPG8); in emit_lse_ict()
296 emit_2bytes(cinfo, 24); /* fixed length */ in emit_lse_ict()
298 emit_byte(cinfo, 0x0D); /* ID inverse transform specification */ in emit_lse_ict()
299 emit_2bytes(cinfo, MAXJSAMPLE); /* MAXTRANS */ in emit_lse_ict()
300 emit_byte(cinfo, 3); /* Nt=3 */ in emit_lse_ict()
301 emit_byte(cinfo, cinfo->comp_info[1].component_id); in emit_lse_ict()
302 emit_byte(cinfo, cinfo->comp_info[0].component_id); in emit_lse_ict()
303 emit_byte(cinfo, cinfo->comp_info[2].component_id); in emit_lse_ict()
304 emit_byte(cinfo, 0x80); /* F1: CENTER1=1, NORM1=0 */ in emit_lse_ict()
305 emit_2bytes(cinfo, 0); /* A(1,1)=0 */ in emit_lse_ict()
306 emit_2bytes(cinfo, 0); /* A(1,2)=0 */ in emit_lse_ict()
307 emit_byte(cinfo, 0); /* F2: CENTER2=0, NORM2=0 */ in emit_lse_ict()
308 emit_2bytes(cinfo, 1); /* A(2,1)=1 */ in emit_lse_ict()
309 emit_2bytes(cinfo, 0); /* A(2,2)=0 */ in emit_lse_ict()
310 emit_byte(cinfo, 0); /* F3: CENTER3=0, NORM3=0 */ in emit_lse_ict()
311 emit_2bytes(cinfo, 1); /* A(3,1)=1 */ in emit_lse_ict()
312 emit_2bytes(cinfo, 0); /* A(3,2)=0 */ in emit_lse_ict()
317 emit_sof (j_compress_ptr cinfo, JPEG_MARKER code) in emit_sof() argument
323 emit_marker(cinfo, code); in emit_sof()
325 emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ in emit_sof()
328 if ((long) cinfo->jpeg_height > 65535L || in emit_sof()
329 (long) cinfo->jpeg_width > 65535L) in emit_sof()
330 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535); in emit_sof()
332 emit_byte(cinfo, cinfo->data_precision); in emit_sof()
333 emit_2bytes(cinfo, (int) cinfo->jpeg_height); in emit_sof()
334 emit_2bytes(cinfo, (int) cinfo->jpeg_width); in emit_sof()
336 emit_byte(cinfo, cinfo->num_components); in emit_sof()
338 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in emit_sof()
340 emit_byte(cinfo, compptr->component_id); in emit_sof()
341 emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor); in emit_sof()
342 emit_byte(cinfo, compptr->quant_tbl_no); in emit_sof()
348 emit_sos (j_compress_ptr cinfo) in emit_sos() argument
354 emit_marker(cinfo, M_SOS); in emit_sos()
356 emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */ in emit_sos()
358 emit_byte(cinfo, cinfo->comps_in_scan); in emit_sos()
360 for (i = 0; i < cinfo->comps_in_scan; i++) { in emit_sos()
361 compptr = cinfo->cur_comp_info[i]; in emit_sos()
362 emit_byte(cinfo, compptr->component_id); in emit_sos()
369 td = cinfo->Ss == 0 && cinfo->Ah == 0 ? compptr->dc_tbl_no : 0; in emit_sos()
371 ta = cinfo->Se ? compptr->ac_tbl_no : 0; in emit_sos()
373 emit_byte(cinfo, (td << 4) + ta); in emit_sos()
376 emit_byte(cinfo, cinfo->Ss); in emit_sos()
377 emit_byte(cinfo, cinfo->Se); in emit_sos()
378 emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al); in emit_sos()
383 emit_pseudo_sos (j_compress_ptr cinfo) in emit_pseudo_sos() argument
386 emit_marker(cinfo, M_SOS); in emit_pseudo_sos()
388 emit_2bytes(cinfo, 2 + 1 + 3); /* length */ in emit_pseudo_sos()
390 emit_byte(cinfo, 0); /* Ns */ in emit_pseudo_sos()
392 emit_byte(cinfo, 0); /* Ss */ in emit_pseudo_sos()
393 emit_byte(cinfo, cinfo->block_size * cinfo->block_size - 1); /* Se */ in emit_pseudo_sos()
394 emit_byte(cinfo, 0); /* Ah/Al */ in emit_pseudo_sos()
399 emit_jfif_app0 (j_compress_ptr cinfo) in emit_jfif_app0() argument
414 emit_marker(cinfo, M_APP0); in emit_jfif_app0()
416 emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */ in emit_jfif_app0()
418 emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */ in emit_jfif_app0()
419 emit_byte(cinfo, 0x46); in emit_jfif_app0()
420 emit_byte(cinfo, 0x49); in emit_jfif_app0()
421 emit_byte(cinfo, 0x46); in emit_jfif_app0()
422 emit_byte(cinfo, 0); in emit_jfif_app0()
423 emit_byte(cinfo, cinfo->JFIF_major_version); /* Version fields */ in emit_jfif_app0()
424 emit_byte(cinfo, cinfo->JFIF_minor_version); in emit_jfif_app0()
425 emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */ in emit_jfif_app0()
426 emit_2bytes(cinfo, (int) cinfo->X_density); in emit_jfif_app0()
427 emit_2bytes(cinfo, (int) cinfo->Y_density); in emit_jfif_app0()
428 emit_byte(cinfo, 0); /* No thumbnail image */ in emit_jfif_app0()
429 emit_byte(cinfo, 0); in emit_jfif_app0()
434 emit_adobe_app14 (j_compress_ptr cinfo) in emit_adobe_app14() argument
453 emit_marker(cinfo, M_APP14); in emit_adobe_app14()
455 emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */ in emit_adobe_app14()
457 emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */ in emit_adobe_app14()
458 emit_byte(cinfo, 0x64); in emit_adobe_app14()
459 emit_byte(cinfo, 0x6F); in emit_adobe_app14()
460 emit_byte(cinfo, 0x62); in emit_adobe_app14()
461 emit_byte(cinfo, 0x65); in emit_adobe_app14()
462 emit_2bytes(cinfo, 100); /* Version */ in emit_adobe_app14()
463 emit_2bytes(cinfo, 0); /* Flags0 */ in emit_adobe_app14()
464 emit_2bytes(cinfo, 0); /* Flags1 */ in emit_adobe_app14()
465 switch (cinfo->jpeg_color_space) { in emit_adobe_app14()
467 emit_byte(cinfo, 1); /* Color transform = 1 */ in emit_adobe_app14()
470 emit_byte(cinfo, 2); /* Color transform = 2 */ in emit_adobe_app14()
473 emit_byte(cinfo, 0); /* Color transform = 0 */ in emit_adobe_app14()
488 write_marker_header (j_compress_ptr cinfo, int marker, unsigned int datalen) in write_marker_header() argument
492 ERREXIT(cinfo, JERR_BAD_LENGTH); in write_marker_header()
494 emit_marker(cinfo, (JPEG_MARKER) marker); in write_marker_header()
496 emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */ in write_marker_header()
500 write_marker_byte (j_compress_ptr cinfo, int val) in write_marker_byte() argument
503 emit_byte(cinfo, val); in write_marker_byte()
519 write_file_header (j_compress_ptr cinfo) in write_file_header() argument
521 my_marker_ptr marker = (my_marker_ptr) cinfo->marker; in write_file_header()
523 emit_marker(cinfo, M_SOI); /* first the SOI */ in write_file_header()
528 if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */ in write_file_header()
529 emit_jfif_app0(cinfo); in write_file_header()
530 if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */ in write_file_header()
531 emit_adobe_app14(cinfo); in write_file_header()
545 write_frame_header (j_compress_ptr cinfo) in write_frame_header() argument
555 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in write_frame_header()
557 prec += emit_dqt(cinfo, compptr->quant_tbl_no); in write_frame_header()
564 if (cinfo->arith_code || cinfo->progressive_mode || in write_frame_header()
565 cinfo->data_precision != 8 || cinfo->block_size != DCTSIZE) { in write_frame_header()
569 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in write_frame_header()
577 TRACEMS(cinfo, 0, JTRC_16BIT_TABLES); in write_frame_header()
582 if (cinfo->arith_code) { in write_frame_header()
583 if (cinfo->progressive_mode) in write_frame_header()
584 emit_sof(cinfo, M_SOF10); /* SOF code for progressive arithmetic */ in write_frame_header()
586 emit_sof(cinfo, M_SOF9); /* SOF code for sequential arithmetic */ in write_frame_header()
588 if (cinfo->progressive_mode) in write_frame_header()
589 emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */ in write_frame_header()
591 emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */ in write_frame_header()
593 emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */ in write_frame_header()
597 if (cinfo->color_transform) in write_frame_header()
598 emit_lse_ict(cinfo); in write_frame_header()
601 if (cinfo->progressive_mode && cinfo->block_size != DCTSIZE) in write_frame_header()
602 emit_pseudo_sos(cinfo); in write_frame_header()
613 write_scan_header (j_compress_ptr cinfo) in write_scan_header() argument
615 my_marker_ptr marker = (my_marker_ptr) cinfo->marker; in write_scan_header()
619 if (cinfo->arith_code) { in write_scan_header()
624 emit_dac(cinfo); in write_scan_header()
629 for (i = 0; i < cinfo->comps_in_scan; i++) { in write_scan_header()
630 compptr = cinfo->cur_comp_info[i]; in write_scan_header()
632 if (cinfo->Ss == 0 && cinfo->Ah == 0) in write_scan_header()
633 emit_dht(cinfo, compptr->dc_tbl_no, FALSE); in write_scan_header()
635 if (cinfo->Se) in write_scan_header()
636 emit_dht(cinfo, compptr->ac_tbl_no, TRUE); in write_scan_header()
643 if (cinfo->restart_interval != marker->last_restart_interval) { in write_scan_header()
644 emit_dri(cinfo); in write_scan_header()
645 marker->last_restart_interval = cinfo->restart_interval; in write_scan_header()
648 emit_sos(cinfo); in write_scan_header()
657 write_file_trailer (j_compress_ptr cinfo) in write_file_trailer() argument
659 emit_marker(cinfo, M_EOI); in write_file_trailer()
671 write_tables_only (j_compress_ptr cinfo) in write_tables_only() argument
675 emit_marker(cinfo, M_SOI); in write_tables_only()
678 if (cinfo->quant_tbl_ptrs[i] != NULL) in write_tables_only()
679 (void) emit_dqt(cinfo, i); in write_tables_only()
682 if (! cinfo->arith_code) { in write_tables_only()
684 if (cinfo->dc_huff_tbl_ptrs[i] != NULL) in write_tables_only()
685 emit_dht(cinfo, i, FALSE); in write_tables_only()
686 if (cinfo->ac_huff_tbl_ptrs[i] != NULL) in write_tables_only()
687 emit_dht(cinfo, i, TRUE); in write_tables_only()
691 emit_marker(cinfo, M_EOI); in write_tables_only()
700 jinit_marker_writer (j_compress_ptr cinfo) in jinit_marker_writer() argument
706 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, in jinit_marker_writer()
708 cinfo->marker = &marker->pub; in jinit_marker_writer()