|
Grok 20.3.2
|
#include <CodeStreamCompress.h>
Public Member Functions | |
| CodeStreamCompress (IStream *stream) | |
| virtual | ~CodeStreamCompress ()=default |
| bool | start (void) override |
| bool | init (grk_cparameters *param, GrkImage *image) override |
| uint64_t | compress (grk_plugin_tile *tile) override |
| Public Member Functions inherited from grk::CodeStream | |
| CodeStream (IStream *stream) | |
| virtual | ~CodeStream () |
| IStream * | getStream () |
| GrkImage * | getHeaderImage (void) |
| grk_plugin_tile * | getCurrentPluginTile () |
| CodingParams * | getCodingParams (void) |
| virtual grk_io_band_callback | getBandCallback () const |
| virtual void * | getBandUserData () const |
| Public Member Functions inherited from grk::ICompressor | |
| virtual | ~ICompressor ()=default |
| virtual uint64_t | compressFrame (GrkImage *image, grk_plugin_tile *tile) |
| virtual bool | finalize (void) |
Static Public Member Functions | |
| static char * | convertProgressionOrder (GRK_PROG_ORDER prg_order) |
| static uint16_t | getPocSize (uint16_t num_components, uint32_t l_nb_poc) |
Private Member Functions | |
| bool | init_header_writing (void) |
| bool | end (void) |
| bool | writeTilePart (ITileProcessorCompress *tileProcessor) |
| bool | writeTileParts (ITileProcessorCompress *tileProcessor) |
| bool | updateRates (void) |
| bool | compressValidation (void) |
| bool | mct_validation (void) |
| bool | write_soc () |
| Writes the SOC marker (Start Of Codestream). | |
| bool | write_siz () |
| Writes the SIZ marker (image and tile size). | |
| bool | write_cap () |
| Writes the CAP marker. | |
| bool | write_com () |
| Writes the COM marker (comment). | |
| bool | write_cod () |
| Writes the COD marker (Coding style default). | |
| bool | compare_coc (uint16_t first_comp_no, uint16_t second_comp_no) |
| Compares 2 COC markers (Coding style component). | |
| bool | write_coc (uint16_t comp_no, IStream *stream) |
| Writes the COC marker (Coding style component). | |
| bool | write_coc (uint16_t comp_no) |
| bool | write_qcd () |
| Writes the QCD marker (quantization default). | |
| bool | compare_qcc (uint16_t first_comp_no, uint16_t second_comp_no) |
| Compare QCC markers (quantization component). | |
| bool | write_qcc (uint16_t tile_index, uint16_t comp_no, IStream *stream) |
| Writes the QCC marker (quantization component). | |
| bool | write_qcc (uint16_t comp_no) |
| bool | writePoc () |
| Writes the POC marker (Progression Order Change). | |
| bool | write_tlm_end () |
| End writing the updated tlm. | |
| bool | write_tlm_begin () |
| Begin writing the TLM marker (Tile Length Marker). | |
| bool | compare_SPCod_SPCoc (uint16_t first_comp_no, uint16_t second_comp_no) |
| Compare 2 a SPCod/ SPCoc elements, i.e. | |
| bool | write_SPCod_SPCoc (uint16_t comp_no) |
| Writes a SPCod or SPCoc element, i.e. | |
| uint32_t | get_SPCod_SPCoc_size (uint16_t comp_no) |
| Gets the size taken by writing a SPCod or SPCoc for the given tile and component. | |
| uint32_t | get_SQcd_SQcc_size (uint16_t comp_no) |
| Gets the size taken by writing SQcd or SQcc element, i.e. | |
| bool | compare_SQcd_SQcc (uint16_t first_comp_no, uint16_t second_comp_no) |
| Compares 2 SQcd or SQcc element, i.e. | |
| bool | write_SQcd_SQcc (uint16_t comp_no) |
| Writes a SQcd or SQcc element, i.e. | |
| bool | write_mct_record (grk_mct_data *p_mct_record, IStream *stream) |
| Writes the MCT marker (Multiple Component Transform). | |
| bool | write_mcc_record (grk_simple_mcc_decorrelation_data *p_mcc_record, IStream *stream) |
| Writes the MCC marker (Multiple Component Collection). | |
| bool | write_mco () |
| Writes the MCO marker (Multiple component transformation ordering). | |
| bool | write_cbd () |
| Writes the CBD marker (Component bit depth definition). | |
| bool | write_all_coc () |
| Writes COC marker for each component. | |
| bool | write_all_qcc () |
| Writes QCC marker for each component. | |
| bool | write_regions () |
| Writes regions of interests. | |
| bool | write_rgn (uint16_t tile_no, uint16_t comp_no, uint16_t nb_comps) |
| Writes the RGN marker (Region Of Interest). | |
| bool | write_eoc () |
| Writes the EOC marker (End of Codestream). | |
| bool | write_mct_data_group () |
| Writes the CBD-MCT-MCC-MCO markers (Multi components transform). | |
| bool | getNumTileParts (uint32_t *p_nb_tile_parts, GrkImage *image) |
| Calculates the total number of tile parts needed by the compressor to compress such an image. | |
| uint8_t | getNumTilePartsForProgression (uint32_t prog_iter_num, uint16_t tileno) |
| Gets the number of tile parts used for the given change of progression (if any) and the given tile. | |
| bool | validateProgressionOrders (const grk_progression *progressions, uint32_t numProgressions, uint8_t numresolutions, uint16_t numcomps, uint16_t numlayers) |
| Validate progression orders. | |
| bool | init_mct_encoding (TileCodingParams *tcp, GrkImage *image) |
Private Attributes | |
| uint32_t | totalTileParts_ |
Additional Inherited Members | |
| Protected Member Functions inherited from grk::CodeStream | |
| bool | exec (std::vector< PROCEDURE_FUNC > &procedureList) |
| Protected Attributes inherited from grk::CodeStream | |
| CodingParams | cp_ |
| std::vector< PROCEDURE_FUNC > | procedureList_ |
| std::vector< PROCEDURE_FUNC > | validationList_ |
| GrkImage * | headerImage_ |
| IStream * | stream_ |
| std::unordered_map< uint32_t, ITileProcessor * > | processors_ |
| grk_plugin_tile * | current_plugin_tile |
|
explicit |
References grk::CodeStream::CodeStream(), and totalTileParts_.
|
virtualdefault |
|
private |
Compares 2 COC markers (Coding style component).
| first_comp_no | the index of the first component to compare. |
| second_comp_no | the index of the second component to compare. |
References compare_SPCod_SPCoc(), and grk::CodeStream::cp_.
Referenced by write_all_coc().
|
private |
Compare QCC markers (quantization component).
| first_comp_no | the index of the first component to compare. |
| second_comp_no | the index of the second component to compare. |
References compare_SQcd_SQcc().
Referenced by write_all_qcc().
|
private |
Compare 2 a SPCod/ SPCoc elements, i.e.
the coding style of a given component of a tile.
| first_comp_no | The 1st component number to compare. |
| second_comp_no | The 1st component number to compare. |
References grk::CCP_CSTY_PRECINCT, and grk::CodeStream::cp_.
Referenced by compare_coc().
|
private |
Compares 2 SQcd or SQcc element, i.e.
the quantization values of a band in the QCD or QCC.
| first_comp_no | the first component number to compare. |
| second_comp_no | the second component number to compare. |
References grk::CCP_QNTSTY_NOQNT, grk::CCP_QNTSTY_SIQNT, and grk::CodeStream::cp_.
Referenced by compare_qcc().
|
overridevirtual |
Implements grk::ICompressor.
References grk::CodeStream::cp_, end(), TFSingleton::get(), grk::grklog, grk::maxNumTilesJ2K, grk::CodeStream::stream_, and writeTileParts().
|
private |
References grk::CodeStream::cp_, GRK_MAXRLVLS, and grk::grklog.
Referenced by start().
|
static |
References grk::prog_order::enum_prog, grk::prog_order_list, and grk::prog_order::str_prog.
Referenced by grk::PacketIter::enable_tile_part_generation(), and getNumTilePartsForProgression().
|
private |
References grk::CodeStream::cp_, grk::CodeStream::exec(), grk::CodeStream::procedureList_, write_eoc(), and write_tlm_end().
Referenced by compress().
|
private |
Gets the size taken by writing a SPCod or SPCoc for the given tile and component.
| comp_no | the component being outputted. |
References grk::CCP_CSTY_PRECINCT, grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), and grk::SPCodSPCocLen.
Referenced by write_coc(), and write_cod().
|
private |
Gets the size taken by writing SQcd or SQcc element, i.e.
the quantization values of a band in the QCD or QCC.
| comp_no | the component being output. |
References grk::CCP_QNTSTY_NOQNT, grk::CCP_QNTSTY_SIQNT, grk::CodeStream::cp_, and grk::CodeStream::getHeaderImage().
Referenced by write_qcc(), and write_qcd().
|
private |
Calculates the total number of tile parts needed by the compressor to compress such an image.
If not enough memory is available, then the function return false.
| p_nb_tile_parts | total number of tile parts in whole image. |
| image | image to compress. |
References grk::CodeStream::cp_, getNumTilePartsForProgression(), grk::grklog, grk::maxTilePartsPerTileJ2K, grk::maxTotalTilePartsJ2K, and grk::PacketManager::updateCompressParams().
Referenced by init_header_writing().
|
private |
Gets the number of tile parts used for the given change of progression (if any) and the given tile.
| prog_iter_num | the offset of the given poc (i.e. its position in the coding parameter). |
| tileno | the given tile. |
References convertProgressionOrder(), grk::CodeStream::cp_, and grk::maxTilePartsPerTileJ2K.
Referenced by getNumTileParts(), and writeTileParts().
|
static |
|
overridevirtual |
Implements grk::ICompressor.
References grk::GrkImage::applyICC(), grk::Mct::calculate_norms(), grk::CCP_CSTY_PRECINCT, grk::CCP_QNTSTY_NOQNT, grk::CCP_QNTSTY_SEQNT, grk::ceildiv(), grk::GrkImage::copyHeaderTo(), grk::CodeStream::cp_, grk::CP_CSTY_PRT, grk::floorlog2(), GRK_CBLKSTY_HT_ONLY, GRK_CLRSPC_EYCC, GRK_CLRSPC_SYCC, GRK_EXTENSION_MCT, GRK_EXTENSION_NONE, grk::grk_free(), GRK_IS_BROADCAST, GRK_IS_CINEMA, GRK_IS_IMF, GRK_IS_PART2, GRK_IS_STORAGE, GRK_JPH_RSIZ_FLAG, grk::grk_malloc(), GRK_MAX_COMMENT_LENGTH, GRK_MAXRLVLS, GRK_PROFILE_CINEMA_S2K, GRK_PROFILE_CINEMA_S4K, GRK_PROFILE_NONE, GRK_PROFILE_PART2, grk_version(), grk::grklog, grk::CodeStream::headerImage_, init_mct_encoding(), grk::Profile::isBroadcastCompliant(), grk::Profile::isCinemaCompliant(), grk::Profile::isImfCompliant(), grk::maxNumComponentsJ2K, grk::maxNumTilesJ2K, grk::Profile::setBroadcastParams(), grk::Profile::setCinemaParams(), grk::Profile::setImfParams(), and validateProgressionOrders().
|
private |
References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), getNumTileParts(), GRK_EXTENSION_MCT, GRK_PROFILE_PART2, grk::CodeStream::procedureList_, totalTileParts_, updateRates(), write_all_coc(), write_all_qcc(), write_cap(), write_cod(), write_com(), write_mct_data_group(), write_qcd(), write_regions(), write_siz(), write_soc(), write_tlm_begin(), and writePoc().
Referenced by start().
|
private |
References grk::grk_mct_data::array_type_, grk::grk_mct_data::data_, grk::grk_mct_data::data_size_, grk::TileComponentCodingParams::dcLevelShift_, grk::grk_simple_mcc_decorrelation_data::decorrelation_array_, grk::default_number_mct_records, grk::grk_mct_data::element_type_, grk::grk_free(), grk::grk_malloc(), grk::grk_realloc(), grk::grk_mct_data::index_, grk::grk_simple_mcc_decorrelation_data::index_, grk::grk_simple_mcc_decorrelation_data::is_irreversible_, grk::TileCodingParams::mccRecords_, grk::TileCodingParams::mct_, grk::MCT_ELEMENT_SIZE, grk::MCT_TYPE_DECORRELATION, grk::MCT_TYPE_FLOAT, grk::MCT_TYPE_OFFSET, grk::mct_write_functions_from_float, grk::TileCodingParams::mctDecodingMatrix_, grk::TileCodingParams::mctRecords_, grk::grk_simple_mcc_decorrelation_data::nb_comps_, grk::TileCodingParams::numMaxMccRecords_, grk::TileCodingParams::numMaxMctRecords_, grk::TileCodingParams::numMccRecords_, grk::TileCodingParams::numMctRecords_, grk::grk_simple_mcc_decorrelation_data::offset_array_, and grk::TileCodingParams::tccps_.
Referenced by init().
|
private |
References grk::CodeStream::cp_, grk::grklog, and grk::CodeStream::headerImage_.
Referenced by start().
|
overridevirtual |
|
private |
References grk::CodeStream::cp_, grk::CodeStream::headerImage_, and grk::CodeStream::stream_.
Referenced by init_header_writing().
|
private |
Validate progression orders.
| progressions | progression orders. |
| numProgressions | number of progression orders. |
| numresolutions | number of resolutions. |
| numcomps | number of components |
| numlayers | number of layers. |
References grk::grklog.
Referenced by init().
|
private |
Writes COC marker for each component.
References compare_coc(), grk::CodeStream::getHeaderImage(), and write_coc().
Referenced by init_header_writing().
|
private |
Writes QCC marker for each component.
References compare_qcc(), grk::CodeStream::getHeaderImage(), and write_qcc().
Referenced by init_header_writing().
|
private |
Writes the CAP marker.
References grk::CodeStream::cp_, and grk::CodeStream::stream_.
Referenced by init_header_writing().
|
private |
Writes the CBD marker (Component bit depth definition).
References grk::CBD, grk::CodeStream::getHeaderImage(), and grk::CodeStream::stream_.
Referenced by write_mct_data_group().
|
private |
|
private |
Writes the COC marker (Coding style component).
| comp_no | the index of the component to output. |
| stream | buffered stream. |
Referenced by write_all_coc().
|
private |
Writes the COD marker (Coding style default).
References grk::COD, grk::CodeStream::cp_, get_SPCod_SPCoc_size(), grk::grklog, grk::CodeStream::stream_, and write_SPCod_SPCoc().
Referenced by init_header_writing().
|
private |
Writes the COM marker (comment).
References grk::COM, grk::CodeStream::cp_, GRK_MAX_COMMENT_LENGTH, grk::grklog, and grk::CodeStream::stream_.
Referenced by init_header_writing().
|
private |
Writes the EOC marker (End of Codestream).
References grk::EOC, and grk::CodeStream::stream_.
Referenced by end().
|
private |
Writes the MCC marker (Multiple Component Collection).
| p_mcc_record | MCC record |
| stream | buffered stream. |
References grk::grk_simple_mcc_decorrelation_data::decorrelation_array_, grk::grk_mct_data::index_, grk::grk_simple_mcc_decorrelation_data::index_, grk::grk_simple_mcc_decorrelation_data::is_irreversible_, grk::MCC, grk::grk_simple_mcc_decorrelation_data::nb_comps_, grk::grk_simple_mcc_decorrelation_data::offset_array_, grk::t1_t2::IStreamWriter::write(), grk::IStream::write24u(), and grk::t1_t2::IStreamWriter::write8u().
Referenced by write_mct_data_group().
|
private |
Writes the MCO marker (Multiple component transformation ordering).
References grk::CodeStream::cp_, grk::MCO, and grk::CodeStream::stream_.
Referenced by write_mct_data_group().
|
private |
Writes the CBD-MCT-MCC-MCO markers (Multi components transform).
References grk::CodeStream::cp_, grk::CodeStream::stream_, write_cbd(), write_mcc_record(), write_mco(), and write_mct_record().
Referenced by init_header_writing().
|
private |
Writes the MCT marker (Multiple Component Transform).
| p_mct_record | MCT record |
| stream | buffered stream. |
References grk::grk_mct_data::array_type_, grk::grk_mct_data::data_, grk::grk_mct_data::data_size_, grk::grk_mct_data::element_type_, grk::grk_mct_data::index_, grk::MCT, grk::t1_t2::IStreamWriter::write(), and grk::IStream::writeBytes().
Referenced by write_mct_data_group().
|
private |
|
private |
Writes the QCC marker (quantization component).
| tile_index | current tile index |
| comp_no | the index of the component to output. |
| stream | buffered stream. |
Referenced by write_all_qcc().
|
private |
Writes the QCD marker (quantization default).
References get_SQcd_SQcc_size(), grk::grklog, grk::QCD, grk::CodeStream::stream_, and write_SQcd_SQcc().
Referenced by init_header_writing().
|
private |
Writes regions of interests.
References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), and write_rgn().
Referenced by init_header_writing().
|
private |
Writes the RGN marker (Region Of Interest).
| tile_no | the tile to output |
| comp_no | the component to output |
| nb_comps | the number of components |
References grk::CodeStream::cp_, grk::RGN, and grk::CodeStream::stream_.
Referenced by write_regions().
|
private |
Writes the SIZ marker (image and tile size).
References grk::CodeStream::stream_, and grk::SIZMarker::write().
Referenced by init_header_writing().
|
private |
Writes the SOC marker (Start Of Codestream).
References grk::SOC, and grk::CodeStream::stream_.
Referenced by init_header_writing().
|
private |
Writes a SPCod or SPCoc element, i.e.
the coding style of a given component of a tile.
| comp_no | the component number to output. |
References grk::CCP_CSTY_PRECINCT, grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), and grk::CodeStream::stream_.
Referenced by write_coc(), and write_cod().
|
private |
Writes a SQcd or SQcc element, i.e.
the quantization values of a band in the QCD or QCC.
| comp_no | the component number to output. |
References grk::CCP_QNTSTY_NOQNT, grk::CCP_QNTSTY_SIQNT, grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), and grk::CodeStream::stream_.
Referenced by write_qcc(), and write_qcd().
|
private |
Begin writing the TLM marker (Tile Length Marker).
References grk::CodeStream::cp_, grk::CodeStream::stream_, and totalTileParts_.
Referenced by init_header_writing().
|
private |
|
private |
Writes the POC marker (Progression Order Change).
References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), getPocSize(), grk::POC, and grk::CodeStream::stream_.
Referenced by init_header_writing(), and writeTilePart().
|
private |
References grk::ITileProcessorCompress::canPreCalculateTileLen(), grk::ITileProcessorCompress::canWritePocMarker(), grk::CodeStream::cp_, grk::ITileProcessor::getIndex(), getPocSize(), grk::ITileProcessorCompress::getPreCalculatedTileLen(), grk::grklog, grk::CodeStream::headerImage_, grk::ITileProcessorCompress::incTilePartCounter(), grk::sotMarkerSegmentLen, grk::CodeStream::stream_, grk::SOTMarker::write(), grk::SOTMarker::write_psot(), writePoc(), and grk::ITileProcessorCompress::writeTilePartT2().
Referenced by writeTileParts().
|
private |
References grk::CodeStream::cp_, grk::ITileProcessor::getIndex(), getNumTilePartsForProgression(), grk::ITileProcessorCompress::getTilePartCounter(), grk::grklog, grk::ITileProcessor::incrementIndex(), grk::maxTilePartsPerTileJ2K, grk::ITileProcessorCompress::setFirstPocTilePart(), grk::ITileProcessorCompress::setProgIterNum(), and writeTilePart().
Referenced by compress().
|
private |
Referenced by CodeStreamCompress(), init_header_writing(), and write_tlm_begin().