icc_codec.h (1035B)
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_ICC_CODEC_H_ 7 #define LIB_JXL_ICC_CODEC_H_ 8 9 // Compressed representation of ICC profiles. 10 11 #include <cstddef> 12 #include <cstdint> 13 14 #include "lib/jxl/base/compiler_specific.h" 15 #include "lib/jxl/base/status.h" 16 #include "lib/jxl/dec_ans.h" 17 #include "lib/jxl/dec_bit_reader.h" 18 #include "lib/jxl/padded_bytes.h" 19 20 namespace jxl { 21 22 struct ICCReader { 23 Status Init(BitReader* reader, size_t output_limit); 24 Status Process(BitReader* reader, PaddedBytes* icc); 25 void Reset() { 26 bits_to_skip_ = 0; 27 decompressed_.clear(); 28 } 29 30 private: 31 Status CheckEOI(BitReader* reader); 32 size_t i_ = 0; 33 size_t bits_to_skip_ = 0; 34 size_t used_bits_base_ = 0; 35 uint64_t enc_size_ = 0; 36 std::vector<uint8_t> context_map_; 37 ANSCode code_; 38 ANSSymbolReader ans_reader_; 39 PaddedBytes decompressed_; 40 }; 41 42 } // namespace jxl 43 44 #endif // LIB_JXL_ICC_CODEC_H_