Grok 20.3.2
grk::t1::CodeblockDecompressImpl Struct Reference

Decompression code block implementation. More...

#include <CodeblockDecompressImpl.h>

Inheritance diagram for grk::t1::CodeblockDecompressImpl:
grk::t1::CodeblockImpl

Public Member Functions

 CodeblockDecompressImpl (uint16_t numLayers)
 Constructs a CodeblockDecompressImpl.
 ~CodeblockDecompressImpl ()
 Destroys a CodeblockDecompressImpl.
void init ()
 Initializes the code block.
std::vector< Segment * >::iterator toBeDecompressedBegin ()
 Iterator pointing to the beginning of the segments yet to be decompressed.
std::vector< Segment * >::iterator toBeDecompressedEnd ()
 Iterator pointing one location past the last Segment whose data has been parsed.
void setNumBps (uint8_t bps)
 Sets number of bit planes to be decompressed.
SegmentgetSegment (uint16_t index)
 Gets segment for the specified index If index equals number of segments, then a new segment will be added.
void readPacketHeader (std::shared_ptr< t1_t2::BitIO > bio, uint32_t &signalledLayerDataBytes, uint16_t layno, uint8_t cblk_sty)
 Reads packet header.
void parsePacketData (uint16_t layno, size_t &remainingTilePartBytes, bool isHT, uint8_t *layerData, uint32_t &layerDataOffset)
 Parses packet data based on packet header.
void nextToBeDecompressedSegment (std::vector< Segment * >::iterator &s)
 Increments iterator for next segment to be decompressed.
void prepareBufferList (std::vector< Segment * >::iterator seg)
bool canDecompress (void)
template<typename T>
bool decompress (T *coder, uint8_t orientation, uint32_t cblksty)
 Decompresses all layers specified so far.
uint16_t getNumDataParsedSegments (void)
 Gets number of segments whose layer data has been parsed.
std::vector< Segment * >::iterator currDataParsedSegment (void)
 Gets iterator pointing to current segment whose layer data is being parsed.
std::vector< Segment * >::iterator nextDataParsedSegment (void)
 Increments to next segment whose data is going to be parsed.
std::vector< Segment * >::iterator currHeaderParsedSegment (void)
 Gets iterator pointing to current segment being populated by packet header.
bool dataChunksEmpty ()
 Checks whether all segments' data chunks are empty.
size_t getDataChunksLength () const
 Gets combined length of all data chunks across all uncompressed segments whose datg has been parsed.
bool copyDataChunksToContiguous (uint8_t *buffer) const
 Copies all segment data chunk buffers for all uncompressed segments whose data has been parsed, into a single contiguous buffer.
Public Member Functions inherited from grk::t1::CodeblockImpl
 CodeblockImpl (uint16_t numLayers)
 ~CodeblockImpl ()
uint8_t getNumPassesInLayer (uint16_t layno)
void setNumPassesInLayer (uint16_t layno, uint8_t passes)
void incNumPassesInLayer (uint16_t layno, uint8_t delta)
Buffer8getCompressedStream (void)
uint8_t numbps (void)
void setNumBps (uint8_t bps)
uint8_t numlenbits ()
void setNumLenBits (uint8_t bits)

Private Member Functions

void release ()
 Releases resources.
void newSegment (uint8_t cblk_sty)
 Creates a new Segment.

Private Attributes

uint8_t numDataParsedSegments_
 Number of segments whose data has been read from their respective layers.
uint8_t numDecompressedSegments_
 Number of decompressed segments.
std::vector< Segment * > segs_
 Collection of Segment.
uint8_t ** buffers_
 Array of pointers to buffers.
uint32_t * buffer_lengths_
 Array of buffer lengths.
uint16_t num_buffers_
 Number of buffers.
uint8_t bitPlanesToDecompress_
 Remaining bit planes to decompress.
uint8_t passtype_
 Type of pass: cleanup, magnitude refinement or significance propagation.
uint32_t compressDataOffset_
 offset into contiguous buffer of compressed data
uint8_t passno_
 decompression: current pass number
bool needsSegInit_
 decompression: segment needs initialization
