/** * @param shortestCodeWord * @param lengths * @param */ private void doCoderRoundTripTest(final BitVector[] expected, final BitVector shortestCodeWord, final int[] length, final int[] symbol) { final PrefixCoder newCoder = HuffmanCodec.newCoder(shortestCodeWord, length, symbol); final BitVector[] actual = newCoder.codeWords(); assertEquals("codeWord[]", expected, actual); if (log.isDebugEnabled()) { log.debug("\nexpected: " + Arrays.toString(expected) + "\nactual : " + Arrays.toString(actual)); } }
/** * @param shortestCodeWord * @param lengths * @param */ private void doCoderRoundTripTest(final BitVector[] expected, final BitVector shortestCodeWord, final int[] length, final int[] symbol) { final PrefixCoder newCoder = HuffmanCodec.newCoder(shortestCodeWord, length, symbol); final BitVector[] actual = newCoder.codeWords(); assertEquals("codeWord[]", expected, actual); if (log.isDebugEnabled()) { log.debug("\nexpected: " + Arrays.toString(expected) + "\nactual : " + Arrays.toString(actual)); } }
/** * (Re-)constructs the canonical huffman code from the shortest code word, * the non-decreasing bit lengths of each code word, and the permutation of * the symbols corresponding to those bit lengths. This information is * necessary and sufficient to reconstruct a canonical huffman code. * * @param decoderInputs * This contains the necessary and sufficient information to * recreate the {@link PrefixCoder}. * * @return A new {@link PrefixCoder} instance for the corresponding * canonical huffman code. */ static public PrefixCoder newCoder(final DecoderInputs decoderInputs) { return newCoder(decoderInputs.getShortestCodeWord(), decoderInputs .getLengths(), decoderInputs.getSymbols()); }
/** * (Re-)constructs the canonical huffman code from the shortest code word, * the non-decreasing bit lengths of each code word, and the permutation of * the symbols corresponding to those bit lengths. This information is * necessary and sufficient to reconstruct a canonical huffman code. * * @param decoderInputs * This contains the necessary and sufficient information to * recreate the {@link PrefixCoder}. * * @return A new {@link PrefixCoder} instance for the corresponding * canonical huffman code. */ static public PrefixCoder newCoder(final DecoderInputs decoderInputs) { return newCoder(decoderInputs.getShortestCodeWord(), decoderInputs .getLengths(), decoderInputs.getSymbols()); }