Unit JdMarker |
Classes |
Functions |
jinit_marker_reader - GLOBAL
reset_marker_reader } { Initialize the marker reader module.
jpeg_resync_to_restart - JPEG marker codes } {GLOBAL
read_restart_marker } { This is the default resync_to_restart method for data source managers
to use if they don't have any better approach.
Types |
Constants |
M_APP0
M_APP1
M_APP10
M_APP11
M_APP12
M_APP13
M_APP14
M_APP15
M_APP2
M_APP3
M_APP4
M_APP5
M_APP6
M_APP7
M_APP8
M_APP9
M_COM
M_DAC
M_DHP
M_DHT
M_DNL
M_DQT
M_DRI
M_EOI
M_ERROR
M_EXP
M_JPG
M_JPG0
M_JPG13
M_RST0
M_RST1
M_RST2
M_RST3
M_RST4
M_RST5
M_RST6
M_RST7
M_SOF0
M_SOF1
M_SOF10
M_SOF11
M_SOF13
M_SOF14
M_SOF15
M_SOF2
M_SOF3
M_SOF5
M_SOF6
M_SOF7
M_SOF9
M_SOI
M_SOS
M_TEM
Variables |
Functions |
reset_marker_reader } { Initialize the marker reader module. This is called only once, when the decompression object is created. } {GLOBAL
read_restart_marker } { This is the default resync_to_restart method for data source managers to use if they don't have any better approach. Some data source managers may be able to back up, or may have additional knowledge about the data which permits a more intelligent recovery strategy; such managers would presumably supply their own resync method. read_restart_marker calls resync_to_restart if it finds a marker other than the restart marker it was expecting. (This code is *not* used unless a nonzero restart interval has been declared.) cinfo^.unread_marker is the marker code actually found (might be anything, except 0 or FF). The desired restart marker number (0..7) is passed as a parameter. This routine is supposed to apply whatever error recovery strategy seems appropriate in order to position the input stream to the next data segment. Note that cinfo^.unread_marker is treated as a marker appearing before the current data-source input point; usually it should be reset to zero before returning. Returns FALSE if suspension is required. This implementation is substantially constrained by wanting to treat the input as a data stream; this means we can't back up. Therefore, we have only the following actions to work with: 1. Simply discard the marker and let the entropy decoder resume at next byte of file. 2. Read forward until we find another marker, discarding intervening data. (In theory we could look ahead within the current bufferload, without having to discard data if we don't find the desired marker. This idea is not implemented here, in part because it makes behavior dependent on buffer size and chance buffer-boundary positions.) 3. Leave the marker unread (by failing to zero cinfo^.unread_marker). This will cause the entropy decoder to process an empty data segment, inserting dummy zeroes, and then we will reprocess the marker. #2 is appropriate if we think the desired marker lies ahead, while #3 is appropriate if the found marker is a future restart marker (indicating that we have missed the desired restart marker, probably because it got corrupted). We apply #2 or #3 if the found marker is a restart marker no more than two counts behind or ahead of the expected one. We also apply #2 if the found marker is not a legal JPEG marker code (it's certainly bogus data). If the found marker is a restart marker more than 2 counts away, we do #1 (too much risk that the marker is erroneous; with luck we will be able to resync at some future point). For any valid non-restart JPEG marker, we apply #3. This keeps us from overrunning the end of a scan. An implementation limited to single-scan files might find it better to apply #2 for markers other than EOI, since any other marker would have to be bogus data in that case. } {GLOBAL
Types |
JPEG_MARKER = uint
Constants |
Variables |