enc_context_map.h (1068B)
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_ENC_CONTEXT_MAP_H_ 7 #define LIB_JXL_ENC_CONTEXT_MAP_H_ 8 9 #include <stddef.h> 10 #include <stdint.h> 11 12 #include <vector> 13 14 #include "lib/jxl/ac_context.h" 15 #include "lib/jxl/enc_bit_writer.h" 16 17 namespace jxl { 18 19 struct AuxOut; 20 21 // Max limit is 255 because encoding assumes numbers < 255 22 // More clusters can help compression, but makes encode/decode somewhat slower 23 static const size_t kClustersLimit = 128; 24 25 // Encodes the given context map to the bit stream. The number of different 26 // histogram ids is given by num_histograms. 27 void EncodeContextMap(const std::vector<uint8_t>& context_map, 28 size_t num_histograms, BitWriter* writer, size_t layer, 29 AuxOut* aux_out); 30 31 void EncodeBlockCtxMap(const BlockCtxMap& block_ctx_map, BitWriter* writer, 32 AuxOut* aux_out); 33 } // namespace jxl 34 35 #endif // LIB_JXL_ENC_CONTEXT_MAP_H_