"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.
    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
    8     http://www.apache.org/licenses/LICENSE-2.0
   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.
   16 Author: lode.vandevenne@gmail.com (Lode Vandevenne)
   17 Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala)
   18 */
   20 /*
   21 Utilities for creating and using Huffman trees.
   22 */
   24 #ifndef ZOPFLI_TREE_H_
   25 #define ZOPFLI_TREE_H_
   27 #include <string.h>
   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);
   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);
   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);
   51 #endif  /* ZOPFLI_TREE_H_ */