bool needsSegUpdate_
 decompression: segment needs update, as more packets have been parsed
uint16_t dataParsedLayers_
 number of layers whose data has been parsed

Additional Inherited Members

Protected Member Functions inherited from grk::t1::CodeblockImpl
void init ()
Protected Attributes inherited from grk::t1::CodeblockImpl
Buffer8 compressedStream
uint8_t numbps_
uint8_t numlenbits_
uint8_t * signalledPassesByLayer_
uint16_t numLayers_

Detailed Description

Decompression code block implementation.

Constructor & Destructor Documentation

◆ CodeblockDecompressImpl()

grk::t1::CodeblockDecompressImpl::CodeblockDecompressImpl ( uint16_t numLayers)
inline

◆ ~CodeblockDecompressImpl()

grk::t1::CodeblockDecompressImpl::~CodeblockDecompressImpl ( )
inline

Member Function Documentation

◆ canDecompress()

bool grk::t1::CodeblockDecompressImpl::canDecompress ( void )
inline

◆ copyDataChunksToContiguous()

bool grk::t1::CodeblockDecompressImpl::copyDataChunksToContiguous ( uint8_t * buffer) const
inline

Copies all segment data chunk buffers for all uncompressed segments whose data has been parsed, into a single contiguous buffer.

Parameters
buffercontiguous buffer
Returns
true if successful

References segs_.

Referenced by grk::t1::CodeblockDecompress::copyDataChunksToContiguous().

◆ currDataParsedSegment()

std::vector< Segment * >::iterator grk::t1::CodeblockDecompressImpl::currDataParsedSegment ( void )
inline

Gets iterator pointing to current segment whose layer data is being parsed.

Returns
std::vector<Segment>::iterator

References numDataParsedSegments_, and segs_.

Referenced by nextDataParsedSegment(), and parsePacketData().

◆ currHeaderParsedSegment()

std::vector< Segment * >::iterator grk::t1::CodeblockDecompressImpl::currHeaderParsedSegment ( void )
inline

Gets iterator pointing to current segment being populated by packet header.

Returns
std::vector<Segment>::iterator

References segs_.

Referenced by readPacketHeader().

◆ dataChunksEmpty()

bool grk::t1::CodeblockDecompressImpl::dataChunksEmpty ( )
inline

Checks whether all segments' data chunks are empty.

Returns
true if there aren't any data chunks in any segment

References segs_.

Referenced by canDecompress(), and grk::t1::CodeblockDecompress::dataChunksEmpty().

◆ decompress()

template<typename T>
bool grk::t1::CodeblockDecompressImpl::decompress ( T * coder,
uint8_t orientation,
uint32_t cblksty )
inline

Decompresses all layers specified so far.

Template Parameters
Ttype of coder
Parameters
coderpointer to block decoder
compressed_data,pointerto compressed data
orientationcode block band's orientation
cblkstycode block style
Returns
true if successful

References bitPlanesToDecompress_, buffer_lengths_, buffers_, canDecompress(), dataParsedLayers_, GRK_CBLKSTY_LAZY, grk::grklog, grk::maxBitPlanesJ2K, needsSegInit_, needsSegUpdate_, nextToBeDecompressedSegment(), num_buffers_, grk::t1::CodeblockImpl::numbps_, numDataParsedSegments_, grk::t1::CodeblockImpl::numLayers_, passno_, passtype_, prepareBufferList(), segs_, T1_TYPE_MQ, T1_TYPE_RAW, toBeDecompressedBegin(), and toBeDecompressedEnd().

Referenced by grk::t1::CodeblockDecompress::decompress().

◆ getDataChunksLength()

size_t grk::t1::CodeblockDecompressImpl::getDataChunksLength ( ) const
inline

Gets combined length of all data chunks across all uncompressed segments whose datg has been parsed.

Returns
total length

References segs_.

Referenced by grk::t1::CodeblockDecompress::getDataChunksLength().

◆ getNumDataParsedSegments()

uint16_t grk::t1::CodeblockDecompressImpl::getNumDataParsedSegments ( void )
inline

Gets number of segments whose layer data has been parsed.

Returns
number of segments

References numDataParsedSegments_.

