3DSoftware.com > Programming > File Formats > FIN > Page 9
FIN File Format  Page 9
 
Data Storage
 
If tiling is used, use the file header's Pointer to Tile Addresses to find the file data (grid nodes). If blocks are used, use the Pointer to Block Addresses to find the data. If bands are used, use the Pointer to Band Addresses to find the data.
 
If tiling, blocks and bands are not used, the file header is immediately followed with the file data (grid nodes), uncompressed in raster order, beginning with the top scan line, without any pad bytes between scan lines. If there are multiple channels (more than one matrix), the data for the first channel is followed with the data for the second channel, etc., without any pad bytes between the channels.
 
Blocks and bands are stored like tiles. In the rest of this page, discussion of tiles also applies to blocks and bands.
 
 
Single Channel
 
This section covers storage of tiles (or blocks and/or bands) in files that have only one channel. If the file has more than one channel, 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 in raster order. Each node is stored intact, with most significant byte first if it is a multi-byte number.
 
If the tile lead byte is 0x01, all the grid nodes in the tile are the same value, and that value immediately follows. Nothing else is stored in the tile (the tile is only 1 byte plus the size of a grid node).
 
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 4 bytes after that lead byte specify the 4 compression stages. The first of those 4 bytes specifies the first stage, the second specifies the second stage, etc. Each stage can be one of the following:
 
0x00  =  
0x01  =  
0x02  =  
0x10  =  
0x20  =  
0x21  =  
0x40  =  
0x41  =  
No Compression
ZLIB
JPEG_2000
DIFF_ENC
BIAS_ENC
DYN_RAN
PRE_STRIP
POST_STRIP
 
If all 4 compression stages are 0x00 (No Compression), the rest of the tile simply consists of uncompressed grid nodes.
 
Each compression stage takes the output of the previous stage as input.
 
The output of a DIFF_ENC, BIAS_ENC, DYN_RAN, PRE_STRIP or POST_STRIP stage is a DIFF_ENC, BIAS_ENC, DYN_RAN, PRE_STRIP or POST_STRIP stream respectively.
 
The output of a ZLIB or JPEG_2000 stage is an unsigned int (32-bit number) that specifies the number of bytes in the ZLib or Jpeg2000 stream, which is followed by the ZLib or Jpeg2000 stream.
 
For example, a tile that is DIFF_ENC encoded and then compressed with ZLIB is stored as a stream with tile lead byte 0x20, followed with the four bytes {0x10, 0x01, 0x00, 0x00} that specify the compression stages, followed with a 32-bit number that specifies the size of the ZLIB stream, which is followed with the ZLIB stream.
 
 
Multiple Channels
 
This section covers storage of tiles (or blocks and/or bands) in files that have multiple channels. If the file has only one channel, see the previous section.
 
In files that have more than one channel, each tile consists of one or more streams. Each tile stream corresponds to a channel. The first stream contains the grid nodes that are in that tile in the first channel, the second stream contains the nodes 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 grid nodes in raster order. Each node is stored intact, with most significant byte first if it is a multi-byte number.
 
If the TCS lead byte is 0x01, all the grid nodes in the tile channel are the same value, and that value immediately follows. Nothing else is stored in the tile channel stream (the TCS is only 1 byte plus the size of a grid node).
 
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 4 bytes after that lead byte specify the 4 compression stages. The first of those 4 bytes specifies the first stage, the second specifies the second stage, etc. Each stage can be one of the following:
 
0x00  =  
0x01  =  
0x02  =  
0x10  =  
0x20  =  
0x21  =  
0x40  =  
0x41  =  
No Compression
ZLIB
JPEG_2000
DIFF_ENC
BIAS_ENC
DYN_RAN
PRE_STRIP
POST_STRIP
 
If all 4 compression stages are 0x00 (No Compression), the rest of the tile channel stream simply consists of uncompressed grid nodes.
 
Each compression stage takes the output of the previous stage as input.
 
The output of a DIFF_ENC, BIAS_ENC, DYN_RAN, PRE_STRIP or POST_STRIP stage is a DIFF_ENC, BIAS_ENC, DYN_RAN, PRE_STRIP or POST_STRIP stream respectively.
 
The output of a ZLIB or JPEG_2000 stage is an unsigned int (32-bit number) that specifies the number of bytes in the ZLib or Jpeg2000 stream, which is followed by the ZLib or Jpeg2000 stream.
 
For example, a tile channel that is DIFF_ENC encoded and then compressed with ZLIB is stored as a stream with TCS lead byte 0x20, followed with the four bytes {0x10, 0x01, 0x00, 0x00} that specify the compression stages, followed with a 32-bit number that specifies the size of the ZLIB stream, which is followed with the ZLIB stream.
 
—  Page 9  —
 « Page 8 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 02:29:17 GMT