Class TreeDecoder

    • Constructor Detail

      • TreeDecoder

        public TreeDecoder​(TreeDecoder.Node root,
                           int n)
        Creates a new codeword-based decoder using the given tree. It is responsibility of the caller that the tree is well-formed, that is, that all internal nodes are instances of TreeDecoder.Node and all leaf nodes are instances of TreeDecoder.LeafNode.
        Parameters:
        root - the root of a decoding tree.
        n - the number of leaves (symbols).
      • TreeDecoder

        public TreeDecoder​(BitVector[] lexSortedCodeWord,
                           int[] symbol)
        Creates a new codeword-based decoder starting from a set of complete, lexicographically ordered codewords. It is responsibility of the caller that the tree is well-formed, that is, that the provided codewords are exactly the root-to-leaf paths of such a tree.
        Parameters:
        lexSortedCodeWord - a vector of lexically sorted codeWords.
        symbol - a mapping from codewords to symbols.
    • Method Detail

      • decode

        public int decode​(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
      • buildCodes

        public BitVector[] buildCodes()
        Generate the codewords corresponding to this tree decoder.
        Returns:
        a vector of codewords for this decoder.