Class HuffmanTable

  • Direct Known Subclasses:
    DefaultHuffmanTable

    public class HuffmanTable
    extends java.lang.Object

    A class to store Huffman Tables, either as read from an SCP-ECG file or the default as specified in the SCP-ECG standard.

    See Also:
    DefaultHuffmanTable, HuffmanDecoder
    • Field Detail

      • numberOfCodeStructuresInTable

        protected int numberOfCodeStructuresInTable
      • numberOfBitsInPrefix

        protected int[] numberOfBitsInPrefix
      • numberOfBitsInEntireCode

        protected int[] numberOfBitsInEntireCode
      • tableModeSwitch

        protected int[] tableModeSwitch
      • baseValueRepresentedByBaseCode

        protected int[] baseValueRepresentedByBaseCode
      • baseCode

        protected long[] baseCode
    • Constructor Detail

      • HuffmanTable

        protected HuffmanTable()
      • HuffmanTable

        public HuffmanTable​(int numberOfCodeStructuresInTable,
                            int[] numberOfBitsInPrefix,
                            int[] numberOfBitsInEntireCode,
                            int[] tableModeSwitch,
                            int[] baseValueRepresentedByBaseCode,
                            long[] baseCode)

        Construct a Huffman Table from the supplied data as read from an SCP-ECG file.

        Parameters:
        numberOfCodeStructuresInTable - the number of codes (i.e. the size of all the array parameters)
        numberOfBitsInPrefix - for each code, the number of prefix bits for each code (i.e. the Huffman code)
        numberOfBitsInEntireCode - for each code, if > numberOfBitsInPrefix, used to find the number of original bits encoded
        tableModeSwitch - for each code, a flag to indicate to switch to another table (1 indicates no switch)
        baseValueRepresentedByBaseCode - for each code, the value that the code represents
        baseCode - the codes (with the order of bits reversed)
    • Method Detail

      • getNumberOfCodeStructuresInTable

        public int getNumberOfCodeStructuresInTable()
      • getNumberOfBitsInPrefix

        public int[] getNumberOfBitsInPrefix()
      • getNumberOfBitsInEntireCode

        public int[] getNumberOfBitsInEntireCode()
      • getTableModeSwitch

        public int[] getTableModeSwitch()
      • getBaseValueRepresentedByBaseCode

        public int[] getBaseValueRepresentedByBaseCode()
      • getBaseCode

        public long[] getBaseCode()
      • toString

        public java.lang.String toString()

        Dump the tables as a String.

        Overrides:
        toString in class java.lang.Object
        Returns:
        the tables as a String