/src/libjxl/lib/jxl/icc_codec.h
Line | Count | Source (jump to first uncovered line) |
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 <jxl/memory_manager.h> |
12 | | |
13 | | #include <cstddef> |
14 | | #include <cstdint> |
15 | | #include <vector> |
16 | | |
17 | | #include "lib/jxl/base/status.h" |
18 | | #include "lib/jxl/dec_ans.h" |
19 | | #include "lib/jxl/dec_bit_reader.h" |
20 | | #include "lib/jxl/padded_bytes.h" |
21 | | |
22 | | namespace jxl { |
23 | | |
24 | | struct ICCReader { |
25 | | explicit ICCReader(JxlMemoryManager* memory_manager) |
26 | 11.3k | : decompressed_(memory_manager) {} |
27 | | |
28 | | Status Init(BitReader* reader); |
29 | | Status Process(BitReader* reader, PaddedBytes* icc); |
30 | 0 | void Reset() { |
31 | 0 | bits_to_skip_ = 0; |
32 | 0 | decompressed_.clear(); |
33 | 0 | } |
34 | | |
35 | | private: |
36 | | static Status CheckEOI(BitReader* reader); |
37 | | size_t i_ = 0; |
38 | | size_t bits_to_skip_ = 0; |
39 | | size_t used_bits_base_ = 0; |
40 | | uint64_t enc_size_ = 0; |
41 | | std::vector<uint8_t> context_map_; |
42 | | ANSCode code_; |
43 | | ANSSymbolReader ans_reader_; |
44 | | PaddedBytes decompressed_; |
45 | | }; |
46 | | |
47 | | } // namespace jxl |
48 | | |
49 | | #endif // LIB_JXL_ICC_CODEC_H_ |