11 #define JPEG_INTERNALS
115 if (! (*dest->empty_output_buffer) (cinfo))
116 ERREXIT(cinfo, JERR_CANT_SUSPEND);
148 JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
153 ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
191 htbl = cinfo->ac_huff_tbl_ptrs[index];
194 htbl = cinfo->dc_huff_tbl_ptrs[index];
198 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
204 for (
i = 1;
i <= 16;
i++)
210 for (
i = 1;
i <= 16;
i++)
227 #ifdef C_ARITH_CODING_SUPPORTED
234 dc_in_use[
i] = ac_in_use[
i] = 0;
236 for (
i = 0;
i < cinfo->comps_in_scan;
i++) {
244 length += dc_in_use[
i] + ac_in_use[
i];
253 emit_byte(cinfo, cinfo->arith_dc_L[
i] + (cinfo->arith_dc_U[
i]<<4));
285 emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1);
288 if ((
long) cinfo->image_height > 65535L ||
289 (
long) cinfo->image_width > 65535L)
290 ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (
unsigned int) 65535);
298 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
316 emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3);
320 for (
i = 0;
i < cinfo->comps_in_scan;
i++) {
325 if (cinfo->progressive_mode) {
331 if (cinfo->Ss == 0) {
333 if (cinfo->Ah != 0 && !cinfo->arith_code)
344 emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
366 emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1);
373 emit_byte(cinfo, cinfo->JFIF_major_version);
374 emit_byte(cinfo, cinfo->JFIF_minor_version);
415 switch (cinfo->jpeg_color_space) {
441 if (
datalen > (
unsigned int) 65533)
442 ERREXIT(cinfo, JERR_BAD_LENGTH);
476 marker->last_restart_interval = 0;
478 if (cinfo->write_JFIF_header)
480 if (cinfo->write_Adobe_marker)
504 for (ci = 0,
compptr = cinfo->comp_info; ci < cinfo->num_components;
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;
523 if (prec && is_baseline) {
526 TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
531 if (cinfo->arith_code) {
534 if (cinfo->progressive_mode)
536 else if (is_baseline)
557 if (cinfo->arith_code) {
567 for (
i = 0;
i < cinfo->comps_in_scan;
i++) {
569 if (cinfo->progressive_mode) {
571 if (cinfo->Ss == 0) {
588 if (cinfo->restart_interval !=
marker->last_restart_interval) {
590 marker->last_restart_interval = cinfo->restart_interval;
623 if (cinfo->quant_tbl_ptrs[
i] != NULL)
627 if (! cinfo->arith_code) {
629 if (cinfo->dc_huff_tbl_ptrs[
i] != NULL)
631 if (cinfo->ac_huff_tbl_ptrs[
i] != NULL)
663 marker->last_restart_interval = 0;