Referenced by grk::t1::CodeblockDecompress::getNumDataParsedSegments().

◆ getSegment()

Segment * grk::t1::CodeblockDecompressImpl::getSegment ( uint16_t index)
inline

Gets segment for the specified index If index equals number of segments, then a new segment will be added.

Parameters
pointerto Segment

References grk::t1::CodeblockImpl::numLayers_, and segs_.

Referenced by grk::t1::CodeblockDecompress::getSegment().

◆ init()

void grk::t1::CodeblockDecompressImpl::init ( )
inline

Initializes the code block.

References grk::t1::CodeblockImpl::init().

Referenced by grk::t1::CodeblockDecompress::init().

◆ newSegment()

void grk::t1::CodeblockDecompressImpl::newSegment ( uint8_t cblk_sty)
inlineprivate

Creates a new Segment.

Parameters
cblk_stycode block stule

References GRK_CBLKSTY_LAZY, GRK_CBLKSTY_TERMALL, grk::maxPassesPerSegmentJ2K, grk::t1::CodeblockImpl::numLayers_, and segs_.

Referenced by readPacketHeader().

◆ nextDataParsedSegment()

std::vector< Segment * >::iterator grk::t1::CodeblockDecompressImpl::nextDataParsedSegment ( void )
inline

Increments to next segment whose data is going to be parsed.

Returns
std::vector<Segment>::iterator

References currDataParsedSegment(), and numDataParsedSegments_.

Referenced by parsePacketData().

◆ nextToBeDecompressedSegment()

void grk::t1::CodeblockDecompressImpl::nextToBeDecompressedSegment ( std::vector< Segment * >::iterator & s)
inline

Increments iterator for next segment to be decompressed.

Parameters
segIterreference to std::vector<Segment>::iterator

References compressDataOffset_, needsSegInit_, numDecompressedSegments_, and passno_.

Referenced by decompress().

◆ parsePacketData()

void grk::t1::CodeblockDecompressImpl::parsePacketData ( uint16_t layno,
size_t & remainingTilePartBytes,
bool isHT,
uint8_t * layerData,
uint32_t & layerDataOffset )
inline

Parses packet data based on packet header.

No data is actually ready, rather the information read from packet header is used to take segment offsets and lengths store them in data chunk array for that segment.

As segments can span layers, there may be multiple chunks for different layers.

As layers can span segments, there may be multiple segments for a given layer

Parameters
laynolayer number for this packet
remainingTilePartBytesremaining tile part bytes (passed by reference)
isHTtrue if this is a HTJ2K code block
layerDatapointer to packet's layer data (this is always contiguous)
layerDataOffsetreference to layer data offset

References currDataParsedSegment(), dataParsedLayers_, grk::grklog, nextDataParsedSegment(), release(), segs_, and grk::t1::CodeblockImpl::signalledPassesByLayer_.

Referenced by grk::t1::CodeblockDecompress::parsePacketData().

◆ prepareBufferList()

void grk::t1::CodeblockDecompressImpl::prepareBufferList ( std::vector< Segment * >::iterator seg)
inline

References buffer_lengths_, buffers_, and num_buffers_.

Referenced by decompress().

◆ readPacketHeader()

void grk::t1::CodeblockDecompressImpl::readPacketHeader ( std::shared_ptr< t1_t2::BitIO > bio,
uint32_t & signalledLayerDataBytes,
uint16_t layno,
uint8_t cblk_sty )
inline

Reads packet header.

Parameters
bioshared pointer for BitIO
signalledDataBytesreference to variable holding number of signalled data bytes
laynolayer number
cblk_stycode block style

References currHeaderParsedSegment(), grk::floorlog2(), grk::grklog, grk::maxPassesPerSegmentJ2K, newSegment(), grk::t1::CodeblockImpl::numlenbits(), segs_, grk::t1::CodeblockImpl::setNumLenBits(), and grk::t1::CodeblockImpl::signalledPassesByLayer_.

Referenced by grk::t1::CodeblockDecompress::readPacketHeader().

◆ release()

void grk::t1::CodeblockDecompressImpl::release ( )
inlineprivate

Releases resources.

