1 /** 2 * @file huffman.h 3 * Huffman codes. @ingroup data 4 * 5 * @see CLR 2nd Ed, p. 388 6 * 7 * @authors Copyright © 2003-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 8 * @authors Copyright © 2009-2013 Daniel Swanson <danij@dengine.net> 9 * 10 * @par License 11 * LGPL: http://www.gnu.org/licenses/lgpl.html 12 * 13 * <small>This program is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU Lesser General Public License as published by 15 * the Free Software Foundation; either version 3 of the License, or (at your 16 * option) any later version. This program is distributed in the hope that it 17 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 18 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 19 * General Public License for more details. You should have received a copy of 20 * the GNU Lesser General Public License along with this program; if not, see: 21 * http://www.gnu.org/licenses</small> 22 */ 23 24 #ifndef LIBDENG2_HUFFMAN_H 25 #define LIBDENG2_HUFFMAN_H 26 27 #include "../libcore.h" 28 #include "../Block" 29 30 namespace de { 31 namespace codec { 32 33 /** 34 * Encodes the data using Huffman codes. 35 * @param data Block of data to encode. 36 * 37 * @return Encoded block of bits. 38 */ 39 Block huffmanEncode(Block const &data); 40 41 /** 42 * Decodes the coded message using the Huffman tree. 43 * @param codedData Block of Huffman-coded data. 44 * 45 * @return Decoded block of data. 46 */ 47 Block huffmanDecode(Block const &codedData); 48 49 } // namespace codec 50 } // namespace de 51 52 #endif // LIBDENG2_HUFFMAN_H 53