Apparatus and methods are provided for entering compressed data streams at selected reentry points to initiate decoding thereby allowing efficient manipulation of the compressed data and minimizing storage requirements. The reentry information preferably includes bit-level pointers and sufficient state information to initialize the decoder properly. This enables decoding without having to resume at independently decodable points, such as
JPEG restart markers. For example, in the context of a
JPEG image, in addition to the typical information available to the decoder that has been passed in earlier markers, the reentry information for a given MCU boundary may include: a bit-level pointer to the first block's DC Huffman code, the position of the output, and a DC predictor for each component of the MCU. This allows decompression to be performed in the appropriate order to accomplish various data manipulation operations, such as rotation, thus significantly reducing buffering requirements. Reentry information into a compressed
data stream can be generated during encoding, decoding, partial encoding, partial decoding,
entropy encoding, and / or entropy decoding. In addition, a reentry decoder may quickly interpret the compressed data sufficiently to preserve desired reentry information and discard unneeded output of the decoding process and terminate immediately after the last desired reentry point. This enables buffering of pieces of compressed data with associated reentry information rather than buffering the entire decompressed data. Additionally, when a subset of the reconstructed data is needed the step of recompressing the individual pieces can be avoided by saving reentry information with the associated pieces of compressed data.