|
Grok 20.3.2
|
#include <TileProcessorCompress.h>
Public Member Functions | |
| TileProcessorCompress (uint16_t index, TileCodingParams *tcp, CodeStream *codeStream, IStream *stream) | |
| Constructs a TileProcessorCompress. | |
| ~TileProcessorCompress () override | |
| Destroys a TileProcessorCompress. | |
| bool | init (void) override |
| Initializes the TileProcessor. | |
| PacketTracker * | getPacketTracker (void) override |
| Gets the packet tracker. | |
| bool | preCompressTile (size_t thread_id) override |
| Pre-compresses the tile (compression-only preparation). | |
| bool | canWritePocMarker (void) override |
| Checks whether a POC marker can be written for this tile. | |
| bool | writeTilePartT2 (uint32_t *tileBytesWritten) override |
| Writes the T2 part of the current tile part. | |
| bool | doCompress (void) override |
| Performs the full tile compression (T1 + T2 + rate allocation). | |
| bool | ingestUncompressedData (uint8_t *p_src, uint64_t src_length) override |
| Ingests uncompressed image data into the tile. | |
| bool | needsRateControl (void) override |
| Checks whether rate control is required for this tile. | |
| uint32_t | getPreCalculatedTileLen (void) override |
| Gets the pre-calculated tile length (for rate control optimization). | |
| bool | canPreCalculateTileLen (void) override |
| Checks whether the tile length can be pre-calculated. | |
| void | setFirstPocTilePart (bool res) override |
| Sets whether this tile part is the first POC tile part. | |
| void | setProgIterNum (uint32_t num) override |
| Sets the current progression iterator number. | |
| uint8_t | getTilePartCounter (void) const override |
| Gets the current tile-part counter. | |
| void | incTilePartCounter (void) override |
| Increments the tile-part counter. | |
| void | buildCompressDAG (void) |
| tf::Future< void > | submitCompressDAG (void) |
| bool | compressDAGSuccess (void) const |
| Public Member Functions inherited from grk::ITileProcessorCompress | |
| virtual | ~ITileProcessorCompress ()=default |
| Destroys the TileProcessorCompress. | |
| Public Member Functions inherited from grk::ITileProcessor | |
| virtual | ~ITileProcessor ()=default |
| Destroys the TileProcessor. | |
| Public Member Functions inherited from grk::TileProcessor | |
| TileProcessor (uint16_t index, TileCodingParams *tcp, CodeStream *codeStream, IStream *stream, bool isCompressor, uint32_t tileCacheStrategy) | |
| Constructs a TileProcessor. | |
| virtual | ~TileProcessor () override |
| Destroys a TileProcessor. | |
| void | setProcessors (MarkerParser *parser) override |
| Sets the marker parser for processing. | |
| void | setStream (IStream *stream, bool ownsStream) override |
| Sets the stream for input/output operations. | |
| bool | decompressWithTLM (const std::shared_ptr< TPFetchSeq > &tilePartFetchSeq, CoderPool *streamPool, Rect32 unreducedImageBounds, std::function< void()> post, TileFutureManager &futures) override |
| Decompresses the tile using Tile Length Markers (TLM). | |
| bool | decompressPrepareWithTLM (const std::shared_ptr< TPFetchSeq > &tilePartFetchSeq) override |
| Prepares for decompression using Tile Length Markers (TLM). | |
| bool | doPostT1 (void) override |
| Performs post T1 processing. | |
| void | prepareForDecompression (void) override |
| Prepares for decompression. | |
| bool | parseTilePart (std::vector< std::unique_ptr< MarkerParser > > *parsers, IStream *bifurcatedStream, uint16_t mainMarkerId, TilePartInfo tilePartInfo) override |
| Parses tile part. | |
| bool | decompressFromCachedTileParts () override |
| Parse tile-part packets using cached SOT offsets from tilePartSeq_, without re-reading SOT markers. | |
| bool | readSOT (IStream *stream, uint8_t *headerData, uint16_t headerSize, TilePartInfo &tilePartInfo, bool needToReadIndexAndLength) override |
| Reads SOT marker. | |
| void | scheduleAndRunDecompress (CoderPool *coderPool, Rect32 unreducedImageBounds, std::function< void()> post, TileFutureManager &futures) override |
| Schedule T2/T1 decompression. | |
| void | post_decompressT2T1 (GrkImage *scratch) override |
| Performs post T2+T1 processing. | |
| bool | differentialUpdate (Rect32 unreducedImageBounds) override |
| Updates differential decompress state. | |
| GrkImage * | getImage (void) override |
| Gets the tile GrkImage. | |
| void | setImage (GrkImage *img) override |
| Gets the tile GrkImage. | |
| Rect32 | getUnreducedTileWindow (void) override |
| Get the Unreduced Tile Window object. | |
| TileCodingParams * | getTCP (void) override |
| uint8_t | getMaxNumDecompressResolutions (void) override |
| Get the Max Num Decompress Resolutions object. | |
| IStream * | getStream (void) override |
| Get the Stream object. | |
| uint16_t | getIndex (void) const override |
| Get the Index object. | |
| void | incrementIndex (void) override |
| Increments the tile index. | |
| Tile * | getTile (void) override |
| Get the Tile object. | |
| grk_progression_state | getProgressionState () override |
| Gets the progression state. | |
| CodecScheduler * | getScheduler (void) override |
| Get the Scheduler object. | |
| bool | isCompressor (void) override |
| uint64_t | getNumProcessedPackets (void) override |
| Get the Num Processed Packets object. | |
| void | incNumProcessedPackets (void) override |
| Increments the number of processed packets by 1. | |
| void | incNumProcessedPackets (uint64_t numPackets) override |
| void | incNumReadDataPackets (void) override |
| Increments the number of read data packets by 1. | |
| uint32_t | getTileCacheStrategy (void) override |
| Gets the Tile Cache Strategy object. | |
| grk_plugin_tile * | getCurrentPluginTile (void) const override |
| Gets the Current Plugin Tile object. | |
| void | setCurrentPluginTile (grk_plugin_tile *tile) override |
| Set the Current Plugin Tile object. | |
| CodingParams * | getCodingParams (void) override |
| Get the Coding Params object. | |
| GrkImage * | getHeaderImage (void) override |
| Get the Header Image object. | |
| std::shared_ptr< PacketLengthCache< uint32_t > > | getPacketLengthCache (void) override |
| Get the Packet Length Cache object. | |
| bool | needsMctDecompress (uint16_t compno) override |
| bool | needsMctDecompress (void) override |
| bool | shouldDecodeComponent (uint16_t compno) override |
| Check if a component should be decoded based on user selection. | |
| Mct * | getMCT (void) override |
| gets Mct | |
| void | release (void) override |
| Releases resources - image and tile. | |
| void | release (uint32_t strategy) override |
| release select resources | |
| void | releaseForSwath () override |
| Unconditionally releases both image and tile data (swath consumer path). | |
| bool | readPLT (uint8_t *headerData, uint16_t headerSize) override |
| Reads a PLT marker (Packet length, tile-part header). | |
| bool | allSOTMarkersParsed () override |
| Checks if tile is completely parsed. | |
| bool | hasUnparsedTileParts () override |
| True when we know for certain that tile parts are missing. | |
| void | setTruncated (void) override |
| Sets processor to truncated if not all tile parts have been parsed. | |
| bool | hasError (void) override |
| Checks if an error has occurred. | |
| bool | isInitialized (void) override |
| Checks if the processor is initialized. | |
| bool | isBestEffortDecompressed (void) override |
| Check if tile was decompressed on a best-effort basis (may have been truncated or errored). | |
| void | setBestEffortDecompressed (void) override |
| bool | scheduledForDecompression (void) override |
| void | resetSOTParsing () override |
| Reset SOT parsing state so the tile can be re-parsed from the codestream. | |
| bool | reinitForReDecompress (void) override |
| Reinitialize for re-decompression after LRU eviction. | |
| bool | isStripOutputWritten () const override |
| Check if strip-mode output was written directly (bypass multi-tile band callback). | |
Private Member Functions | |
| void | transferTileDataFromImage (void) |
| void | dcLevelShiftCompress () |
| void | scheduleCompressT1 () |
| bool | compressT2 (uint32_t *packet_bytes_written) |
| bool | rateAllocate (uint32_t *allPacketBytes, bool disableRateControl) |
| bool | layerNeedsRateControl (uint16_t layno) |
| bool | makeSingleLosslessLayer () |
| void | makeLayerFinal (uint16_t layno) |
| bool | pcrdBisectSimple (uint32_t *p_data_written, bool disableRateControl) |
| void | makeLayerSimple (uint16_t layno, double thresh, bool finalAttempt) |
| bool | pcrdBisectFeasible (uint32_t *p_data_written, bool disableRateControl) |
| bool | makeLayerFeasible (uint16_t layno, uint16_t thresh, bool finalAttempt) |
| void | syncPluginCodeBlockData () |
| void | prepareBlockForFirstLayer (t1::CodeblockCompress *cblk) |
Private Attributes | |
| uint32_t | preCalculatedTileLen_ = 0 |
| bool | first_poc_tile_part_ = true |
| Compression Only true for first POC tile part, otherwise false. | |
| uint8_t | tilePartCounter_ = 0 |
| index of tile part being currently coded. | |
| uint32_t | prog_iter_num = 0 |
| uint8_t | newTilePartProgressionPosition_ = 0 |
| position of the tile part flag in progression order | |
| PacketTracker * | packetTracker_ = nullptr |
| std::unique_ptr< tf::Taskflow > | compressFlow_ |
| std::unique_ptr< FlowComponent > | mctFlow_ |
| std::vector< std::unique_ptr< FlowComponent > > | dwtFlows_ |
| std::unique_ptr< FlowComponent > | t1Flow_ |
| std::vector< std::unique_ptr< WaveletFwdScheduleData > > | dwtScratch_ |
| std::atomic< bool > | dagSuccess_ {true} |
Additional Inherited Members | |
| Protected Attributes inherited from grk::TileProcessor | |
| GrkImage * | headerImage_ = nullptr |
| header GrkImage | |
| grk_plugin_tile * | current_plugin_tile_ = nullptr |
| grk_plugin_tile | |
| CodingParams * | cp_ = nullptr |
| CodingParams | |
| std::shared_ptr< PacketLengthCache< uint32_t > > | packetLengthCache_ |
| PacketLengthCache | |
| Tile * | tile_ = nullptr |
| Tile | |
| uint16_t | tileIndex_ = 0 |
| index of tile being currently compressed/decompressed | |
| TileCodingParams * | tcp_ = nullptr |
| TileCodingParams | |
| IStream * | stream_ = nullptr |
| IStream | |
| Mct * | mct_ = nullptr |
| MCT | |
| CodecScheduler * | scheduler_ = nullptr |
| CodecScheduler | |
| SchedulerFreebyrd * | schedulerFreebyrd_ = nullptr |
| SchedulerFreebyrd — strip-based decompression via freebyrd pool | |
| grk::TileProcessorCompress::TileProcessorCompress | ( | uint16_t | index, |
| TileCodingParams * | tcp, | ||
| CodeStream * | codeStream, | ||
| IStream * | stream ) |
Constructs a TileProcessorCompress.
| index | tile index |
| codeStream | CodeStream |
| stream | IStream |
References grk::TileProcessor::getCodingParams(), GRK_TILE_CACHE_NONE, newTilePartProgressionPosition_, and grk::TileProcessor::TileProcessor().
|
override |
Destroys a TileProcessorCompress.
References packetTracker_.
| void grk::TileProcessorCompress::buildCompressDAG | ( | void | ) |
References FlowComponent::addTo(), canPreCalculateTileLen(), canWritePocMarker(), compressFlow_, grk::TileProcessor::cp_, dagSuccess_, dcLevelShiftCompress(), dwtFlows_, dwtScratch_, grk::DcShiftParam::enabled, grk::Mct::get_norms_irrev(), grk::Mct::get_norms_rev(), grk::CodeStreamCompress::getPocSize(), grk::grklog, grk::TileProcessor::headerImage_, grk::DcShiftParam::max, grk::TileProcessor::mct_, mctFlow_, grk::DcShiftParam::min, grk::TileProcessor::needsMctDecompress(), needsRateControl(), grk::TileProcessor::packetLengthCache_, packetTracker_, preCalculatedTileLen_, FlowComponent::precede(), rateAllocate(), grk::WaveletFwdImpl::scheduleCompress(), grk::TileProcessor::scheduler_, grk::DcShiftParam::shift, grk::sotMarkerSegmentLen, grk::TileProcessor::stream_, t1Flow_, grk::TileProcessor::tcp_, grk::TileProcessor::tile_, and grk::TileProcessor::tileIndex_.
|
overridevirtual |
Checks whether the tile length can be pre-calculated.
Implements grk::ITileProcessorCompress.
References grk::TileProcessor::cp_, and grk::TileProcessor::tcp_.
Referenced by buildCompressDAG(), and doCompress().
|
overridevirtual |
Checks whether a POC marker can be written for this tile.
Implements grk::ITileProcessorCompress.
References grk::TileProcessor::cp_, GRK_IS_CINEMA, grk::TileProcessor::tcp_, and tilePartCounter_.
Referenced by buildCompressDAG(), and doCompress().
| bool grk::TileProcessorCompress::compressDAGSuccess | ( | void | ) | const |
References dagSuccess_.
|
private |
References first_poc_tile_part_, newTilePartProgressionPosition_, prog_iter_num, grk::TileProcessor::stream_, grk::TileProcessor::tcp_, and grk::TileProcessor::tileIndex_.
Referenced by writeTilePartT2().
|
private |
References grk::TileProcessor::needsMctDecompress(), grk::TileProcessor::tcp_, and grk::TileProcessor::tile_.
Referenced by buildCompressDAG(), and doCompress().
|
overridevirtual |
Performs the full tile compression (T1 + T2 + rate allocation).
Implements grk::ITileProcessorCompress.
References canPreCalculateTileLen(), canWritePocMarker(), grk::TileProcessor::cp_, grk::TileProcessor::current_plugin_tile_, dcLevelShiftCompress(), grk::DcShiftParam::enabled, grk::CodeStreamCompress::getPocSize(), grk_plugin_get_debug_state(), GRK_PLUGIN_STATE_DEBUG, GRK_PLUGIN_STATE_MCT_ONLY, grk::grklog, grk::TileProcessor::headerImage_, grk::DcShiftParam::max, grk::TileProcessor::mct_, grk::DcShiftParam::min, grk::TileProcessor::needsMctDecompress(), grk::TileProcessor::packetLengthCache_, packetTracker_, preCalculatedTileLen_, rateAllocate(), scheduleCompressT1(), grk::DcShiftParam::shift, grk::sotMarkerSegmentLen, grk::TileProcessor::stream_, grk::TileProcessor::tcp_, grk::TileProcessor::tile_, and grk::TileProcessor::tileIndex_.
|
overridevirtual |
Gets the packet tracker.
Implements grk::ITileProcessorCompress.
References packetTracker_.
|
overridevirtual |
Gets the pre-calculated tile length (for rate control optimization).
Implements grk::ITileProcessorCompress.
References preCalculatedTileLen_.
|
overridevirtual |
Gets the current tile-part counter.
Implements grk::ITileProcessorCompress.
References tilePartCounter_.
|
overridevirtual |
Increments the tile-part counter.
Implements grk::ITileProcessorCompress.
References tilePartCounter_.
|
overridevirtual |
Ingests uncompressed image data into the tile.
| p_src | pointer to source uncompressed data |
| src_length | length of the source data in bytes |
Implements grk::ITileProcessorCompress.
References grk::grk_copy_strided(), grk::TileProcessor::headerImage_, and grk::TileProcessor::tile_.
|
overridevirtual |
Initializes the TileProcessor.
Implements grk::ITileProcessor.
References grk::TileProcessor::getTCP(), grk::TileProcessor::headerImage_, grk::TileProcessor::init(), packetTracker_, and grk::TileProcessor::tile_.
Referenced by preCompressTile().
|
private |
References grk::TileProcessor::cp_, and grk::TileProcessor::tcp_.
Referenced by makeSingleLosslessLayer(), needsRateControl(), pcrdBisectFeasible(), and pcrdBisectSimple().
|
private |
References grk::TileProcessor::tile_.
Referenced by pcrdBisectFeasible().
|
private |
References grk::TileProcessor::tile_.
Referenced by makeSingleLosslessLayer(), pcrdBisectFeasible(), and pcrdBisectSimple().
|
private |
References grk::TileProcessor::tile_.
Referenced by pcrdBisectSimple().
|
private |
References layerNeedsRateControl(), makeLayerFinal(), and grk::TileProcessor::tcp_.
Referenced by pcrdBisectFeasible(), and pcrdBisectSimple().
|
overridevirtual |
Checks whether rate control is required for this tile.
Implements grk::ITileProcessorCompress.
References layerNeedsRateControl(), and grk::TileProcessor::tcp_.
Referenced by buildCompressDAG(), pcrdBisectFeasible(), pcrdBisectSimple(), and scheduleCompressT1().
|
private |
References grk::compress_synch_with_plugin(), grk::RateControl::convexHull(), grk::TileProcessor::cp_, grk::executor(), TFSingleton::get(), grk::RateInfo::getMinimumThresh(), grk_plugin_get_debug_state(), GRK_PLUGIN_STATE_PRE_TR1, grk::TileProcessor::headerImage_, layerNeedsRateControl(), makeLayerFeasible(), makeLayerFinal(), makeSingleLosslessLayer(), grk::maxCompressLayersGRK, needsRateControl(), newTilePartProgressionPosition_, TFSingleton::num_threads(), grk::TileProcessor::packetLengthCache_, grk::TileProcessor::scheduler_, grk::RateInfo::synch(), syncPluginCodeBlockData(), grk::TileProcessor::tcp_, grk::TileProcessor::tile_, and grk::TileProcessor::tileIndex_.
Referenced by rateAllocate().
|
private |
References grk::compress_synch_with_plugin(), grk::TileProcessor::cp_, grk::executor(), TFSingleton::get(), grk_plugin_get_debug_state(), GRK_PLUGIN_STATE_PRE_TR1, grk::TileProcessor::headerImage_, layerNeedsRateControl(), makeLayerFinal(), makeLayerSimple(), makeSingleLosslessLayer(), grk::maxCompressLayersGRK, needsRateControl(), newTilePartProgressionPosition_, TFSingleton::num_threads(), grk::TileProcessor::packetLengthCache_, grk::TileProcessor::scheduler_, syncPluginCodeBlockData(), grk::TileProcessor::tcp_, grk::TileProcessor::tile_, and grk::TileProcessor::tileIndex_.
Referenced by rateAllocate().
|
overridevirtual |
Pre-compresses the tile (compression-only preparation).
| thread_id | ID of the thread performing the pre-compression |
Implements grk::ITileProcessorCompress.
References grk::ceildiv(), grk::TileProcessor::cp_, grk::TileProcessor::current_plugin_tile_, first_poc_tile_part_, grk_get_data_type(), GRK_INT_16, grk::grklog, grk::TileProcessor::headerImage_, init(), grk::TileProcessor::needsMctDecompress(), grk::TileProcessor::tcp_, grk::TileProcessor::tile_, and tilePartCounter_.
|
private |
|
private |
References grk::TileProcessor::cp_, pcrdBisectFeasible(), and pcrdBisectSimple().
Referenced by buildCompressDAG(), and doCompress().
|
private |
|
overridevirtual |
Sets whether this tile part is the first POC tile part.
| res | true for first POC tile part, false otherwise |
Implements grk::ITileProcessorCompress.
References first_poc_tile_part_.
|
overridevirtual |
Sets the current progression iterator number.
| num | new progression iterator value |
Implements grk::ITileProcessorCompress.
References prog_iter_num.
| tf::Future< void > grk::TileProcessorCompress::submitCompressDAG | ( | void | ) |
References compressFlow_, and TFSingleton::get().
|
private |
|
private |
|
overridevirtual |
Writes the T2 part of the current tile part.
| tileBytesWritten | [out] number of bytes written for this tile part |
Implements grk::ITileProcessorCompress.
References compressT2(), grk::TileProcessor::packetLengthCache_, grk::SOD, grk::TileProcessor::stream_, and tilePartCounter_.
|
private |
Referenced by buildCompressDAG(), and submitCompressDAG().
|
private |
Referenced by buildCompressDAG(), and compressDAGSuccess().
|
private |
Referenced by buildCompressDAG().
|
private |
Referenced by buildCompressDAG().
|
private |
Compression Only true for first POC tile part, otherwise false.
Referenced by compressT2(), preCompressTile(), and setFirstPocTilePart().
|
private |
Referenced by buildCompressDAG().
|
private |
position of the tile part flag in progression order
Referenced by compressT2(), pcrdBisectFeasible(), pcrdBisectSimple(), and TileProcessorCompress().
|
private |
Referenced by buildCompressDAG(), doCompress(), getPacketTracker(), init(), and ~TileProcessorCompress().
|
private |
Referenced by buildCompressDAG(), doCompress(), and getPreCalculatedTileLen().
|
private |
Referenced by compressT2(), and setProgIterNum().
|
private |
Referenced by buildCompressDAG().
|
private |
index of tile part being currently coded.
tilePartCounter_ holds the total number of tile parts encoded thus far while the compressor is compressing the current tile part.
Referenced by canWritePocMarker(), getTilePartCounter(), incTilePartCounter(), preCompressTile(), and writeTilePartT2().