You are here: Architecture and Design > Strip-Based Decoding

Strip-Based Decoding

The MrSID SDK is designed for workflows involving large images. To accommodate large (gigabyte-sized) datasets, the image pipeline framework is designed to process images in advancing horizontal strips. This reduces the amount of memory required to process the image.

To read a scene from an image, the SDK uses the following general workflow:

begin read, for given scene

foreach strip in scene, do

xxxxxread strip

done

end read

These three phases are implemented in the LTIImageStage class using the methods readBegin(), readStrip(), and readEnd(). These methods handle all the logic for decomposing the full scene into sequential strips, and they internally call the corresponding pure virtual protected methods decodeBegin(), decodeStrip(), and decodeEnd(), which derived image stages are required to implement as appropriate.

The “connection” between stages is accomplished via an LTISceneBuffer object passed into the read() call. As each strip is processed in each stage, a subsection of the buffer is used and passed between stages; in general, no intermediate buffering is required as the same buffer is used through the entire pipeline.

The LTISceneBuffer class stores the image data in a BSQ format for a specified width and height. Typically the user will supply the allocated memory to be used for the image data; however, the class also supports creation of a new buffer with a “windowed” view into an original buffer. This enables the same region of memory to be used by multiple stages in the pipeline, without the need for excessive data copying.

For decodes of large images, calling read() with a single large buffer is clearly inappropriate. In this case, the client at the “end” of the pipeline can choose to explicitly implement the above decode begin/strip/end workflow in a “pull” model, and only need to have one strip worth of image data resident at a time. The LTIImageWriter class implements this functionality, so that derived writers can encode large images efficiently.