libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

huffman_table.h (870B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 #ifndef LIB_JXL_HUFFMAN_TABLE_H_
      7 #define LIB_JXL_HUFFMAN_TABLE_H_
      8 
      9 #include <stdint.h>
     10 #include <stdlib.h>
     11 
     12 namespace jxl {
     13 
     14 struct HuffmanCode {
     15   uint8_t bits;   /* number of bits used for this symbol */
     16   uint16_t value; /* symbol value or table offset */
     17 };
     18 
     19 /* Builds Huffman lookup table assuming code lengths are in symbol order. */
     20 /* Returns 0 in case of error (invalid tree or memory error), otherwise
     21    populated size of table. */
     22 uint32_t BuildHuffmanTable(HuffmanCode* root_table, int root_bits,
     23                            const uint8_t* code_lengths,
     24                            size_t code_lengths_size, uint16_t* count);
     25 
     26 }  // namespace jxl
     27 
     28 #endif  // LIB_JXL_HUFFMAN_TABLE_H_