"Fossies" - the Fresh Open Source Software Archive 
Member "pigz-2.8/zopfli/src/zopfli/tree.h" (11 Jan 2015, 1677 Bytes) of package /linux/privat/pigz-2.8.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "tree.h" see the
Fossies "Dox" file reference documentation.
1 /*
2 Copyright 2011 Google Inc. All Rights Reserved.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Author: lode.vandevenne@gmail.com (Lode Vandevenne)
17 Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala)
18 */
19
20 /*
21 Utilities for creating and using Huffman trees.
22 */
23
24 #ifndef ZOPFLI_TREE_H_
25 #define ZOPFLI_TREE_H_
26
27 #include <string.h>
28
29 /*
30 Calculates the bitlengths for the Huffman tree, based on the counts of each
31 symbol.
32 */
33 void ZopfliCalculateBitLengths(const size_t* count, size_t n, int maxbits,
34 unsigned *bitlengths);
35
36 /*
37 Converts a series of Huffman tree bitlengths, to the bit values of the symbols.
38 */
39 void ZopfliLengthsToSymbols(const unsigned* lengths, size_t n, unsigned maxbits,
40 unsigned* symbols);
41
42 /*
43 Calculates the entropy of each symbol, based on the counts of each symbol. The
44 result is similar to the result of ZopfliCalculateBitLengths, but with the
45 actual theoritical bit lengths according to the entropy. Since the resulting
46 values are fractional, they cannot be used to encode the tree specified by
47 DEFLATE.
48 */
49 void ZopfliCalculateEntropy(const size_t* count, size_t n, double* bitlengths);
50
51 #endif /* ZOPFLI_TREE_H_ */