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 #ifndef ZOPFLI_KATAJAINEN_H_ 21 #define ZOPFLI_KATAJAINEN_H_ 22 23 #include <string.h> 24 25 /* 26 Outputs minimum-redundancy length-limited code bitlengths for symbols with the 27 given counts. The bitlengths are limited by maxbits. 28 29 The output is tailored for DEFLATE: symbols that never occur, get a bit length 30 of 0, and if only a single symbol occurs at least once, its bitlength will be 1, 31 and not 0 as would theoretically be needed for a single symbol. 32 33 frequencies: The amount of occurances of each symbol. 34 n: The amount of symbols. 35 maxbits: Maximum bit length, inclusive. 36 bitlengths: Output, the bitlengths for the symbol prefix codes. 37 return: 0 for OK, non-0 for error. 38 */ 39 int ZopfliLengthLimitedCodeLengths( 40 const size_t* frequencies, int n, int maxbits, unsigned* bitlengths); 41 42 #endif /* ZOPFLI_KATAJAINEN_H_ */ 43