References numDataParsedSegments_, numDecompressedSegments_, and segs_.

Referenced by parsePacketData(), and ~CodeblockDecompressImpl().

◆ setNumBps()

void grk::t1::CodeblockDecompressImpl::setNumBps ( uint8_t bps)
inline

Sets number of bit planes to be decompressed.

Parameters
bpsnumber of bit planes

References bitPlanesToDecompress_, and grk::t1::CodeblockImpl::numbps_.

Referenced by grk::t1::CodeblockDecompress::setNumBps().

◆ toBeDecompressedBegin()

std::vector< Segment * >::iterator grk::t1::CodeblockDecompressImpl::toBeDecompressedBegin ( )
inline

Iterator pointing to the beginning of the segments yet to be decompressed.

Returns
std::vector<Segment>::iterator

References numDecompressedSegments_, and segs_.

Referenced by decompress().

◆ toBeDecompressedEnd()

std::vector< Segment * >::iterator grk::t1::CodeblockDecompressImpl::toBeDecompressedEnd ( )
inline

Iterator pointing one location past the last Segment whose data has been parsed.

Returns
std::vector<Segment>::iterator

References numDataParsedSegments_, and segs_.

Referenced by decompress().

Member Data Documentation

◆ bitPlanesToDecompress_

uint8_t grk::t1::CodeblockDecompressImpl::bitPlanesToDecompress_
private

Remaining bit planes to decompress.

Referenced by canDecompress(), CodeblockDecompressImpl(), decompress(), and setNumBps().

◆ buffer_lengths_

uint32_t* grk::t1::CodeblockDecompressImpl::buffer_lengths_
private

◆ buffers_

uint8_t** grk::t1::CodeblockDecompressImpl::buffers_
private

Array of pointers to buffers.

Referenced by CodeblockDecompressImpl(), decompress(), prepareBufferList(), and ~CodeblockDecompressImpl().

◆ compressDataOffset_

uint32_t grk::t1::CodeblockDecompressImpl::compressDataOffset_
private

offset into contiguous buffer of compressed data

Referenced by CodeblockDecompressImpl(), and nextToBeDecompressedSegment().

◆ dataParsedLayers_

uint16_t grk::t1::CodeblockDecompressImpl::dataParsedLayers_
private

number of layers whose data has been parsed

Referenced by CodeblockDecompressImpl(), decompress(), and parsePacketData().

◆ needsSegInit_

bool grk::t1::CodeblockDecompressImpl::needsSegInit_
private

decompression: segment needs initialization

Referenced by CodeblockDecompressImpl(), decompress(), and nextToBeDecompressedSegment().

◆ needsSegUpdate_

bool grk::t1::CodeblockDecompressImpl::needsSegUpdate_
private

decompression: segment needs update, as more packets have been parsed

Referenced by CodeblockDecompressImpl(), and decompress().

◆ num_buffers_

uint16_t grk::t1::CodeblockDecompressImpl::num_buffers_
private

Number of buffers.

Referenced by CodeblockDecompressImpl(), decompress(), and prepareBufferList().

◆ numDataParsedSegments_

uint8_t grk::t1::CodeblockDecompressImpl::numDataParsedSegments_
private

Number of segments whose data has been read from their respective layers.

Layers whose data has been read always form a contiguous set - there are never any layers whose data is skipped in the middle

Referenced by canDecompress(), CodeblockDecompressImpl(), currDataParsedSegment(), decompress(), getNumDataParsedSegments(), nextDataParsedSegment(), release(), and toBeDecompressedEnd().

◆ numDecompressedSegments_

uint8_t grk::t1::CodeblockDecompressImpl::numDecompressedSegments_
private

◆ passno_

uint8_t grk::t1::CodeblockDecompressImpl::passno_
private

decompression: current pass number

Referenced by CodeblockDecompressImpl(), decompress(), and nextToBeDecompressedSegment().

◆ passtype_

uint8_t grk::t1::CodeblockDecompressImpl::passtype_
private

Type of pass: cleanup, magnitude refinement or significance propagation.

Referenced by CodeblockDecompressImpl(), and decompress().

◆ segs_


The documentation for this struct was generated from the following file: