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