Grok 20.3.2
MarkerCache.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2026 Grok Image Compression Inc.
3 *
4 * This source code is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License, version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This source code is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Affero General Public License for more details.
12 *
13 * You should have received a copy of the GNU Affero General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#pragma once
19
20#include <vector>
21#include <memory>
22#include <cinttypes>
23
24namespace grk
25{
26
31struct Marker
32{
39 explicit Marker(uint16_t id = 0, uint64_t pos = 0, uint16_t len = 0)
40 : id_(id), pos_(pos), len_(len)
41 {}
42
47 void dump(FILE* outputFileStream)
48 {
49 fprintf(outputFileStream, "\t\t type=%#x, pos=%" PRIu64 ", len=%u\n", id_, pos_, len_);
50 }
51
55 uint16_t id_;
56
60 uint64_t pos_;
61
65 uint16_t len_;
66};
67
73{
78 virtual ~MarkerCache() = default;
79
84 void dump(FILE* out);
85
92 void add(uint16_t id, uint64_t pos, uint16_t len);
93
98 uint64_t getTileStreamStart();
99
104 void setTileStreamStart(uint64_t start);
105
106private:
111
116
120 std::vector<std::unique_ptr<Marker>> markers_;
121};
122
123} // namespace grk
ResWindow.
Definition CompressedChunkCache.h:36
MarkerCache()
Definition MarkerCache.cpp:39
uint64_t tileStreamStart_
start of tile stream
Definition MarkerCache.h:115
uint64_t getTileStreamStart()
Gets start of tile stream.
Definition MarkerCache.cpp:48
uint64_t mainHeaderStart_
main header start position (SOC position)
Definition MarkerCache.h:110
void add(uint16_t id, uint64_t pos, uint16_t len)
Adds a marker to the cache.
Definition MarkerCache.cpp:41
void dump(FILE *out)
Serializes markers to disk.
Definition MarkerCache.cpp:57
void setTileStreamStart(uint64_t start)
Sets start of tile stream.
Definition MarkerCache.cpp:53
virtual ~MarkerCache()=default
Destroys a MarkerCache.
std::vector< std::unique_ptr< Marker > > markers_
collection of Marker
Definition MarkerCache.h:120
uint16_t len_
marker length (marker id included)
Definition MarkerCache.h:65
void dump(FILE *outputFileStream)
serializes to disk
Definition MarkerCache.h:47
uint16_t id_
marker id
Definition MarkerCache.h:55
uint64_t pos_
position in code stream
Definition MarkerCache.h:60
Marker(uint16_t id=0, uint64_t pos=0, uint16_t len=0)
Constructs a Marker.
Definition MarkerCache.h:39