Grok  9.7.5
PLMarkerMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2022 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 #pragma once
18 #include <vector>
19 #include <map>
20 
21 //#define DEBUG_PLT
22 
23 namespace grk
24 {
25 // raw markers - PL is stored using comma code
26 typedef std::vector<grk_buf8*> PL_MARKER;
27 typedef std::map<uint32_t, PL_MARKER*> PL_MARKERS;
28 
30 {
31  PLMarkerMgr(void);
32  ~PLMarkerMgr(void);
33 
34  void disable(void);
35  bool isEnabled(void);
36 
38  // compress
39  void pushInit(bool isFinal);
40  bool pushPL(uint32_t len);
41  bool write(void);
42  uint32_t getTotalBytesWritten(void);
44 
46  // decompress
48  bool readPLT(uint8_t* headerData, uint16_t header_size);
49  bool readPLM(uint8_t* headerData, uint16_t header_size);
50  void rewind(void);
51  uint32_t pop(void);
52  uint64_t pop(uint64_t numPackets);
54  private:
55  void clearMarkers(void);
56  bool findMarker(uint32_t index, bool compress);
57  grk_buf8* addNewMarker(uint8_t* data, uint16_t len);
59  PL_MARKERS::iterator currMarkerIter_;
60 
62  // compress
64  bool isFinal_;
67 
69  // decompress
70  bool readNextByte(uint8_t Iplm, uint32_t* packetLength);
72  uint32_t packetLen_;
76 
77  bool enabled_;
78 };
79 
80 } // namespace grk
Copyright (C) 2016-2022 Grok Image Compression Inc.
Definition: ICacheable.h:20
std::map< uint32_t, PL_MARKER * > PL_MARKERS
Definition: PLMarkerMgr.h:27
std::vector< grk_buf8 * > PL_MARKER
Definition: PLMarkerMgr.h:26
Definition: IBufferedStream.h:20
Definition: PLMarkerMgr.h:30
bool readPLM(uint8_t *headerData, uint16_t header_size)
Definition: PLMarkerMgr.cpp:160
uint32_t getTotalBytesWritten(void)
Definition: PLMarkerMgr.cpp:134
bool write(void)
Definition: PLMarkerMgr.cpp:138
grk_buf8 * addNewMarker(uint8_t *data, uint16_t len)
Definition: PLMarkerMgr.cpp:197
uint32_t pop(void)
Definition: PLMarkerMgr.cpp:296
PL_MARKERS * rawMarkers_
Definition: PLMarkerMgr.h:58
uint32_t totalBytesWritten_
Definition: PLMarkerMgr.h:63
void pushInit(bool isFinal)
Definition: PLMarkerMgr.cpp:59
void disable(void)
Definition: PLMarkerMgr.cpp:38
bool pushPL(uint32_t len)
Definition: PLMarkerMgr.cpp:65
PLMarkerMgr(void)
Definition: PLMarkerMgr.cpp:23
bool readNextByte(uint8_t Iplm, uint32_t *packetLength)
Definition: PLMarkerMgr.cpp:269
void clearMarkers(void)
Definition: PLMarkerMgr.cpp:46
bool readPLT(uint8_t *headerData, uint16_t header_size)
Definition: PLMarkerMgr.cpp:208
bool sequential_
Definition: PLMarkerMgr.h:71
bool findMarker(uint32_t index, bool compress)
Definition: PLMarkerMgr.cpp:228
bool isEnabled(void)
Definition: PLMarkerMgr.cpp:42
~PLMarkerMgr(void)
Definition: PLMarkerMgr.cpp:33
bool enabled_
Definition: PLMarkerMgr.h:77
PL_MARKERS::iterator currMarkerIter_
Definition: PLMarkerMgr.h:59
grk_buf8 * currMarkerBuf_
Definition: PLMarkerMgr.h:74
void rewind(void)
Definition: PLMarkerMgr.cpp:341
uint32_t currMarkerBufIndex_
Definition: PLMarkerMgr.h:73
uint32_t packetLen_
Definition: PLMarkerMgr.h:72
bool isFinal_
Definition: PLMarkerMgr.h:64
IBufferedStream * stream_
Definition: PLMarkerMgr.h:65