/src/libjxl/lib/jxl/toc.h
Line | Count | Source |
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_TOC_H_ |
7 | | #define LIB_JXL_TOC_H_ |
8 | | |
9 | | #include <jxl/memory_manager.h> |
10 | | #include <stddef.h> |
11 | | #include <stdint.h> |
12 | | |
13 | | #include <vector> |
14 | | |
15 | | #include "lib/jxl/base/compiler_specific.h" |
16 | | #include "lib/jxl/base/status.h" |
17 | | #include "lib/jxl/coeff_order_fwd.h" |
18 | | #include "lib/jxl/dec_bit_reader.h" |
19 | | #include "lib/jxl/field_encodings.h" |
20 | | |
21 | | namespace jxl { |
22 | | |
23 | | // (2+bits) = 2,3,4 bytes so encoders can patch TOC after encoding. |
24 | | // 30 is sufficient for 4K channels of uncompressed 16-bit samples. |
25 | | constexpr U32Enc kTocDist(Bits(10), BitsOffset(14, 1024), BitsOffset(22, 17408), |
26 | | BitsOffset(30, 4211712)); |
27 | | |
28 | | size_t MaxBits(size_t num_sizes); |
29 | | |
30 | | // TODO(veluca): move these to FrameDimensions. |
31 | | static JXL_INLINE size_t AcGroupIndex(size_t pass, size_t group, |
32 | 4.52k | size_t num_groups, size_t num_dc_groups) { |
33 | 4.52k | return 2 + num_dc_groups + pass * num_groups + group; |
34 | 4.52k | } enc_frame.cc:jxl::AcGroupIndex(unsigned long, unsigned long, unsigned long, unsigned long) Line | Count | Source | 32 | 1.42k | size_t num_groups, size_t num_dc_groups) { | 33 | 1.42k | return 2 + num_dc_groups + pass * num_groups + group; | 34 | 1.42k | } |
Unexecuted instantiation: enc_toc.cc:jxl::AcGroupIndex(unsigned long, unsigned long, unsigned long, unsigned long) dec_frame.cc:jxl::AcGroupIndex(unsigned long, unsigned long, unsigned long, unsigned long) Line | Count | Source | 32 | 3.09k | size_t num_groups, size_t num_dc_groups) { | 33 | 3.09k | return 2 + num_dc_groups + pass * num_groups + group; | 34 | 3.09k | } |
Unexecuted instantiation: toc.cc:jxl::AcGroupIndex(unsigned long, unsigned long, unsigned long, unsigned long) |
35 | | |
36 | | static JXL_INLINE size_t NumTocEntries(size_t num_groups, size_t num_dc_groups, |
37 | 41.9k | size_t num_passes) { |
38 | 41.9k | if (num_groups == 1 && num_passes == 1) return 1; |
39 | 3.09k | return AcGroupIndex(0, 0, num_groups, num_dc_groups) + |
40 | 3.09k | num_groups * num_passes; |
41 | 41.9k | } Unexecuted instantiation: enc_frame.cc:jxl::NumTocEntries(unsigned long, unsigned long, unsigned long) Unexecuted instantiation: enc_toc.cc:jxl::NumTocEntries(unsigned long, unsigned long, unsigned long) dec_frame.cc:jxl::NumTocEntries(unsigned long, unsigned long, unsigned long) Line | Count | Source | 37 | 41.9k | size_t num_passes) { | 38 | 41.9k | if (num_groups == 1 && num_passes == 1) return 1; | 39 | 3.09k | return AcGroupIndex(0, 0, num_groups, num_dc_groups) + | 40 | 3.09k | num_groups * num_passes; | 41 | 41.9k | } |
Unexecuted instantiation: toc.cc:jxl::NumTocEntries(unsigned long, unsigned long, unsigned long) |
42 | | |
43 | | Status ReadToc(JxlMemoryManager* memory_manager, size_t toc_entries, |
44 | | BitReader* JXL_RESTRICT reader, |
45 | | std::vector<uint32_t>* JXL_RESTRICT sizes, |
46 | | std::vector<coeff_order_t>* JXL_RESTRICT permutation); |
47 | | |
48 | | Status ReadGroupOffsets(JxlMemoryManager* memory_manager, size_t toc_entries, |
49 | | BitReader* JXL_RESTRICT reader, |
50 | | std::vector<uint64_t>* JXL_RESTRICT offsets, |
51 | | std::vector<uint32_t>* JXL_RESTRICT sizes, |
52 | | uint64_t* total_size); |
53 | | |
54 | | } // namespace jxl |
55 | | |
56 | | #endif // LIB_JXL_TOC_H_ |