| java.lang.Object com.sun.j3d.utils.compression.HuffmanTable
HuffmanTable | class HuffmanTable (Code) | | This class maintains a map from compression stream elements (tokens) onto
HuffmanNode objects. A HuffmanNode contains a tag describing the
associated token's data length, right shift value, and absolute/relative
status.
The tags are computed using Huffman's algorithm to build a binary tree with
a minimal total weighted path length. The frequency of each token is
used as its node's weight when building the tree. The path length from the
root to the token's node then indicates the bit length that should be used
for that token's tag in order to minimize the total size of the compressed
stream.
|
Constructor Summary | |
| HuffmanTable() Create a new HuffmanTable with entries for all possible position,
normal, and color tokens. |
Method Summary | |
void | addColorEntry(int length, int shift, boolean absolute) Add a color entry with the given length, shift, and absolute
status. | void | addNormalEntry(int length, int shift, boolean absolute) Add a normal entry with the given length, shift, and absolute
status. | void | addPositionEntry(int length, int shift, boolean absolute) Add a position entry with the given length, shift, and absolute
status. | void | clear() Clear this HuffmanTable instance. | void | computeTags() Compute optimized tags for each position, color, and normal entry. | HuffmanNode | getColorEntry(int length, int shift, boolean absolute) Get the color entry associated with the specified length, shift, and
absolute status. | HuffmanNode | getNormalEntry(int length, int shift, boolean absolute) Get the normal entry associated with the specified length, shift, and
absolute status. | HuffmanNode | getPositionEntry(int length, int shift, boolean absolute) Get the position entry associated with the specified length, shift, and
absolute status. | void | outputCommands(CommandStream output) Create compression stream commands for decompressors to use to set up
their decompression tables. | void | print(String header, Collection nodes) Print a collection of HuffmanNode objects to standard out. | void | print() Print the contents of this instance to standard out. |
HuffmanTable | HuffmanTable()(Code) | | Create a new HuffmanTable with entries for all possible position,
normal, and color tokens.
|
addColorEntry | void addColorEntry(int length, int shift, boolean absolute)(Code) | | Add a color entry with the given length, shift, and absolute
status.
Parameters: length - number of bits in each R, G, B, and A component Parameters: shift - number of trailing zeros in each component Parameters: absolute - if false, value represented is a delta from theprevious color in the compression stream |
addNormalEntry | void addNormalEntry(int length, int shift, boolean absolute)(Code) | | Add a normal entry with the given length, shift, and absolute
status.
Parameters: length - number of bits in each U and V component Parameters: shift - number of trailing zeros in each component Parameters: absolute - if false, value represented is a delta from theprevious normal in the compression stream |
addPositionEntry | void addPositionEntry(int length, int shift, boolean absolute)(Code) | | Add a position entry with the given length, shift, and absolute
status.
Parameters: length - number of bits in each X, Y, and Z component Parameters: shift - number of trailing zeros in each component Parameters: absolute - if false, value represented is a delta from theprevious vertex in the compression stream |
clear | void clear()(Code) | | Clear this HuffmanTable instance.
|
computeTags | void computeTags()(Code) | | Compute optimized tags for each position, color, and normal entry.
|
getColorEntry | HuffmanNode getColorEntry(int length, int shift, boolean absolute)(Code) | | Get the color entry associated with the specified length, shift, and
absolute status. This will contain a tag indicating the actual
encoding to be used in the compression command stream, not necessarily
the same as the original length and shift with which the the entry was
created.
Parameters: length - number of bits in each R, G, B, and A component Parameters: shift - number of trailing zeros in each component Parameters: absolute - if false, value represented is a delta from theprevious color in the compression stream HuffmanNode mapped to the specified parameters |
getNormalEntry | HuffmanNode getNormalEntry(int length, int shift, boolean absolute)(Code) | | Get the normal entry associated with the specified length, shift, and
absolute status. This will contain a tag indicating the actual
encoding to be used in the compression command stream, not necessarily
the same as the original length and shift with which the the entry was
created.
Parameters: length - number of bits in each U and V component Parameters: shift - number of trailing zeros in each component Parameters: absolute - if false, value represented is a delta from theprevious normal in the compression stream HuffmanNode mapped to the specified parameters |
getPositionEntry | HuffmanNode getPositionEntry(int length, int shift, boolean absolute)(Code) | | Get the position entry associated with the specified length, shift, and
absolute status. This will contain a tag indicating the actual
encoding to be used in the compression command stream, not necessarily
the same as the original length and shift with which the the entry was
created.
Parameters: length - number of bits in each X, Y, and Z component Parameters: shift - number of trailing zeros in each component Parameters: absolute - if false, value represented is a delta from theprevious vertex in the compression stream HuffmanNode mapped to the specified parameters |
outputCommands | void outputCommands(CommandStream output)(Code) | | Create compression stream commands for decompressors to use to set up
their decompression tables.
Parameters: output - CommandStream which receives the compression commands |
print | void print(String header, Collection nodes)(Code) | | Print a collection of HuffmanNode objects to standard out.
Parameters: header - descriptive string Parameters: nodes - Collection of HuffmanNode objects to print |
print | void print()(Code) | | Print the contents of this instance to standard out.
|
|
|