Lines Matching refs:marker

10  * suspension: if not all of the data for a marker is available,
12 * the marker.
20 typedef enum { /* JPEG marker codes */
93 /* Application-overridable marker processing methods */
97 /* Limit on marker data length to save for each marker type */
101 /* Status of COM/APPn marker saving */
102 jpeg_saved_marker_ptr cur_marker; /* NULL if not processing a marker */
103 unsigned int bytes_read; /* data bytes read so far in marker */
168 * Entry condition: JPEG marker itself has been read and its code saved
169 * in cinfo->unread_marker; input restart point is just after the marker.
174 * marker parameters; restart point has not been moved. Same routine
177 * This approach to suspension assumes that all of a marker's parameters
180 * that might not fit. If we are simply dropping such a marker, we use
182 * source manager's shoulders. If we are saving the marker's contents
184 * suspend, the marker processor updates the restart point to the end of
186 * On resumption, cinfo->unread_marker still contains the marker code,
187 * but the data source will point to the next chunk of marker data.
188 * The marker processor must retain internal state to deal with this.
191 * suspension occurs within marker parameters. Other side effects
198 /* Process an SOI marker */
204 if (cinfo->marker->saw_SOI)
230 cinfo->marker->saw_SOI = TRUE;
238 /* Process a SOFn marker */
261 if (cinfo->marker->saw_SOF)
293 cinfo->marker->saw_SOF = TRUE;
302 /* Process a SOS marker */
309 if (! cinfo->marker->saw_SOF)
360 cinfo->marker->next_restart_num = 0;
362 /* Count another SOS marker */
374 /* Process a DAC marker */
420 /* Process a DHT marker */
491 /* Process a DQT marker */
549 /* Process a DRI marker */
587 * Take appropriate action if it is a JFIF marker.
588 * datalen is # of bytes at data[], remaining is length of rest of marker data.
599 /* Found JFIF APP0 marker: save info */
633 /* Found JFIF "JFXX" extension APP0 marker */
663 * Take appropriate action if it is an Adobe marker.
664 * datalen is # of bytes at data[], remaining is length of rest of marker data.
675 /* Found Adobe APP14 marker */
692 /* Process an APP0 or APP14 marker without saving it */
702 /* get the interesting part of the marker data */
740 /* Save an APPn or COM marker into the marker list */
742 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
743 jpeg_saved_marker_ptr cur_marker = marker->cur_marker;
750 /* begin reading a marker */
757 limit = marker->length_limit_COM;
759 limit = marker->length_limit_APPn[cinfo->unread_marker - (int) M_APP0];
762 /* allocate and initialize the marker item */
767 cur_marker->marker = (UINT8) cinfo->unread_marker;
772 marker->cur_marker = cur_marker;
773 marker->bytes_read = 0;
782 /* resume reading a marker */
783 bytes_read = marker->bytes_read;
790 marker->bytes_read = bytes_read;
803 /* Add new marker to end of list */
816 /* Reset to initial state for next marker */
817 marker->cur_marker = NULL;
819 /* Process the marker if interesting; else just make a generic trace msg */
846 /* Skip over an unknown or uninteresting variable-length marker */
865 * Find the next JPEG marker, save it in cinfo->unread_marker.
866 * Returns FALSE if had to suspend before reaching a marker;
869 * Note that the result might not be a valid marker code,
887 cinfo->marker->discarded_bytes++;
900 break; /* found a valid marker, exit loop */
904 cinfo->marker->discarded_bytes += 2;
908 if (cinfo->marker->discarded_bytes != 0) {
909 WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
910 cinfo->marker->discarded_bytes = 0;
922 /* Like next_marker, but used to obtain the initial SOI marker. */
923 /* For this marker, we do not allow preceding garbage or fill; otherwise,
954 /* Outer loop repeats once for each marker. */
956 /* Collect the marker proper, unless we already did. */
959 if (! cinfo->marker->saw_SOI) {
969 * Save the position of the fist marker after SOF.
971 if (cinfo->marker->current_sos_marker_position == -1)
972 cinfo->marker->current_sos_marker_position =
975 /* At this point cinfo->unread_marker contains the marker code and the
976 * input point is just past the marker proper, but before any parameters.
992 cinfo->marker->current_sos_marker_position = -1;
1023 cinfo->unread_marker = 0; /* processed the marker */
1028 cinfo->unread_marker = 0; /* processed the marker */
1067 if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[
1073 if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo))
1097 * Once the JPEG 3 version-number marker is well defined, this code
1103 /* Successfully processed marker, so reset state variable */
1110 * Read a restart marker, which is expected to appear next in the datastream;
1111 * if the marker is not there, take appropriate recovery action.
1116 * has already read a marker from the data source. Under normal conditions
1118 * it holds a marker which the decoder will be unable to read past.
1124 /* Obtain a marker unless we already did. */
1132 ((int) M_RST0 + cinfo->marker->next_restart_num)) {
1133 /* Normal case --- swallow the marker and let entropy decoder continue */
1134 TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
1140 cinfo->marker->next_restart_num))
1145 cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
1158 * read_restart_marker calls resync_to_restart if it finds a marker other than
1159 * the restart marker it was expecting. (This code is *not* used unless
1161 * the marker code actually found (might be anything, except 0 or FF).
1162 * The desired restart marker number (0..7) is passed as a parameter.
1165 * Note that cinfo->unread_marker is treated as a marker appearing before
1173 * 1. Simply discard the marker and let the entropy decoder resume at next
1175 * 2. Read forward until we find another marker, discarding intervening
1177 * without having to discard data if we don't find the desired marker.
1180 * 3. Leave the marker unread (by failing to zero cinfo->unread_marker).
1182 * inserting dummy zeroes, and then we will reprocess the marker.
1184 * #2 is appropriate if we think the desired marker lies ahead, while #3 is
1185 * appropriate if the found marker is a future restart marker (indicating
1186 * that we have missed the desired restart marker, probably because it got
1188 * We apply #2 or #3 if the found marker is a restart marker no more than
1190 * found marker is not a legal JPEG marker code (it's certainly bogus data).
1191 * If the found marker is a restart marker more than 2 counts away, we do #1
1192 * (too much risk that the marker is erroneous; with luck we will be able to
1194 * For any valid non-restart JPEG marker, we apply #3. This keeps us from
1197 * any other marker would have to be bogus data in that case.
1203 int marker = cinfo->unread_marker;
1207 WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
1211 if (marker < (int) M_SOF0)
1212 action = 2; /* invalid marker */
1213 else if (marker < (int) M_RST0 || marker > (int) M_RST7)
1214 action = 3; /* valid non-restart marker */
1216 if (marker == ((int) M_RST0 + ((desired+1) & 7)) ||
1217 marker == ((int) M_RST0 + ((desired+2) & 7)))
1219 else if (marker == ((int) M_RST0 + ((desired-1) & 7)) ||
1220 marker == ((int) M_RST0 + ((desired-2) & 7)))
1225 TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
1228 /* Discard marker and let entropy decoder resume processing. */
1232 /* Scan to the next marker, and repeat the decision loop. */
1235 marker = cinfo->unread_marker;
1238 /* Return without advancing past this marker. */
1259 cinfo->marker->current_sos_marker_position);
1260 // Skips scan content to the next non-RST JPEG marker.
1264 cinfo->marker->current_sos_marker_position =
1274 * Reset marker processing state to begin a fresh datastream.
1280 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
1284 cinfo->unread_marker = 0; /* no pending marker */
1285 marker->pub.saw_SOI = FALSE; /* set internal state too */
1286 marker->pub.saw_SOF = FALSE;
1287 marker->pub.discarded_bytes = 0;
1288 marker->cur_marker = NULL;
1293 * Initialize the marker reader module.
1300 my_marker_ptr marker;
1304 marker = (my_marker_ptr)
1307 cinfo->marker = (struct jpeg_marker_reader *) marker;
1309 marker->pub.reset_marker_reader = reset_marker_reader;
1310 marker->pub.read_markers = read_markers;
1311 marker->pub.read_restart_marker = read_restart_marker;
1312 marker->pub.get_sos_marker_position = get_sos_marker_position;
1314 // Initialize the SOS marker position to avoid underdefined behavior due to
1316 marker->pub.current_sos_marker_position = 0;
1322 marker->process_COM = skip_variable;
1323 marker->length_limit_COM = 0;
1325 marker->process_APPn[i] = skip_variable;
1326 marker->length_limit_APPn[i] = 0;
1328 marker->process_APPn[0] = get_interesting_appn;
1329 marker->process_APPn[14] = get_interesting_appn;
1330 /* Reset marker processing state */
1345 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
1374 marker->process_COM = processor;
1375 marker->length_limit_COM = length_limit;
1377 marker->process_APPn[marker_code - (int) M_APP0] = processor;
1378 marker->length_limit_APPn[marker_code - (int) M_APP0] = length_limit;
1394 my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
1397 marker->process_COM = routine;
1399 marker->process_APPn[marker_code - (int) M_APP0] = routine;