• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/tcl-102/tcl_ext/tkimg/tkimg/compat/libjpeg/

Lines Matching refs:marker

11  * suspension: if not all of the data for a marker is available,
13 * the marker.
21 typedef enum { /* JPEG marker codes */
94 /* Application-overridable marker processing methods */
98 /* Limit on marker data length to save for each marker type */
102 /* Status of COM/APPn marker saving */
103 jpeg_saved_marker_ptr cur_marker; /* NULL if not processing a marker */
104 unsigned int bytes_read; /* data bytes read so far in marker */
169 * Entry condition: JPEG marker itself has been read and its code saved
170 * in cinfo->unread_marker; input restart point is just after the marker.
175 * marker parameters; restart point has not been moved. Same routine
178 * This approach to suspension assumes that all of a marker's parameters
181 * that might not fit. If we are simply dropping such a marker, we use
183 * source manager's shoulders. If we are saving the marker's contents
185 * suspend, the marker processor updates the restart point to the end of
187 * On resumption, cinfo->unread_marker still contains the marker code,
188 * but the data source will point to the next chunk of marker data.
189 * The marker processor must retain internal state to deal with this.
192 * suspension occurs within marker parameters. Other side effects
199 /* Process an SOI marker */
205 if (cinfo->marker->saw_SOI)
231 cinfo->marker->saw_SOI = TRUE;
240 /* Process a SOFn marker */
264 if (cinfo->marker->saw_SOF)
296 cinfo->marker->saw_SOF = TRUE;
305 /* Process a SOS marker */
312 if (! cinfo->marker->saw_SOF)
323 /* pseudo SOS marker only allowed in progressive mode */
365 cinfo->marker->next_restart_num = 0;
367 /* Count another (non-pseudo) SOS marker */
379 /* Process a DAC marker */
425 /* Process a DHT marker */
496 /* Process a DQT marker */
586 /* Process a DRI marker */
624 * Take appropriate action if it is a JFIF marker.
625 * datalen is # of bytes at data[], remaining is length of rest of marker data.
636 /* Found JFIF APP0 marker: save info */
670 /* Found JFIF "JFXX" extension APP0 marker */
700 * Take appropriate action if it is an Adobe marker.
701 * datalen is # of bytes at data[], remaining is length of rest of marker data.
712 /* Found Adobe APP14 marker */
729 /* Process an APP0 or APP14 marker without saving it */
739 /* get the interesting part of the marker data */
777 /* Save an APPn or COM marker into the marker list */
779 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
780 jpeg_saved_marker_ptr cur_marker = marker->cur_marker;
787 /* begin reading a marker */
794 limit = marker->length_limit_COM;
796 limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0];
799 /* allocate and initialize the marker item */
804 cur_marker->marker = (UINT8) cinfo->unread_marker;
809 marker->cur_marker = cur_marker;
810 marker->bytes_read = 0;
819 /* resume reading a marker */
820 bytes_read = marker->bytes_read;
827 marker->bytes_read = bytes_read;
840 /* Add new marker to end of list */
853 /* Reset to initial state for next marker */
854 marker->cur_marker = NULL;
856 /* Process the marker if interesting; else just make a generic trace msg */
883 /* Skip over an unknown or uninteresting variable-length marker */
902 * Find the next JPEG marker, save it in cinfo->unread_marker.
903 * Returns FALSE if had to suspend before reaching a marker;
906 * Note that the result might not be a valid marker code,
924 cinfo->marker->discarded_bytes++;
937 break; /* found a valid marker, exit loop */
941 cinfo->marker->discarded_bytes += 2;
945 if (cinfo->marker->discarded_bytes != 0) {
946 WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
947 cinfo->marker->discarded_bytes = 0;
959 /* Like next_marker, but used to obtain the initial SOI marker. */
960 /* For this marker, we do not allow preceding garbage or fill; otherwise,
987 * Note: This function may return a pseudo SOS marker (with zero
989 * consume_input itself should filter out (skip) the pseudo marker
996 /* Outer loop repeats once for each marker. */
998 /* Collect the marker proper, unless we already did. */
1001 if (! cinfo->marker->saw_SOI) {
1009 /* At this point cinfo->unread_marker contains the marker code and the
1010 * input point is just past the marker proper, but before any parameters.
1060 cinfo->unread_marker = 0; /* processed the marker */
1065 cinfo->unread_marker = 0; /* processed the marker */
1104 if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[
1110 if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo))
1134 * Once the JPEG 3 version-number marker is well defined, this code
1140 /* Successfully processed marker, so reset state variable */
1147 * Read a restart marker, which is expected to appear next in the datastream;
1148 * if the marker is not there, take appropriate recovery action.
1153 * has already read a marker from the data source. Under normal conditions
1155 * it holds a marker which the decoder will be unable to read past.
1161 /* Obtain a marker unless we already did. */
1169 ((int) M_RST0 + cinfo->marker->next_restart_num)) {
1170 /* Normal case --- swallow the marker and let entropy decoder continue */
1171 TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
1177 cinfo->marker->next_restart_num))
1182 cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
1195 * read_restart_marker calls resync_to_restart if it finds a marker other than
1196 * the restart marker it was expecting. (This code is *not* used unless
1198 * the marker code actually found (might be anything, except 0 or FF).
1199 * The desired restart marker number (0..7) is passed as a parameter.
1202 * Note that cinfo->unread_marker is treated as a marker appearing before
1210 * 1. Simply discard the marker and let the entropy decoder resume at next
1212 * 2. Read forward until we find another marker, discarding intervening
1214 * without having to discard data if we don't find the desired marker.
1217 * 3. Leave the marker unread (by failing to zero cinfo->unread_marker).
1219 * inserting dummy zeroes, and then we will reprocess the marker.
1221 * #2 is appropriate if we think the desired marker lies ahead, while #3 is
1222 * appropriate if the found marker is a future restart marker (indicating
1223 * that we have missed the desired restart marker, probably because it got
1225 * We apply #2 or #3 if the found marker is a restart marker no more than
1227 * found marker is not a legal JPEG marker code (it's certainly bogus data).
1228 * If the found marker is a restart marker more than 2 counts away, we do #1
1229 * (too much risk that the marker is erroneous; with luck we will be able to
1231 * For any valid non-restart JPEG marker, we apply #3. This keeps us from
1234 * any other marker would have to be bogus data in that case.
1240 int marker = cinfo->unread_marker;
1244 WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
1248 if (marker < (int) M_SOF0)
1249 action = 2; /* invalid marker */
1250 else if (marker < (int) M_RST0 || marker > (int) M_RST7)
1251 action = 3; /* valid non-restart marker */
1253 if (marker == ((int) M_RST0 + ((desired+1) & 7)) ||
1254 marker == ((int) M_RST0 + ((desired+2) & 7)))
1256 else if (marker == ((int) M_RST0 + ((desired-1) & 7)) ||
1257 marker == ((int) M_RST0 + ((desired-2) & 7)))
1262 TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
1265 /* Discard marker and let entropy decoder resume processing. */
1269 /* Scan to the next marker, and repeat the decision loop. */
1272 marker = cinfo->unread_marker;
1275 /* Return without advancing past this marker. */
1284 * Reset marker processing state to begin a fresh datastream.
1290 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
1294 cinfo->unread_marker = 0; /* no pending marker */
1295 marker->pub.saw_SOI = FALSE; /* set internal state too */
1296 marker->pub.saw_SOF = FALSE;
1297 marker->pub.discarded_bytes = 0;
1298 marker->cur_marker = NULL;
1303 * Initialize the marker reader module.
1310 my_marker_ptr marker;
1314 marker = (my_marker_ptr)
1317 cinfo->marker = (struct jpeg_marker_reader *) marker;
1319 marker->pub.reset_marker_reader = reset_marker_reader;
1320 marker->pub.read_markers = read_markers;
1321 marker->pub.read_restart_marker = read_restart_marker;
1326 marker->process_COM = skip_variable;
1327 marker->length_limit_COM = 0;
1329 marker->process_APPn[i] = skip_variable;
1330 marker->length_limit_APPn[i] = 0;
1332 marker->process_APPn[0] = get_interesting_appn;
1333 marker->process_APPn[14] = get_interesting_appn;
1334 /* Reset marker processing state */
1349 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
1378 marker->process_COM = processor;
1379 marker->length_limit_COM = length_limit;
1381 marker->process_APPn[marker_code - (int) M_APP0] = processor;
1382 marker->length_limit_APPn[marker_code - (int) M_APP0] = length_limit;
1398 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
1401 marker->process_COM = routine;
1403 marker->process_APPn[marker_code - (int) M_APP0] = routine;