libjxl

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

ans_params.h (1116B)


      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_ANS_PARAMS_H_
      7 #define LIB_JXL_ANS_PARAMS_H_
      8 
      9 // Common parameters that are needed for both the ANS entropy encoding and
     10 // decoding methods.
     11 
     12 #include <stdint.h>
     13 #include <stdlib.h>
     14 
     15 namespace jxl {
     16 
     17 // TODO(veluca): decide if 12 is the best constant here (valid range is up to
     18 // 16). This requires recomputing the Huffman tables in {enc,dec}_ans.cc
     19 // 14 gives a 0.2% improvement at d1 and makes d8 slightly worse. This is
     20 // likely not worth the increase in encoder complexity.
     21 #define ANS_LOG_TAB_SIZE 12u
     22 #define ANS_TAB_SIZE (1 << ANS_LOG_TAB_SIZE)
     23 #define ANS_TAB_MASK (ANS_TAB_SIZE - 1)
     24 
     25 // Largest possible symbol to be encoded by either ANS or prefix coding.
     26 #define PREFIX_MAX_ALPHABET_SIZE 4096
     27 #define ANS_MAX_ALPHABET_SIZE 256
     28 
     29 // Max number of bits for prefix coding.
     30 #define PREFIX_MAX_BITS 15
     31 
     32 #define ANS_SIGNATURE 0x13  // Initial state, used as CRC.
     33 
     34 }  // namespace jxl
     35 
     36 #endif  // LIB_JXL_ANS_PARAMS_H_