PLMarkerMgr.h
Go to the documentation of this file.
/*
* Copyright (C) 2016-2023 Grok Image Compression Inc.
*
* This source code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <vector>
#include <map>
//#define DEBUG_PLT
namespace grk
{
// raw markers - PL is stored using comma code
typedef std::vector<grk_buf8*> PL_MARKER;
typedef std::map<uint32_t, PL_MARKER*> PL_MARKERS;
struct PLMarkerMgr
{
PLMarkerMgr(void);
~PLMarkerMgr(void);
void disable(void);
bool isEnabled(void);
// compress
void pushInit(bool isFinal);
bool pushPL(uint32_t len);
bool write(void);
uint32_t getTotalBytesWritten(void);
// decompress
PLMarkerMgr(BufferedStream* strm);
bool readPLT(uint8_t* headerData, uint16_t header_size);
bool readPLM(uint8_t* headerData, uint16_t header_size);
void rewind(void);
uint32_t pop(void);
uint64_t pop(uint64_t numPackets);
private:
void clearMarkers(void);
bool findMarker(uint32_t index, bool compress);
grk_buf8* addNewMarker(uint8_t* data, uint16_t len);
PL_MARKERS* rawMarkers_;
PL_MARKERS::iterator currMarkerIter_;
// compress
uint32_t totalBytesWritten_;
bool isFinal_;
BufferedStream* stream_;
// decompress
bool readNextByte(uint8_t Iplm, uint32_t* packetLength);
bool sequential_;
uint32_t packetLen_;
uint32_t currMarkerBufIndex_;
grk_buf8* currMarkerBuf_;
bool enabled_;
};
} // namespace grk
grk
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk::grk_read
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
grk::PL_MARKERS
std::map< uint32_t, PL_MARKER * > PL_MARKERS
Definition PLMarkerMgr.h:27
grk::PL_MARKER
std::vector< grk_buf8 * > PL_MARKER
Definition PLMarkerMgr.h:26
grk::BufferedStream
Definition BufferedStream.h:35
grk::PLMarkerMgr
Definition PLMarkerMgr.h:30
grk::PLMarkerMgr::readPLM
bool readPLM(uint8_t *headerData, uint16_t header_size)
Definition PLMarkerMgr.cpp:160
grk::PLMarkerMgr::getTotalBytesWritten
uint32_t getTotalBytesWritten(void)
Definition PLMarkerMgr.cpp:134
grk::PLMarkerMgr::write
bool write(void)
Definition PLMarkerMgr.cpp:138
grk::PLMarkerMgr::addNewMarker
grk_buf8 * addNewMarker(uint8_t *data, uint16_t len)
Definition PLMarkerMgr.cpp:197
grk::PLMarkerMgr::pop
uint32_t pop(void)
Definition PLMarkerMgr.cpp:296
grk::PLMarkerMgr::rawMarkers_
PL_MARKERS * rawMarkers_
Definition PLMarkerMgr.h:58
grk::PLMarkerMgr::totalBytesWritten_
uint32_t totalBytesWritten_
Definition PLMarkerMgr.h:63
grk::PLMarkerMgr::pushInit
void pushInit(bool isFinal)
Definition PLMarkerMgr.cpp:59
grk::PLMarkerMgr::disable
void disable(void)
Definition PLMarkerMgr.cpp:38
grk::PLMarkerMgr::pushPL
bool pushPL(uint32_t len)
Definition PLMarkerMgr.cpp:65
grk::PLMarkerMgr::PLMarkerMgr
PLMarkerMgr(void)
Definition PLMarkerMgr.cpp:23
grk::PLMarkerMgr::readNextByte
bool readNextByte(uint8_t Iplm, uint32_t *packetLength)
Definition PLMarkerMgr.cpp:269
grk::PLMarkerMgr::clearMarkers
void clearMarkers(void)
Definition PLMarkerMgr.cpp:46
grk::PLMarkerMgr::readPLT
bool readPLT(uint8_t *headerData, uint16_t header_size)
Definition PLMarkerMgr.cpp:208
grk::PLMarkerMgr::sequential_
bool sequential_
Definition PLMarkerMgr.h:71
grk::PLMarkerMgr::findMarker
bool findMarker(uint32_t index, bool compress)
Definition PLMarkerMgr.cpp:228
grk::PLMarkerMgr::isEnabled
bool isEnabled(void)
Definition PLMarkerMgr.cpp:42
grk::PLMarkerMgr::~PLMarkerMgr
~PLMarkerMgr(void)
Definition PLMarkerMgr.cpp:33
grk::PLMarkerMgr::enabled_
bool enabled_
Definition PLMarkerMgr.h:77
grk::PLMarkerMgr::currMarkerIter_
PL_MARKERS::iterator currMarkerIter_
Definition PLMarkerMgr.h:59
grk::PLMarkerMgr::currMarkerBuf_
grk_buf8 * currMarkerBuf_
Definition PLMarkerMgr.h:74
grk::PLMarkerMgr::stream_
BufferedStream * stream_
Definition PLMarkerMgr.h:65
grk::PLMarkerMgr::rewind
void rewind(void)
Definition PLMarkerMgr.cpp:340
grk::PLMarkerMgr::currMarkerBufIndex_
uint32_t currMarkerBufIndex_
Definition PLMarkerMgr.h:73
grk::PLMarkerMgr::packetLen_
uint32_t packetLen_
Definition PLMarkerMgr.h:72
grk::PLMarkerMgr::isFinal_
bool isFinal_
Definition PLMarkerMgr.h:64
grk::grk_buf< uint8_t, AllocatorVanilla >