org.web3d.vrml.export.compressors
Class FloatPacker
java.lang.Object
org.web3d.vrml.export.compressors.FloatPacker
- public class FloatPacker
- extends java.lang.Object
Compresses float by using quanitization.
- Version:
- $Revision: 1.5 $
- Author:
- Alan Hudson
|
Constructor Summary |
FloatPacker(int num_exponent_bits,
int num_mantissa_bits)
|
|
Method Summary |
float |
decode(long src,
boolean signed)
Decodes a bit representation to a float value. |
long |
encode(float f,
boolean rounding)
Encode a float. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FloatPacker
public FloatPacker(int num_exponent_bits,
int num_mantissa_bits)
encode
public long encode(float f,
boolean rounding)
- Encode a float. The return value is the bit reprenstation using
the requested mantissa and exponent bits. Mask out the result
and save the bits.
- Parameters:
f - The float to encoderounding - Whether to round the result. Gives better accuracy.
decode
public float decode(long src,
boolean signed)
- Decodes a bit representation to a float value.
- Parameters:
src - The source bits
- Returns:
- The float value
Copyright © 2001 - 2005 Web3D Consortium