|
Grok 20.3.2
|
Reads/writes TLM markers. More...
#include <TLMMarker.h>
Public Member Functions | |
| TLMMarker (uint16_t numSignalledTiles) | |
| Constructs a TLMMarker. | |
| TLMMarker (const std::string &filePath, uint16_t numSignalledTiles, uint64_t tileStreamStart) | |
| Constructs a TLMMarker. | |
| TLMMarker (IStream *stream) | |
| Constructs a TLMMarker. | |
| ~TLMMarker ()=default | |
| Destroys a TLMMarker. | |
| bool | read (std::span< uint8_t > headerData, uint16_t headerSize) |
| Reads a TLM marker. | |
| void | rewind () noexcept |
| Rewinds state so that tile part lengths can be read. | |
| uint8_t | getNumTileParts (uint16_t tileIndex) const noexcept |
| Gets the number of tile parts for a given tile index. | |
| TilePartLength< uint32_t > * | next (bool peek) |
| Gets next TilePartLength. | |
| void | invalidate () noexcept |
| Marks the object as invalid, in case of corrupt TLM marker. | |
| bool | valid () const noexcept |
| Checks if the object is valid. | |
| void | seekNextSlated (TileWindow *tilesToDecompress, TileCache *tileCache, IStream *stream) |
| Seeks to next scheduled tile part. | |
| bool | writeBegin (uint32_t numTilePartsTotal) |
| Prepares to write TLM marker to code stream. | |
| void | add (TilePartLength< uint32_t > info) |
| Adds a new tile part(decompression). | |
| void | add (uint16_t tile_index, uint32_t tile_part_size) noexcept |
| Adds a new tile part (compression). | |
| bool | writeEnd () |
| Finishes writing TLM marker. | |
| void | readComplete (uint64_t tileStreamStart) noexcept |
| Completes calculations such as absolute tile part start position for all tile parts in tilePartsPerTile_. | |
| const TPSEQ_VEC & | getTileParts (void) const |
Private Attributes | |
| std::unique_ptr< TLMMarkerManager > | markerManager_ |
| TPSEQ_VEC | tilePartsPerTile_ |
| stores tile part info sequence for each tile Useful if SOT markers don't store number of tile parts per tile | |
| IStream * | stream_ = nullptr |
| IStream | |
| uint64_t | streamStart = 0 |
| cached start of stream before writing TLM markers | |
| bool | valid_ = true |
| true if TLM markers are valid | |
| bool | hasTileIndices_ = false |
| true if TLM markers store tile indices. | |
| uint16_t | tileCount_ = 0 |
| used to track tile index when there are no tile indices stored in markers | |
| uint16_t | numSignalledTiles_ = 0 |
| number of tiles signalled in main header | |
| uint64_t | tilePartStart_ = 0 |
| calculated start position for current tile part parsed from markers | |
| std::string | filePath_ |
Reads/writes TLM markers.
|
explicit |
Constructs a TLMMarker.
| numSignalledTiles | number of tiles signalled in main header |
References markerManager_, numSignalledTiles_, and tilePartsPerTile_.
Referenced by TLMMarker(), and TLMMarker().
| grk::TLMMarker::TLMMarker | ( | const std::string & | filePath, |
| uint16_t | numSignalledTiles, | ||
| uint64_t | tileStreamStart ) |
Constructs a TLMMarker.
| numSignalledTiles | number of tiles signalled in main header |
References add(), filePath_, grk::TLMFile< T >::load(), readComplete(), TLMMarker(), and valid_.
|
explicit |
Constructs a TLMMarker.
| stream | IStream for code stream |
References stream_, and TLMMarker().
|
default |
Destroys a TLMMarker.
References add(), getNumTileParts(), getTileParts(), invalidate(), next(), readComplete(), seekNextSlated(), valid(), writeBegin(), and writeEnd().
| void grk::TLMMarker::add | ( | TilePartLength< uint32_t > | info | ) |
Adds a new tile part(decompression).
| info |
References grk::TilePartLength< T >::length_, markerManager_, grk::TilePartLength< T >::tileIndex_, tilePartsPerTile_, and tilePartStart_.
Referenced by read(), TLMMarker(), and ~TLMMarker().
|
noexcept |
Adds a new tile part (compression).
Marker index is always 0 todo: fix
| tile_index | tile index |
| tile_part_size | size of tile part |
References markerManager_.
|
noexcept |
Gets the number of tile parts for a given tile index.
| tileIndex | Index of the tile |
References tilePartsPerTile_, and valid_.
Referenced by ~TLMMarker().
| const TPSEQ_VEC & grk::TLMMarker::getTileParts | ( | void | ) | const |
References tilePartsPerTile_.
Referenced by ~TLMMarker().
|
noexcept |
Marks the object as invalid, in case of corrupt TLM marker.
References valid_.
Referenced by ~TLMMarker().
| TilePartLength< uint32_t > * grk::TLMMarker::next | ( | bool | peek | ) |
Gets next TilePartLength.
Query next TLM entry.
| peek | - if true then do not advance to next TilePartLength |
| peek | if false, then move to next TLM entry. Otherwise, stay at current TLM entry |
References grk::grklog, markerManager_, numSignalledTiles_, and valid_.
Referenced by seekNextSlated(), and ~TLMMarker().
| bool grk::TLMMarker::read | ( | std::span< uint8_t > | headerData, |
| uint16_t | headerSize ) |
Reads a TLM marker.
Reads and processes TLM marker from code stream.
| headerData | header data |
| headerSize | size of header |
| headerData | Span of header data to read from |
| headerSize | Size of the header data |
References add(), grk::grk_read(), grk::grklog, hasTileIndices_, markerManager_, numSignalledTiles_, tileCount_, grk::tlm_marker_start_bytes, and valid_.
|
noexcept |
Completes calculations such as absolute tile part start position for all tile parts in tilePartsPerTile_.
| tileStreamStart | tile stream start |
References tilePartsPerTile_.
Referenced by TLMMarker(), and ~TLMMarker().
|
noexcept |
Rewinds state so that tile part lengths can be read.
References grk::grklog, markerManager_, tilePartsPerTile_, and valid_.
| void grk::TLMMarker::seekNextSlated | ( | TileWindow * | tilesToDecompress, |
| TileCache * | tileCache, | ||
| IStream * | stream ) |
Seeks to next scheduled tile part.
Seek to next slated tile part.
| tilesToDecompress | tile window |
| stream | IStream |
References grk::TileCache::get(), grk::grklog, grk::TileWindow::isSlated(), next(), grk::IStream::seek(), and grk::IStream::tell().
Referenced by ~TLMMarker().
|
nodiscardnoexcept |
| bool grk::TLMMarker::writeBegin | ( | uint32_t | numTilePartsTotal | ) |
Prepares to write TLM marker to code stream.
| numTilePartsTotal | total number of tile parts in image |
References grk::grklog, grk::MARKER_BYTES, stream_, streamStart, grk::TLM, grk::tlm_marker_start_bytes, and grk::tlmMarkerBytesPerTilePart.
Referenced by ~TLMMarker().
| bool grk::TLMMarker::writeEnd | ( | ) |
Finishes writing TLM marker.
Finalizes writing of TLM marker by updating tile part lengths.
References grk::grklog, markerManager_, stream_, streamStart, and grk::tlm_marker_start_bytes.
Referenced by ~TLMMarker().
|
private |
Referenced by TLMMarker().
|
private |
true if TLM markers store tile indices.
If not, then there must be only one tile part per tile, and the tile parts must be stored in the stream in order of tile index
Referenced by read().
|
private |
Referenced by add(), add(), next(), read(), rewind(), TLMMarker(), and writeEnd().
|
private |
number of tiles signalled in main header
Referenced by next(), read(), and TLMMarker().
|
private |
Referenced by TLMMarker(), writeBegin(), and writeEnd().
|
private |
cached start of stream before writing TLM markers
Referenced by writeBegin(), and writeEnd().
|
private |
used to track tile index when there are no tile indices stored in markers
Referenced by read().
|
private |
stores tile part info sequence for each tile Useful if SOT markers don't store number of tile parts per tile
Referenced by add(), getNumTileParts(), getTileParts(), readComplete(), rewind(), and TLMMarker().
|
private |
calculated start position for current tile part parsed from markers
Referenced by add().
|
private |
true if TLM markers are valid
Referenced by getNumTileParts(), invalidate(), next(), read(), rewind(), TLMMarker(), and valid().