3DSoftware.com > Programming > File Formats > BIP > Page 7
BIP File Format  Page 7
 
Data Storage
 
Blocks and bands are stored like tiles. In this page, discussion of tiles also applies to blocks and bands.
 
 
Single Channel
 
This section covers storage of tiles (or blocks or bands) in files that have only one channel (bit plane). If the file has more than one bit plane, see the next section.
 
The first byte of a tile is the tile lead byte that specifies the type of tile.
 
If the tile lead byte is 0x00, the tile is uncompressed and that lead byte is immediately followed with grid nodes (pixel data) in raster order.
 
If the tile lead byte is 0x01, all the grid nodes (pixels) in the tile are the same value, and the next byte specifies the value that will be assigned to all pixels in the tile (must be 0x00 or 0x01). Nothing else is stored in the tile (the tile is only 2 bytes).
 
Note: If compression is turned OFF for the file, the tile lead byte must be 0x00 or 0x01.
 
If the tile lead byte is 0x02, the tile is compressed and the next byte specifies the type of compression:
 
0x00  =  
0x01  =  
0x02  =  
0x03  =  
0x04  =  
No Compression
CCITT
RLE
ZLIB
RLE and ZLIB
 
If 0x00 (No Compression) is specified, the rest of the tile simply consists of uncompressed pixel data.
 
When compression is implemented, each compression stage outputs an unsigned int (4 bytes) that specifies the size (number of bytes) of the compressed stream which immediately follows.
 
For simplicity of processing, ZLIB compression uses lead and trailing pad bits as needed, so that bit shifting within data bytes is not needed to implement ZLIB compression, which is a byte-level type of compression.
 
 
Multiple Channels
 
This section covers storage of tiles in files that have multiple channels (bit planes). If the file has only one bit plane, see the previous section.
 
In files that have more than one channel, each tile consists multiple streams, with each stream corresponding to a channel. The first stream contains the pixels that are in that tile in the first channel, the second stream contains the pixels that are in that tile in the second channel, etc. Each such stream is called a tile channel stream (TCS), and the streams are stored one after the other, without pad bytes between them.
 
The first byte of a tile channel stream is the TCS lead byte.
 
If the TCS lead byte is 0x00, the tile channel is uncompressed and that lead byte is immediately followed with the image data (pixel scanlines) in raster order.
 
If the TCS lead byte is 0x01, all the grid nodes (pixels) in the tile channel have the same value, and the next byte specifies the value that will be assigned to all pixels in that tile channel. Nothing else is stored in the tile channel (that tile channel stream is only 2 bytes).
 
Note: If compression is turned OFF for the file, the TCS lead byte must be 0x00 or 0x01.
 
If the TCS lead byte is 0x02, the tile channel is compressed and the next byte specifies the type of compression:
 
0x00  =  
0x01  =  
0x02  =  
0x03  =  
0x04  =  
No Compression
CCITT
RLE
ZLIB
RLE and ZLIB
 
If 0x00 (No Compression) is specified, the rest of the tile channel stream simply consists of uncompressed pixel data.
 
When compression is implemented, each compression stage outputs an unsigned int (4 bytes) that specifies the size (number of bytes) of the compressed stream which immediately follows.
 
For simplicity of processing, ZLIB compression uses lead and trailing pad bits as needed, so that bit shifting within data bytes is not needed to implement ZLIB compression, which is a byte-level type of compression.
 
—  Page 7  —
 « Page 6 Contents
 
Copyright © 2008 by 3D Software. All rights reserved.
3D Software, P.O. Box 221190, Sacramento CA 95822 USA
www.3DSoftware.com     Contact us
Tuesday, 06-Jan-2009 01:18:42 GMT