Lines Matching refs:cinfo
121 #define INPUT_VARS(cinfo) \ argument
122 struct jpeg_source_mgr * datasrc = (cinfo)->src; \
127 #define INPUT_SYNC(cinfo) \ argument
132 #define INPUT_RELOAD(cinfo) \ argument
140 #define MAKE_BYTE_AVAIL(cinfo,action) \ argument
142 if (! (*datasrc->fill_input_buffer) (cinfo)) \
144 INPUT_RELOAD(cinfo); \
150 #define INPUT_BYTE(cinfo,V,action) \ argument
151 MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
158 #define INPUT_2BYTES(cinfo,V,action) \ argument
159 MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
162 MAKE_BYTE_AVAIL(cinfo,action); \
199 get_soi (j_decompress_ptr cinfo) in get_soi() argument
204 TRACEMS(cinfo, 1, JTRC_SOI); in get_soi()
206 if (cinfo->marker->saw_SOI) in get_soi()
207 ERREXIT(cinfo, JERR_SOI_DUPLICATE); in get_soi()
212 cinfo->arith_dc_L[i] = 0; in get_soi()
213 cinfo->arith_dc_U[i] = 1; in get_soi()
214 cinfo->arith_ac_K[i] = 5; in get_soi()
216 cinfo->restart_interval = 0; in get_soi()
220 cinfo->jpeg_color_space = JCS_UNKNOWN; in get_soi()
221 cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */ in get_soi()
223 cinfo->saw_JFIF_marker = FALSE; in get_soi()
224 cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */ in get_soi()
225 cinfo->JFIF_minor_version = 1; in get_soi()
226 cinfo->density_unit = 0; in get_soi()
227 cinfo->X_density = 1; in get_soi()
228 cinfo->Y_density = 1; in get_soi()
229 cinfo->saw_Adobe_marker = FALSE; in get_soi()
230 cinfo->Adobe_transform = 0; in get_soi()
232 cinfo->marker->saw_SOI = TRUE; in get_soi()
239 get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) in get_sof() argument
245 INPUT_VARS(cinfo); in get_sof()
247 cinfo->progressive_mode = is_prog; in get_sof()
248 cinfo->arith_code = is_arith; in get_sof()
250 INPUT_2BYTES(cinfo, length, return FALSE); in get_sof()
252 INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE); in get_sof()
253 INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE); in get_sof()
254 INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE); in get_sof()
255 INPUT_BYTE(cinfo, cinfo->num_components, return FALSE); in get_sof()
259 TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker, in get_sof()
260 (int) cinfo->image_width, (int) cinfo->image_height, in get_sof()
261 cinfo->num_components); in get_sof()
263 if (cinfo->marker->saw_SOF) in get_sof()
264 ERREXIT(cinfo, JERR_SOF_DUPLICATE); in get_sof()
269 if (cinfo->image_height <= 0 || cinfo->image_width <= 0 in get_sof()
270 || cinfo->num_components <= 0) in get_sof()
271 ERREXIT(cinfo, JERR_EMPTY_IMAGE); in get_sof()
273 if (length != (cinfo->num_components * 3)) in get_sof()
274 ERREXIT(cinfo, JERR_BAD_LENGTH); in get_sof()
276 if (cinfo->comp_info == NULL) /* do only once, even if suspend */ in get_sof()
277 cinfo->comp_info = (jpeg_component_info *) (*cinfo->mem->alloc_small) in get_sof()
278 ((j_common_ptr) cinfo, JPOOL_IMAGE, in get_sof()
279 cinfo->num_components * sizeof(jpeg_component_info)); in get_sof()
281 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; in get_sof()
284 INPUT_BYTE(cinfo, compptr->component_id, return FALSE); in get_sof()
285 INPUT_BYTE(cinfo, c, return FALSE); in get_sof()
288 INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE); in get_sof()
290 TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT, in get_sof()
295 cinfo->marker->saw_SOF = TRUE; in get_sof()
297 INPUT_SYNC(cinfo); in get_sof()
303 get_sos (j_decompress_ptr cinfo) in get_sos() argument
309 INPUT_VARS(cinfo); in get_sos()
311 if (! cinfo->marker->saw_SOF) in get_sos()
312 ERREXIT(cinfo, JERR_SOS_NO_SOF); in get_sos()
314 INPUT_2BYTES(cinfo, length, return FALSE); in get_sos()
316 INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */ in get_sos()
318 TRACEMS1(cinfo, 1, JTRC_SOS, n); in get_sos()
321 ERREXIT(cinfo, JERR_BAD_LENGTH); in get_sos()
323 cinfo->comps_in_scan = n; in get_sos()
328 cinfo->cur_comp_info[i] = NULL; in get_sos()
331 INPUT_BYTE(cinfo, cc, return FALSE); in get_sos()
332 INPUT_BYTE(cinfo, c, return FALSE); in get_sos()
334 for (ci = 0, compptr = cinfo->comp_info; in get_sos()
335 ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN; in get_sos()
337 if (cc == compptr->component_id && !cinfo->cur_comp_info[ci]) in get_sos()
341 ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); in get_sos()
345 cinfo->cur_comp_info[i] = compptr; in get_sos()
349 TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, in get_sos()
354 if (cinfo->cur_comp_info[pi] == compptr) { in get_sos()
355 ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); in get_sos()
361 INPUT_BYTE(cinfo, c, return FALSE); in get_sos()
362 cinfo->Ss = c; in get_sos()
363 INPUT_BYTE(cinfo, c, return FALSE); in get_sos()
364 cinfo->Se = c; in get_sos()
365 INPUT_BYTE(cinfo, c, return FALSE); in get_sos()
366 cinfo->Ah = (c >> 4) & 15; in get_sos()
367 cinfo->Al = (c ) & 15; in get_sos()
369 TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se, in get_sos()
370 cinfo->Ah, cinfo->Al); in get_sos()
373 cinfo->marker->next_restart_num = 0; in get_sos()
376 cinfo->input_scan_number++; in get_sos()
378 INPUT_SYNC(cinfo); in get_sos()
386 get_dac (j_decompress_ptr cinfo) in get_dac() argument
391 INPUT_VARS(cinfo); in get_dac()
393 INPUT_2BYTES(cinfo, length, return FALSE); in get_dac()
397 INPUT_BYTE(cinfo, index, return FALSE); in get_dac()
398 INPUT_BYTE(cinfo, val, return FALSE); in get_dac()
402 TRACEMS2(cinfo, 1, JTRC_DAC, index, val); in get_dac()
405 ERREXIT1(cinfo, JERR_DAC_INDEX, index); in get_dac()
408 cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val; in get_dac()
410 cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F); in get_dac()
411 cinfo->arith_dc_U[index] = (UINT8) (val >> 4); in get_dac()
412 if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index]) in get_dac()
413 ERREXIT1(cinfo, JERR_DAC_VALUE, val); in get_dac()
418 ERREXIT(cinfo, JERR_BAD_LENGTH); in get_dac()
420 INPUT_SYNC(cinfo); in get_dac()
426 #define get_dac(cinfo) skip_variable(cinfo) argument
432 get_dht (j_decompress_ptr cinfo) in get_dht() argument
440 INPUT_VARS(cinfo); in get_dht()
442 INPUT_2BYTES(cinfo, length, return FALSE); in get_dht()
446 INPUT_BYTE(cinfo, index, return FALSE); in get_dht()
448 TRACEMS1(cinfo, 1, JTRC_DHT, index); in get_dht()
453 INPUT_BYTE(cinfo, bits[i], return FALSE); in get_dht()
459 TRACEMS8(cinfo, 2, JTRC_HUFFBITS, in get_dht()
462 TRACEMS8(cinfo, 2, JTRC_HUFFBITS, in get_dht()
470 ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); in get_dht()
473 INPUT_BYTE(cinfo, huffval[i], return FALSE); in get_dht()
482 ERREXIT1(cinfo, JERR_DHT_INDEX, index); in get_dht()
483 htblptr = &cinfo->ac_huff_tbl_ptrs[index]; in get_dht()
486 ERREXIT1(cinfo, JERR_DHT_INDEX, index); in get_dht()
487 htblptr = &cinfo->dc_huff_tbl_ptrs[index]; in get_dht()
491 *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo); in get_dht()
498 ERREXIT(cinfo, JERR_BAD_LENGTH); in get_dht()
500 INPUT_SYNC(cinfo); in get_dht()
506 get_dqt (j_decompress_ptr cinfo) in get_dqt() argument
513 INPUT_VARS(cinfo); in get_dqt()
515 INPUT_2BYTES(cinfo, length, return FALSE); in get_dqt()
519 INPUT_BYTE(cinfo, n, return FALSE); in get_dqt()
523 TRACEMS2(cinfo, 1, JTRC_DQT, n, prec); in get_dqt()
526 ERREXIT1(cinfo, JERR_DQT_INDEX, n); in get_dqt()
528 if (cinfo->quant_tbl_ptrs[n] == NULL) in get_dqt()
529 cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr) cinfo); in get_dqt()
530 quant_ptr = cinfo->quant_tbl_ptrs[n]; in get_dqt()
534 INPUT_2BYTES(cinfo, tmp, return FALSE); in get_dqt()
536 INPUT_BYTE(cinfo, tmp, return FALSE); in get_dqt()
541 if (cinfo->err->trace_level >= 2) { in get_dqt()
543 TRACEMS8(cinfo, 2, JTRC_QUANTVALS, in get_dqt()
556 ERREXIT(cinfo, JERR_BAD_LENGTH); in get_dqt()
558 INPUT_SYNC(cinfo); in get_dqt()
564 get_dri (j_decompress_ptr cinfo) in get_dri() argument
569 INPUT_VARS(cinfo); in get_dri()
571 INPUT_2BYTES(cinfo, length, return FALSE); in get_dri()
574 ERREXIT(cinfo, JERR_BAD_LENGTH); in get_dri()
576 INPUT_2BYTES(cinfo, tmp, return FALSE); in get_dri()
578 TRACEMS1(cinfo, 1, JTRC_DRI, tmp); in get_dri()
580 cinfo->restart_interval = tmp; in get_dri()
582 INPUT_SYNC(cinfo); in get_dri()
600 examine_app0 (j_decompress_ptr cinfo, JOCTET * data, in examine_app0() argument
616 cinfo->saw_JFIF_marker = TRUE; in examine_app0()
617 cinfo->JFIF_major_version = GETJOCTET(data[5]); in examine_app0()
618 cinfo->JFIF_minor_version = GETJOCTET(data[6]); in examine_app0()
619 cinfo->density_unit = GETJOCTET(data[7]); in examine_app0()
620 cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]); in examine_app0()
621 cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]); in examine_app0()
628 if (cinfo->JFIF_major_version != 1) in examine_app0()
629 WARNMS2(cinfo, JWRN_JFIF_MAJOR, in examine_app0()
630 cinfo->JFIF_major_version, cinfo->JFIF_minor_version); in examine_app0()
632 TRACEMS5(cinfo, 1, JTRC_JFIF, in examine_app0()
633 cinfo->JFIF_major_version, cinfo->JFIF_minor_version, in examine_app0()
634 cinfo->X_density, cinfo->Y_density, cinfo->density_unit); in examine_app0()
637 TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, in examine_app0()
642 TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); in examine_app0()
655 TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int) totallen); in examine_app0()
658 TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int) totallen); in examine_app0()
661 TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int) totallen); in examine_app0()
664 TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, in examine_app0()
670 TRACEMS1(cinfo, 1, JTRC_APP0, (int) totallen); in examine_app0()
676 examine_app14 (j_decompress_ptr cinfo, JOCTET * data, in examine_app14() argument
696 TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform); in examine_app14()
697 cinfo->saw_Adobe_marker = TRUE; in examine_app14()
698 cinfo->Adobe_transform = (UINT8) transform; in examine_app14()
701 TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining)); in examine_app14()
707 get_interesting_appn (j_decompress_ptr cinfo) in get_interesting_appn() argument
713 INPUT_VARS(cinfo); in get_interesting_appn()
715 INPUT_2BYTES(cinfo, length, return FALSE); in get_interesting_appn()
726 INPUT_BYTE(cinfo, b[i], return FALSE); in get_interesting_appn()
730 switch (cinfo->unread_marker) { in get_interesting_appn()
732 examine_app0(cinfo, (JOCTET *) b, numtoread, length); in get_interesting_appn()
735 examine_app14(cinfo, (JOCTET *) b, numtoread, length); in get_interesting_appn()
739 ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker); in get_interesting_appn()
744 INPUT_SYNC(cinfo); in get_interesting_appn()
746 (*cinfo->src->skip_input_data) (cinfo, (long) length); in get_interesting_appn()
755 save_marker (j_decompress_ptr cinfo) in save_marker() argument
758 my_marker_ptr marker = (my_marker_ptr) cinfo->marker; in save_marker()
763 INPUT_VARS(cinfo); in save_marker()
767 INPUT_2BYTES(cinfo, length, return FALSE); in save_marker()
772 if (cinfo->unread_marker == (int) M_COM) in save_marker()
775 limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0]; in save_marker()
780 (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, in save_marker()
783 cur_marker->marker = (UINT8) cinfo->unread_marker; in save_marker()
805 INPUT_SYNC(cinfo); /* move the restart point to here */ in save_marker()
808 MAKE_BYTE_AVAIL(cinfo, return FALSE); in save_marker()
820 if (cinfo->marker_list == NULL) { in save_marker()
821 cinfo->marker_list = cur_marker; in save_marker()
823 jpeg_saved_marker_ptr prev = cinfo->marker_list; in save_marker()
836 switch (cinfo->unread_marker) { in save_marker()
838 examine_app0(cinfo, data, data_length, length); in save_marker()
841 examine_app14(cinfo, data, data_length, length); in save_marker()
844 TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, in save_marker()
850 INPUT_SYNC(cinfo); /* do before skip_input_data */ in save_marker()
852 (*cinfo->src->skip_input_data) (cinfo, (long) length); in save_marker()
861 skip_variable (j_decompress_ptr cinfo) in skip_variable() argument
865 INPUT_VARS(cinfo); in skip_variable()
867 INPUT_2BYTES(cinfo, length, return FALSE); in skip_variable()
870 TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int) length); in skip_variable()
872 INPUT_SYNC(cinfo); /* do before skip_input_data */ in skip_variable()
874 (*cinfo->src->skip_input_data) (cinfo, (long) length); in skip_variable()
890 next_marker (j_decompress_ptr cinfo) in next_marker() argument
893 INPUT_VARS(cinfo); in next_marker()
896 INPUT_BYTE(cinfo, c, return FALSE); in next_marker()
903 cinfo->marker->discarded_bytes++; in next_marker()
904 INPUT_SYNC(cinfo); in next_marker()
905 INPUT_BYTE(cinfo, c, return FALSE); in next_marker()
913 INPUT_BYTE(cinfo, c, return FALSE); in next_marker()
920 cinfo->marker->discarded_bytes += 2; in next_marker()
921 INPUT_SYNC(cinfo); in next_marker()
924 if (cinfo->marker->discarded_bytes != 0) { in next_marker()
925 WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c); in next_marker()
926 cinfo->marker->discarded_bytes = 0; in next_marker()
929 cinfo->unread_marker = c; in next_marker()
931 INPUT_SYNC(cinfo); in next_marker()
937 first_marker (j_decompress_ptr cinfo) in first_marker() argument
946 INPUT_VARS(cinfo); in first_marker()
948 INPUT_BYTE(cinfo, c, return FALSE); in first_marker()
949 INPUT_BYTE(cinfo, c2, return FALSE); in first_marker()
951 ERREXIT2(cinfo, JERR_NO_SOI, c, c2); in first_marker()
953 cinfo->unread_marker = c2; in first_marker()
955 INPUT_SYNC(cinfo); in first_marker()
968 read_markers (j_decompress_ptr cinfo) in read_markers() argument
974 if (cinfo->unread_marker == 0) { in read_markers()
975 if (! cinfo->marker->saw_SOI) { in read_markers()
976 if (! first_marker(cinfo)) in read_markers()
979 if (! next_marker(cinfo)) in read_markers()
987 switch (cinfo->unread_marker) { in read_markers()
989 if (! get_soi(cinfo)) in read_markers()
995 if (! get_sof(cinfo, FALSE, FALSE)) in read_markers()
1000 if (! get_sof(cinfo, TRUE, FALSE)) in read_markers()
1005 if (! get_sof(cinfo, FALSE, TRUE)) in read_markers()
1010 if (! get_sof(cinfo, TRUE, TRUE)) in read_markers()
1024 ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker); in read_markers()
1028 if (! get_sos(cinfo)) in read_markers()
1030 cinfo->unread_marker = 0; /* processed the marker */ in read_markers()
1034 TRACEMS(cinfo, 1, JTRC_EOI); in read_markers()
1035 cinfo->unread_marker = 0; /* processed the marker */ in read_markers()
1039 if (! get_dac(cinfo)) in read_markers()
1044 if (! get_dht(cinfo)) in read_markers()
1049 if (! get_dqt(cinfo)) in read_markers()
1054 if (! get_dri(cinfo)) in read_markers()
1074 if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[ in read_markers()
1075 cinfo->unread_marker - (int) M_APP0]) (cinfo)) in read_markers()
1080 if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) in read_markers()
1093 TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker); in read_markers()
1097 if (! skip_variable(cinfo)) in read_markers()
1107 ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker); in read_markers()
1111 cinfo->unread_marker = 0; in read_markers()
1129 read_restart_marker (j_decompress_ptr cinfo) in read_restart_marker() argument
1133 if (cinfo->unread_marker == 0) { in read_restart_marker()
1134 if (! next_marker(cinfo)) in read_restart_marker()
1138 if (cinfo->unread_marker == in read_restart_marker()
1139 ((int) M_RST0 + cinfo->marker->next_restart_num)) { in read_restart_marker()
1141 TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num); in read_restart_marker()
1142 cinfo->unread_marker = 0; in read_restart_marker()
1146 if (! (*cinfo->src->resync_to_restart) (cinfo, in read_restart_marker()
1147 cinfo->marker->next_restart_num)) in read_restart_marker()
1152 cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7; in read_restart_marker()
1208 jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) in jpeg_resync_to_restart() argument
1210 int marker = cinfo->unread_marker; in jpeg_resync_to_restart()
1214 WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired); in jpeg_resync_to_restart()
1232 TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action); in jpeg_resync_to_restart()
1236 cinfo->unread_marker = 0; in jpeg_resync_to_restart()
1240 if (! next_marker(cinfo)) in jpeg_resync_to_restart()
1242 marker = cinfo->unread_marker; in jpeg_resync_to_restart()
1258 reset_marker_reader (j_decompress_ptr cinfo) in reset_marker_reader() argument
1260 my_marker_ptr marker = (my_marker_ptr) cinfo->marker; in reset_marker_reader()
1262 cinfo->comp_info = NULL; /* until allocated by get_sof */ in reset_marker_reader()
1263 cinfo->input_scan_number = 0; /* no SOS seen yet */ in reset_marker_reader()
1264 cinfo->unread_marker = 0; /* no pending marker */ in reset_marker_reader()
1278 jinit_marker_reader (j_decompress_ptr cinfo) in jinit_marker_reader() argument
1285 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, in jinit_marker_reader()
1287 cinfo->marker = (struct jpeg_marker_reader *) marker; in jinit_marker_reader()
1305 reset_marker_reader(cinfo); in jinit_marker_reader()
1316 jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, in jpeg_save_markers() argument
1319 my_marker_ptr marker = (my_marker_ptr) cinfo->marker; in jpeg_save_markers()
1326 maxlength = cinfo->mem->max_alloc_chunk - sizeof(struct jpeg_marker_struct); in jpeg_save_markers()
1354 ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code); in jpeg_save_markers()
1365 jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, in jpeg_set_marker_processor() argument
1368 my_marker_ptr marker = (my_marker_ptr) cinfo->marker; in jpeg_set_marker_processor()
1375 ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code); in jpeg_set_marker_processor()