Class CanonicalFast64CodeWordDecoder

java.lang.Object
it.unimi.dsi.compression.CanonicalFast64CodeWordDecoder
All Implemented Interfaces:
Decoder, Serializable

public final class CanonicalFast64CodeWordDecoder extends Object implements Decoder, Serializable
A fast table-based decoder for canonical Huffman codes supporting only codes with limited (less than 64 bits) codewords. We use the technique described by Daniel S. Hirschberg and Debra A. Lelewer, “Efficient Decoding of Prefix Codes”, Comm. ACM, 33(4): 449−459, 1990.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    CanonicalFast64CodeWordDecoder(int[] codeWordLength, int[] symbol)
    Creates a new codeword-based decoder using the given vector of codewords lengths and a symbol array.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    decode(it.unimi.dsi.fastutil.booleans.BooleanIterator iterator)
    Decodes the next symbol from the given boolean iterator.
    int
    Decodes the next symbol from the given input bit stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CanonicalFast64CodeWordDecoder

      public CanonicalFast64CodeWordDecoder(int[] codeWordLength, int[] symbol)
      Creates a new codeword-based decoder using the given vector of codewords lengths and a symbol array.
      Parameters:
      codeWordLength - a vector of nondecreasing codeword lengths suitable for a canonical code.
      symbol - a parallel array of symbols corresponding to each codeword length.
  • Method Details

    • decode

      public int decode(it.unimi.dsi.fastutil.booleans.BooleanIterator iterator)
      Description copied from interface: Decoder
      Decodes the next symbol from the given boolean iterator.

      Note that InputBitStream implements BooleanIterator.

      Specified by:
      decode in interface Decoder
      Parameters:
      iterator - a boolean iterator.
      Returns:
      the next symbol decoded from the bits emitted by i
    • decode

      public int decode(InputBitStream ibs) throws IOException
      Description copied from interface: Decoder
      Decodes the next symbol from the given input bit stream.

      Note that InputBitStream implements BooleanIterator.

      Specified by:
      decode in interface Decoder
      Parameters:
      ibs - an input bit stream.
      Returns:
      the next symbol decoded from ibs.
      Throws:
      IOException