"Fossies" - the Fresh Open Source Software Archive

Member "pigz-2.8/zopfli/src/zopfli/squeeze.h" (28 Dec 2017, 2217 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 "squeeze.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.4_vs_2.5.

    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 The squeeze functions do enhanced LZ77 compression by optimal parsing with a
   22 cost model, rather than greedily choosing the longest length or using a single
   23 step of lazy matching like regular implementations.
   24 
   25 Since the cost model is based on the Huffman tree that can only be calculated
   26 after the LZ77 data is generated, there is a chicken and egg problem, and
   27 multiple runs are done with updated cost models to converge to a better
   28 solution.
   29 */
   30 
   31 #ifndef ZOPFLI_SQUEEZE_H_
   32 #define ZOPFLI_SQUEEZE_H_
   33 
   34 #include "lz77.h"
   35 
   36 /*
   37 Calculates lit/len and dist pairs for given data.
   38 If instart is larger than 0, it uses values before instart as starting
   39 dictionary.
   40 */
   41 void ZopfliLZ77Optimal(ZopfliBlockState *s,
   42                        const unsigned char* in, size_t instart, size_t inend,
   43                        int numiterations,
   44                        ZopfliLZ77Store* store);
   45 
   46 /*
   47 Does the same as ZopfliLZ77Optimal, but optimized for the fixed tree of the
   48 deflate standard.
   49 The fixed tree never gives the best compression. But this gives the best
   50 possible LZ77 encoding possible with the fixed tree.
   51 This does not create or output any fixed tree, only LZ77 data optimized for
   52 using with a fixed tree.
   53 If instart is larger than 0, it uses values before instart as starting
   54 dictionary.
   55 */
   56 void ZopfliLZ77OptimalFixed(ZopfliBlockState *s,
   57                             const unsigned char* in,
   58                             size_t instart, size_t inend,
   59                             ZopfliLZ77Store* store);
   60 
   61 #endif  /* ZOPFLI_SQUEEZE_H_ */