1/* 2Copyright 2011 Google Inc. All Rights Reserved. 3 4Licensed under the Apache License, Version 2.0 (the "License"); 5you may not use this file except in compliance with the License. 6You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10Unless required by applicable law or agreed to in writing, software 11distributed under the License is distributed on an "AS IS" BASIS, 12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13See the License for the specific language governing permissions and 14limitations under the License. 15 16Author: lode.vandevenne@gmail.com (Lode Vandevenne) 17Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala) 18*/ 19 20/* 21The squeeze functions do enhanced LZ77 compression by optimal parsing with a 22cost model, rather than greedily choosing the longest length or using a single 23step of lazy matching like regular implementations. 24 25Since the cost model is based on the Huffman tree that can only be calculated 26after the LZ77 data is generated, there is a chicken and egg problem, and 27multiple runs are done with updated cost models to converge to a better 28solution. 29*/ 30 31#ifndef ZOPFLI_SQUEEZE_H_ 32#define ZOPFLI_SQUEEZE_H_ 33 34#include "lz77.h" 35 36/* 37Calculates lit/len and dist pairs for given data. 38If instart is larger than 0, it uses values before instart as starting 39dictionary. 40*/ 41void ZopfliLZ77Optimal(ZopfliBlockState *s, 42 const unsigned char* in, size_t instart, size_t inend, 43 ZopfliLZ77Store* store); 44 45/* 46Does the same as ZopfliLZ77Optimal, but optimized for the fixed tree of the 47deflate standard. 48The fixed tree never gives the best compression. But this gives the best 49possible LZ77 encoding possible with the fixed tree. 50This does not create or output any fixed tree, only LZ77 data optimized for 51using with a fixed tree. 52If instart is larger than 0, it uses values before instart as starting 53dictionary. 54*/ 55void ZopfliLZ77OptimalFixed(ZopfliBlockState *s, 56 const unsigned char* in, 57 size_t instart, size_t inend, 58 ZopfliLZ77Store* store); 59 60#endif /* ZOPFLI_SQUEEZE_H_ */ 61