Class FloatPacker
java.lang.Object
org.web3d.vrml.export.compressors.FloatPacker
Compresses float by using quanitization.
- Version:
- $Revision: 1.6 $
- Author:
- Alan Hudson
-
Constructor Summary
ConstructorsConstructorDescriptionFloatPacker
(int num_exponent_bits, int num_mantissa_bits) FloatPacker
(int num_exponent_bits, int num_mantissa_bits, boolean signed) -
Method Summary
Modifier and TypeMethodDescriptionfloat
decode
(long src, boolean signed) Decodes a bit representation to a float value.long
encode
(float f, boolean rounding) Encode a float.void
reinit
(int num_exponent_bits, int num_mantissa_bits) void
reinit
(int num_exponent_bits, int num_mantissa_bits, boolean signed)
-
Constructor Details
-
FloatPacker
public FloatPacker(int num_exponent_bits, int num_mantissa_bits) -
FloatPacker
public FloatPacker(int num_exponent_bits, int num_mantissa_bits, boolean signed)
-
-
Method Details
-
reinit
public void reinit(int num_exponent_bits, int num_mantissa_bits, boolean signed) -
reinit
public void reinit(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 representation 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.- Returns:
-
decode
public float decode(long src, boolean signed) Decodes a bit representation to a float value.- Parameters:
src
- The source bitssigned
-- Returns:
- The float value
-