3DSoftware.com > Programming > File Formats > FIN > Page 8
FIN File Format  Page 8
 
Compression Types
 
ZLIB
 
With ZLIB compression, the scan lines of a tile form a single byte stream that is compressed with the ZLib programming library. The uncompressed byte stream that is fed into ZLib simply consists of one scan line after the other, beginning with the top scan line. There are no extra (pad) bytes between scan lines.
 
JPEG_2000
 
JPEG_2000 is implemented with Open Jpeg CODEC_J2K or CODEC_JP2. This is a lossy compression method.
 
DIFF_ENC
 
DIFF_ENC is Difference Encoding, which filters data to make it better suited for other types of encoding. With DIFF_ENC, node values are replaced with the difference between each node value and its preceeding node value. The first node is unaltered (the value of its preceeding node is considered to be zero). This method is lossless.
 
To encode a stream of nodes, begin with the last node of the stream, and replace that node value with its value minus the value of the preceeding node. Repeat that process for the second-to-last node in the stream, then for the third-to-last node, etc. (looping backward).
 
When decoding later, loop forward from the beginning of the stream of nodes. Add each difference to the value of the previous node (assume the node before the first node has a value of zero).
 
 
BIAS_ENC
 
BIAS_ENC is Bias Encoding for integers. In this scheme, each tile channel has a bias value, which is the minimum integer value for that tile channel. The value of each grid node within that tile channel becomes a positive offset from that bias.
 
For example, assume all integer values in a tile channel are in the range [1820, 1859]. The bias will be 1820, and the maximum offset will be 39.
 
BIAS_ENC encoding creates a BIAS_ENC stream consisting of an unsigned int (32-bit number) that specifies the bias, which is followed with the encoded grid nodes.
 
 
DYN_RAN
 
DYN_RAN is Dynamic Range Encoding which converts 64-bit ANSI/IEEE floating point numbers into unsigned integers (32-bits each). The stream of floating point numbers is converted to a DYN_RAN stream. The first 24 bytes of the DYN_RAN stream are tie points, immediately followed with the encoded grid nodes.
 
The tie points consists of two ANSI/IEEE floating point numbers, which are called doubles and are 8 bytes each, followed by two unsigned integers which are 4 bytes each. The first double specifies a low value, and the second double specifies a high value. The first unsigned int specifies an integer that corresponds to the first double, and the second unsigned int specifies an integer that corresponds to the second double. All other nodes will be scaled accordingly.
 
For example, if the doubles are 100.0 and 500.0, and the unsigned ints are 1 and 5, then the number 200.0 will be converted to 2.
 
Another example: If the tie points are { 100.0, 500.0, 1, 10} instead of { 100.0, 500.0, 1, 5 }, then 200.0 is converted to 4 instead of 2.
 
 
PRE_STRIP
 
This method removes (strips) nibbles from the beginning of each node. The most significant nibbles are removed from each node. The nodes must be integers.
 
The same number of nibbles are removed from each node of the stream of nodes. This method is lossles if the value of all removed nibbles is 0x0.
 
If the previous compression stage was BIAS_ENC, the first 4 bytes of the BIAS_ENC stream (the bias value) are passed through without stripping. Only the encoded grid nodes of the BIAS_ENC stream are stripped (or unstripped later – remember the sock theorem).
 
If the previous compression stage was DYN_RAN, the first 24 bytes of the DYN_RAN stream (the tie points) are passed through without stripping. Only the encoded grid nodes of the DYN_RAN stream are stripped (or unstripped later).
 
PRE_STRIP processing creates a PRE_STRIP stream beginning with an unsigned int (32-bit number) that specifies how many nibbles were stripped, which is immediately followed with a nibble stream of the processed grid nodes padded (if necessary) to make the stream an even number of nibbles.
 
POST_STRIP
 
This method removes (strips) nibbles from the end of each node. The least significant nibbles are removed from each node. The nodes must be integers or FloatBin numbers. If the nodes are FloatBin numbers, the trailing nibbles of each node are significand nibbles, and the number of nibbles removed should not exceed the number of significand nibbles.
 
The same number of nibbles are removed from each node of the stream of nodes. This method is lossles if the value of all removed nibbles is 0x0.
 
If the previous compression stage was BIAS_ENC, the first 4 bytes of the BIAS_ENC stream (the bias value) are passed through without stripping. Only the encoded grid nodes of the BIAS_ENC stream are stripped (or unstripped later – remember the sock theorem).
 
If the previous compression stage was DYN_RAN, the first 24 bytes of the DYN_RAN stream (the tie points) are passed through without stripping. Only the encoded grid nodes of the DYN_RAN stream are stripped (or unstripped later).
 
POST_STRIP processing creates a POST_STRIP stream beginning with an unsigned int (32-bit number) that specifies how many nibbles were stripped, which is immediately followed with a nibble stream of the processed grid nodes padded (if necessary) to make the stream an even number of nibbles.
 
—  Page 8  —
 « Page 7 Contents Page 9 » 
 
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:13:18 GMT