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 ZopfliLZ77Store* store); 44 45 /* 46 Does the same as ZopfliLZ77Optimal, but optimized for the fixed tree of the 47 deflate standard. 48 The fixed tree never gives the best compression. But this gives the best 49 possible LZ77 encoding possible with the fixed tree. 50 This does not create or output any fixed tree, only LZ77 data optimized for 51 using with a fixed tree. 52 If instart is larger than 0, it uses values before instart as starting 53 dictionary. 54 */ 55 void 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