grk::CodeStreamCompress Class Reference

`#include <CodeStreamCompress.h>`

Inheritance diagram for grk::CodeStreamCompress:

## Public Member Functions

| CodeStreamCompress (BufferedStream *stream)
virtual | ~CodeStreamCompress ()
bool | start (void)
bool | init (grk_cparameters *p_param, GrkImage *p_image)
bool | compress (grk_plugin_tile *tile)
Public Member Functions inherited from grk::CodeStream
| CodeStream (BufferedStream *stream)
virtual | ~CodeStream ()
TileProcessor * | currentProcessor (void)
BufferedStream * | getStream ()
GrkImage * | getHeaderImage (void)
grk_plugin_tile * | getCurrentPluginTile ()
CodingParams * | getCodingParams (void)
Public Member Functions inherited from grk::ICodeStreamCompress
virtual | ~ICodeStreamCompress ()=default

## Static Public Member Functions

static char * | convertProgressionOrder (GRK_PROG_ORDER prg_order)
static uint16_t | getPocSize (uint32_t numComponents, uint32_t l_nb_poc)
Static Public Member Functions inherited from grk::CodeStream
static std::string | markerString (uint16_t marker)

## Private Member Functions

bool | init_header_writing (void)
bool | cacheEndOfHeader (void)
bool | end (void)
bool | writeTilePart (TileProcessor *tileProcessor)
bool | writeTileParts (TileProcessor *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 (uint32_t first_comp_no, uint32_t second_comp_no)
| Compares 2 COC markers (Coding style component)
bool | write_coc (uint32_t comp_no, BufferedStream *stream)
| Writes the COC marker (Coding style component)
bool | write_coc (uint32_t comp_no)
bool | write_qcd ()
| Writes the QCD marker (quantization default)
bool | compare_qcc (uint32_t first_comp_no, uint32_t second_comp_no)
| Compare QCC markers (quantization component)
bool | write_qcc (uint16_t tileIndex, uint32_t comp_no, BufferedStream *stream)
| Writes the QCC marker (quantization component)
bool | write_qcc (uint32_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 (uint32_t first_comp_no, uint32_t second_comp_no)
| Compare 2 a SPCod/ SPCoc elements, i.e.
bool | write_SPCod_SPCoc (uint32_t comp_no)
| Writes a SPCod or SPCoc element, i.e.
uint32_t | get_SPCod_SPCoc_size (uint32_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 (uint32_t comp_no)
| Gets the size taken by writing SQcd or SQcc element, i.e.
bool | compare_SQcd_SQcc (uint32_t first_comp_no, uint32_t second_comp_no)
| Compares 2 SQcd or SQcc element, i.e.
bool | write_SQcd_SQcc (uint32_t comp_no)
| Writes a SQcd or SQcc element, i.e.
bool | write_mct_record (grk_mct_data *p_mct_record, BufferedStream *stream)
| Writes the MCT marker (Multiple Component Transform)
bool | write_mcc_record (grk_simple_mcc_decorrelation_data *p_mcc_record, BufferedStream *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, uint32_t comp_no, uint32_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 (uint16_t *p_nb_tile_parts, GrkImage *image)
| Calculates the total number of tile parts needed by the compressor to compress such an image.
uint64_t | getNumTilePartsForProgression (uint32_t pino, 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 *p_tcp, GrkImage *p_image)

## Private Attributes

CompressorState | compressorState_

## Additional Inherited Members

Protected Member Functions inherited from grk::CodeStream
bool | exec (std::vector< PROCEDURE_FUNC > &p_procedure_list)
Protected Attributes inherited from grk::CodeStream
CodingParams | cp_
CodeStreamInfo * | codeStreamInfo
std::vector< PROCEDURE_FUNC > | procedure_list_
std::vector< PROCEDURE_FUNC > | validation_list_
GrkImage * | headerImage_
TileProcessor * | currentTileProcessor_
BufferedStream * | stream_
std::map< uint32_t, TileProcessor * > | processors_
grk_plugin_tile * | current_plugin_tile

## Constructor & Destructor Documentation

## CodeStreamCompress()

grk::CodeStreamCompress::CodeStreamCompress | ( | BufferedStream * | stream | ) |

References grk::CodeStream::cp_, and grk::CodingParams::wholeTileDecompress_.

## ~CodeStreamCompress()

grk::CodeStreamCompress::~CodeStreamCompress | ( |  | ) |

virtual

## Member Function Documentation

## cacheEndOfHeader()

bool grk::CodeStreamCompress::cacheEndOfHeader | ( | void |  | ) |

private

References grk::CodeStream::codeStreamInfo, grk::CodeStreamInfo::setMainHeaderEnd(), grk::CodeStream::stream_, and grk::BufferedStream::tell().

Referenced by init_header_writing().

## compare_coc()

bool grk::CodeStreamCompress::compare_coc | ( | uint32_t | first_comp_no,
|  | uint32_t | second_comp_no
| ) |  |

private

Compares 2 COC markers (Coding style component)

Parameters

  first_comp_no | the index of the first component to compare.
  second_comp_no | the index of the second component to compare.

Returns
  true if equals

References compare_SPCod_SPCoc(), grk::CodeStream::cp_, grk::grk_read(), and grk::CodingParams::tcps.

Referenced by write_all_coc().

## compare_qcc()

bool grk::CodeStreamCompress::compare_qcc | ( | uint32_t | first_comp_no,
|  | uint32_t | second_comp_no
| ) |  |

private

Compare QCC markers (quantization component)

Parameters

  first_comp_no | the index of the first component to compare.
  second_comp_no | the index of the second component to compare.

Returns
  true if equals.

References compare_SQcd_SQcc(), and grk::grk_read().

Referenced by write_all_qcc().

## compare_SPCod_SPCoc()

bool grk::CodeStreamCompress::compare_SPCod_SPCoc | ( | uint32_t | first_comp_no,
|  | uint32_t | second_comp_no
| ) |  |

private

Compare 2 a SPCod/ SPCoc elements, i.e.

the coding style of a given component of a tile.

Parameters

  first_comp_no | The 1st component number to compare.
  second_comp_no | The 1st component number to compare.

Returns
  true if SPCdod are equals.

References grk::CodeStream::cp_, grk::grk_read(), J2K_CCP_CSTY_PRT, grk::TileCodingParams::tccps, and grk::CodingParams::tcps.

Referenced by compare_coc().

## compare_SQcd_SQcc()

bool grk::CodeStreamCompress::compare_SQcd_SQcc | ( | uint32_t | first_comp_no,
|  | uint32_t | second_comp_no
| ) |  |

private

Compares 2 SQcd or SQcc element, i.e.

the quantization values of a band in the QCD or QCC.

Parameters

  first_comp_no | the first component number to compare.
  second_comp_no | the second component number to compare.

Returns
  true if equals.

References grk::CodeStream::cp_, grk::grk_read(), J2K_CCP_QNTSTY_NOQNT, J2K_CCP_QNTSTY_SIQNT, grk::TileComponentCodingParams::numresolutions, grk::TileCodingParams::tccps, and grk::CodingParams::tcps.

Referenced by compare_qcc().

## compress()

bool grk::CodeStreamCompress::compress | ( | grk_plugin_tile * | tile | ) |

virtual

Implements grk::ICodeStreamCompress.

References grk::CodeStream::cp_, end(), grk::CodeStream::exec(), ExecSingleton::get(), grk::GRK_ERROR(), grk::grk_read(), grk::maxNumTilesJ2K, grk::CodeStream::stream_, grk::CodingParams::t_grid_height, grk::CodingParams::t_grid_width, and writeTileParts().

Referenced by grk::FileFormatCompress::compress().

## compressValidation()

bool grk::CodeStreamCompress::compressValidation | ( | void |  | ) |

private

References grk::CodeStream::cp_, grk::GRK_ERROR(), GRK_J2K_MAXRLVLS, grk::TileComponentCodingParams::numresolutions, grk::CodingParams::t_height, grk::CodingParams::t_width, grk::TileCodingParams::tccps, and grk::CodingParams::tcps.

Referenced by start().

## convertProgressionOrder()

char * grk::CodeStreamCompress::convertProgressionOrder | ( | GRK_PROG_ORDER | prg_order | ) |

static

References grk::j2k_prog_order::enum_prog, grk::grk_read(), grk::j2k_prog_order_list, and grk::j2k_prog_order::str_prog.

Referenced by grk::PacketIter::enableTilePartGeneration(), and getNumTilePartsForProgression().

## end()

bool grk::CodeStreamCompress::end | ( | void |  | ) |

private

References grk::CodingParams::coding_params_, grk::CodeStream::cp_, grk::CodingParams::enc_, grk::CodeStream::exec(), grk::CodeStream::procedure_list_, write_eoc(), write_tlm_end(), and grk::EncodingParams::writeTLM.

Referenced by compress().

## get_SPCod_SPCoc_size()

uint32_t grk::CodeStreamCompress::get_SPCod_SPCoc_size | ( | uint32_t | comp_no | ) |

private

Gets the size taken by writing a SPCod or SPCoc for the given tile and component.

Parameters

  comp_no | the component being outputted.

Returns
  the number of bytes taken by the SPCod element.

References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), grk::grk_read(), J2K_CCP_CSTY_PRT, grk::SPCod_SPCoc_len, grk::TileCodingParams::tccps, and grk::CodingParams::tcps.

Referenced by write_coc(), and write_cod().

## get_SQcd_SQcc_size()

uint32_t grk::CodeStreamCompress::get_SQcd_SQcc_size | ( | uint32_t | comp_no | ) |

private

Gets the size taken by writing SQcd or SQcc element, i.e.

the quantization values of a band in the QCD or QCC.

Parameters

  comp_no | the component being output.

Returns
  the number of bytes taken by the SPCod element.

References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), grk::grk_read(), J2K_CCP_QNTSTY_NOQNT, J2K_CCP_QNTSTY_SIQNT, grk::TileCodingParams::tccps, and grk::CodingParams::tcps.

Referenced by write_qcc(), and write_qcd().

## getNumTileParts()

bool grk::CodeStreamCompress::getNumTileParts | ( | uint16_t * | p_nb_tile_parts,
|  | GrkImage * | image
| ) |  |

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.

Parameters

  p_nb_tile_parts | total number of tile parts in whole image.
  image | image to compress.

Returns
  true if the function was successful, false else.

References grk::CodeStream::cp_, getNumTilePartsForProgression(), grk::GRK_ERROR(), grk::grk_read(), grk::maxTilePartsPerTileJ2K, grk::maxTotalTilePartsJ2K, grk::CodingParams::t_grid_height, grk::CodingParams::t_grid_width, grk::CodingParams::tcps, and grk::PacketManager::updateCompressParams().

Referenced by init_header_writing().

## getNumTilePartsForProgression()

uint64_t grk::CodeStreamCompress::getNumTilePartsForProgression | ( | uint32_t | pino,
|  | uint16_t | tileno
| ) |  |

private

Gets the number of tile parts used for the given change of progression (if any) and the given tile.

Parameters

  pino | the offset of the given poc (i.e. its position in the coding parameter).
  tileno | the given tile.

Returns
  the number of tile parts.

References convertProgressionOrder(), grk::CodeStream::cp_, grk::grk_read(), and grk::maxTilePartsPerTileJ2K.

Referenced by getNumTileParts(), and writeTileParts().

## getPocSize()

uint16_t grk::CodeStreamCompress::getPocSize | ( | uint32_t | numComponents,
|  | uint32_t | l_nb_poc
| ) |  |

static

References grk::grk_read().

Referenced by grk::TileProcessor::doCompress(), writePoc(), and writeTilePart().

## init()

bool grk::CodeStreamCompress::init | ( | grk_cparameters * | p_param,
|  | GrkImage * | p_image
| ) |  |

virtual

Implements grk::ICodeStreamCompress.

References grk::EncodingParams::allocationByFixedQuality_, grk::EncodingParams::allocationByRateDistortion_, grk::GrkImage::applyICC(), grk::mct::calculate_norms(), grk::CodingParams::coding_params_, _grk_image::color_space, grk::CodingParams::comment, grk::CodingParams::comment_len, _grk_image::comps, grk::GrkImage::copyHeader(), grk::CodeStream::cp_, grk::TileComponentCodingParams::csty, _grk_image_comp::data, _grk_image_comp::dx, _grk_image_comp::dy, grk::EncodingParams::enableTilePartGeneration_, grk::CodingParams::enc_, grk::floorlog2(), GRK_CBLKSTY_HT, GRK_CLRSPC_EYCC, GRK_CLRSPC_SYCC, grk::GRK_ERROR(), 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_J2K_MAXRLVLS, GRK_JPH_RSIZ_FLAG, grk::grk_malloc(), GRK_MAX_COMMENT_LENGTH, GRK_PROFILE_CINEMA_S2K, GRK_PROFILE_CINEMA_S4K, GRK_PROFILE_NONE, GRK_PROFILE_PART2, grk::grk_read(), grk_version(), grk::GRK_WARN(), _grk_image_comp::h, grk::CodeStream::headerImage_, init_mct_encoding(), grk::Profile::is_broadcast_compliant(), grk::Profile::is_cinema_compliant(), grk::Profile::is_imf_compliant(), grk::CodingParams::isBinaryComment, J2K_CCP_CSTY_PRT, J2K_CCP_QNTSTY_NOQNT, J2K_CCP_QNTSTY_SEQNT, J2K_CP_CSTY_PRT, grk::EncodingParams::max_comp_size_, grk::maxNumComponentsJ2K, grk::maxNumTilesJ2K, grk::EncodingParams::newTilePartProgressionDivider_, grk::CodingParams::num_comments, _grk_image::numcomps, _grk_image_comp::prec, grk::EncodingParams::rateControlAlgorithm, grk::CodingParams::rsiz, grk::Profile::set_broadcast_parameters(), grk::Profile::set_cinema_parameters(), grk::Profile::set_imf_parameters(), _grk_image_comp::sgnd, grk::CodingParams::t_grid_height, grk::CodingParams::t_grid_width, grk::CodingParams::t_height, grk::CodingParams::t_width, grk::TileCodingParams::tccps, grk::CodingParams::tcps, grk::CodingParams::tx0, grk::CodingParams::ty0, validateProgressionOrders(), _grk_image_comp::w, grk::EncodingParams::writePLT, grk::EncodingParams::writeTLM, _grk_image::x0, _grk_image::x1, _grk_image::y0, and _grk_image::y1.

Referenced by grk::FileFormatCompress::init().

## init_header_writing()

bool grk::CodeStreamCompress::init_header_writing | ( | void |  | ) |

private

References cacheEndOfHeader(), grk::CodeStream::codeStreamInfo, grk::CodingParams::coding_params_, compressorState_, grk::CodeStream::cp_, grk::CodingParams::enc_, grk::CodeStream::getHeaderImage(), getNumTileParts(), GRK_EXTENSION_MCT, GRK_PROFILE_PART2, grk::TileCodingParams::hasPoc(), grk::TileCodingParams::isHT(), grk::CodeStream::procedure_list_, grk::CodingParams::rsiz, grk::CodingParams::tcps, grk::CompressorState::total_tile_parts_, 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(), writePoc(), and grk::EncodingParams::writeTLM.

Referenced by start().

## init_mct_encoding()

bool grk::CodeStreamCompress::init_mct_encoding | ( | TileCodingParams * | p_tcp,
|  | GrkImage * | p_image
| ) |  |

private

References grk::default_number_mct_records, grk::grk_free(), grk::grk_malloc(), grk::grk_read(), grk::grk_realloc(), grk::j2k_mct_write_functions_from_float, grk::MCT_ELEMENT_SIZE, grk::MCT_TYPE_DECORRELATION, grk::MCT_TYPE_FLOAT, and grk::MCT_TYPE_OFFSET.

Referenced by init().

## mct_validation()

bool grk::CodeStreamCompress::mct_validation | ( | void |  | ) |

private

References grk::CodeStream::cp_, grk::grk_read(), grk::CodeStream::headerImage_, _grk_image::numcomps, grk::CodingParams::rsiz, grk::CodingParams::t_grid_height, grk::CodingParams::t_grid_width, grk::TileCodingParams::tccps, and grk::CodingParams::tcps.

Referenced by start().

## start()

bool grk::CodeStreamCompress::start | ( | void |  | ) |

virtual

Implements grk::ICodeStreamCompress.

References compressValidation(), grk::CodeStream::exec(), init_header_writing(), mct_validation(), grk::CodeStream::procedure_list_, and grk::CodeStream::validation_list_.

Referenced by grk::FileFormatCompress::start().

## updateRates()

bool grk::CodeStreamCompress::updateRates | ( | void |  | ) |

private

References grk::CodeStream::cp_, grk::grk_read(), grk::CodeStream::headerImage_, grk::CodeStream::stream_, grk::BufferedStream::tell(), and _grk_image::x1.

Referenced by init_header_writing().

## validateProgressionOrders()

bool grk::CodeStreamCompress::validateProgressionOrders | ( | const grk_progression * | progressions,
|  | uint32_t | numProgressions,
|  | uint8_t | numResolutions,
|  | uint16_t | numcomps,
|  | uint16_t | numlayers
| ) |  |

private

Validate progression orders.

Parameters

  progressions | progression orders.
  numProgressions | number of progression orders.
  numResolutions | number of resolutions.
  numcomps | number of components
  numlayers | number of layers.

Returns
  true if the pocs are valid.

References grk::GRK_ERROR(), and grk::grk_read().

Referenced by init().

## write_all_coc()

bool grk::CodeStreamCompress::write_all_coc | ( |  | ) |

private

Writes COC marker for each component.

References compare_coc(), grk::CodeStream::getHeaderImage(), grk::grk_read(), _grk_image::numcomps, and write_coc().

Referenced by init_header_writing().

## write_all_qcc()

bool grk::CodeStreamCompress::write_all_qcc | ( |  | ) |

private

Writes QCC marker for each component.

References compare_qcc(), grk::CodeStream::getHeaderImage(), grk::grk_read(), _grk_image::numcomps, and write_qcc().

Referenced by init_header_writing().

## write_cap()

bool grk::CodeStreamCompress::write_cap | ( |  | ) |

private

Writes the CAP marker.

References grk::CodeStream::cp_, grk::TileCodingParams::qcd_, grk::CodeStream::stream_, grk::CodingParams::tcps, and grk::Quantizer::write().

Referenced by init_header_writing().

## write_cbd()

bool grk::CodeStreamCompress::write_cbd | ( |  | ) |

private

Writes the CBD marker (Component bit depth definition)

References grk::CodeStream::getHeaderImage(), grk::grk_read(), grk::J2K_MS_CBD, _grk_image::numcomps, grk::CodeStream::stream_, grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

Referenced by write_mct_data_group().

## write_coc() [1/2]

bool grk::CodeStreamCompress::write_coc | ( | uint32_t | comp_no | ) |

private

References grk::cod_coc_len, grk::CodeStream::cp_, get_SPCod_SPCoc_size(), grk::CodeStream::getHeaderImage(), grk::grk_read(), grk::J2K_MS_COC, grk::CodeStream::stream_, grk::CodingParams::tcps, write_SPCod_SPCoc(), grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

## write_coc() [2/2]

bool grk::CodeStreamCompress::write_coc | ( | uint32_t | comp_no,
|  | BufferedStream * | stream
| ) |  |

private

Writes the COC marker (Coding style component)

Parameters

  comp_no | the index of the component to output.
  stream | buffered stream.

Referenced by write_all_coc().

## write_cod()

bool grk::CodeStreamCompress::write_cod | ( |  | ) |

private

Writes the COD marker (Coding style default)

References grk::CodeStream::cp_, get_SPCod_SPCoc_size(), grk::GRK_ERROR(), grk::grk_read(), grk::J2K_MS_COD, grk::CodeStream::stream_, grk::CodingParams::tcps, write_SPCod_SPCoc(), grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

Referenced by init_header_writing().

## write_com()

bool grk::CodeStreamCompress::write_com | ( |  | ) |

private

Writes the COM marker (comment)

References grk::CodingParams::comment, grk::CodingParams::comment_len, grk::CodeStream::cp_, GRK_MAX_COMMENT_LENGTH, grk::grk_read(), grk::GRK_WARN(), grk::CodingParams::isBinaryComment, grk::J2K_MS_COM, grk::CodingParams::num_comments, grk::CodeStream::stream_, grk::BufferedStream::writeBytes(), and grk::BufferedStream::writeShort().

Referenced by init_header_writing().

## write_eoc()

bool grk::CodeStreamCompress::write_eoc | ( |  | ) |

private

Writes the EOC marker (End of Codestream)

References grk::BufferedStream::flush(), grk::J2K_MS_EOC, grk::CodeStream::stream_, and grk::BufferedStream::writeShort().

Referenced by end().

## write_mcc_record()

bool grk::CodeStreamCompress::write_mcc_record | ( | grk_simple_mcc_decorrelation_data * | p_mcc_record,
|  | BufferedStream * | stream
| ) |  |

private

Writes the MCC marker (Multiple Component Collection)

Parameters

  p_mcc_record | MCC record
  stream | buffered stream.

References grk::grk_read(), grk::J2K_MS_MCC, grk::BufferedStream::write24(), grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

Referenced by write_mct_data_group().

## write_mco()

bool grk::CodeStreamCompress::write_mco | ( |  | ) |

private

Writes the MCO marker (Multiple component transformation ordering)

References grk::CodeStream::cp_, grk::grk_read(), grk::J2K_MS_MCO, grk::CodeStream::stream_, grk::CodingParams::tcps, grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

Referenced by write_mct_data_group().

## write_mct_data_group()

bool grk::CodeStreamCompress::write_mct_data_group | ( |  | ) |

private

Writes the CBD-MCT-MCC-MCO markers (Multi components transform)

References grk::CodeStream::cp_, grk::grk_read(), grk::TileCodingParams::mct_records_, grk::CodeStream::stream_, grk::CodingParams::tcps, write_cbd(), write_mcc_record(), write_mco(), and write_mct_record().

Referenced by init_header_writing().

## write_mct_record()

bool grk::CodeStreamCompress::write_mct_record | ( | grk_mct_data * | p_mct_record,
|  | BufferedStream * | stream
| ) |  |

private

Writes the MCT marker (Multiple Component Transform)

Parameters

  p_mct_record | MCT record
  stream | buffered stream.

References grk::grk_read(), grk::J2K_MS_MCT, grk::BufferedStream::writeBytes(), and grk::BufferedStream::writeShort().

Referenced by write_mct_data_group().

## write_qcc() [1/2]

bool grk::CodeStreamCompress::write_qcc | ( | uint16_t | tileIndex,
|  | uint32_t | comp_no,
|  | BufferedStream * | stream
| ) |  |

private

Writes the QCC marker (quantization component)

Parameters

  tileIndex | current tile index
  comp_no | the index of the component to output.
  stream | buffered stream.

Referenced by write_all_qcc().

## write_qcc() [2/2]

bool grk::CodeStreamCompress::write_qcc | ( | uint32_t | comp_no | ) |

private

References get_SQcd_SQcc_size(), grk::CodeStream::getHeaderImage(), grk::grk_read(), grk::J2K_MS_QCC, grk::CodeStream::stream_, write_SQcd_SQcc(), grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

## write_qcd()

bool grk::CodeStreamCompress::write_qcd | ( |  | ) |

private

Writes the QCD marker (quantization default)

References get_SQcd_SQcc_size(), grk::GRK_ERROR(), grk::grk_read(), grk::J2K_MS_QCD, grk::CodeStream::stream_, write_SQcd_SQcc(), and grk::BufferedStream::writeShort().

Referenced by init_header_writing().

## write_regions()

bool grk::CodeStreamCompress::write_regions | ( |  | ) |

private

Writes regions of interests.

References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), grk::grk_read(), _grk_image::numcomps, grk::TileCodingParams::tccps, grk::CodingParams::tcps, and write_rgn().

Referenced by init_header_writing().

## write_rgn()

bool grk::CodeStreamCompress::write_rgn | ( | uint16_t | tile_no,
|  | uint32_t | comp_no,
|  | uint32_t | nb_comps
| ) |  |

private

Writes the RGN marker (Region Of Interest)

Parameters

  tile_no | the tile to output
  comp_no | the component to output
  nb_comps | the number of components

References grk::CodeStream::cp_, grk::grk_read(), grk::J2K_MS_RGN, grk::CodeStream::stream_, grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

Referenced by write_regions().

## write_siz()

bool grk::CodeStreamCompress::write_siz | ( |  | ) |

private

Writes the SIZ marker (image and tile size)

References grk::grk_read(), grk::CodeStream::stream_, and grk::SIZMarker::write().

Referenced by init_header_writing().

## write_soc()

bool grk::CodeStreamCompress::write_soc | ( |  | ) |

private

Writes the SOC marker (Start Of Codestream)

References grk::J2K_MS_SOC, grk::CodeStream::stream_, and grk::BufferedStream::writeShort().

Referenced by init_header_writing().

## write_SPCod_SPCoc()

bool grk::CodeStreamCompress::write_SPCod_SPCoc | ( | uint32_t | comp_no | ) |

private

Writes a SPCod or SPCoc element, i.e.

the coding style of a given component of a tile.

Parameters

  comp_no | the component number to output.

Returns
  true if successful

References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), grk::grk_read(), J2K_CCP_CSTY_PRT, grk::CodeStream::stream_, grk::TileCodingParams::tccps, grk::CodingParams::tcps, and grk::BufferedStream::writeByte().

Referenced by write_coc(), and write_cod().

## write_SQcd_SQcc()

bool grk::CodeStreamCompress::write_SQcd_SQcc | ( | uint32_t | comp_no | ) |

private

Writes a SQcd or SQcc element, i.e.

the quantization values of a band in the QCD or QCC.

Parameters

  comp_no | the component number to output.

References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), grk::grk_read(), J2K_CCP_QNTSTY_NOQNT, J2K_CCP_QNTSTY_SIQNT, grk::CodeStream::stream_, grk::TileCodingParams::tccps, grk::CodingParams::tcps, grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

Referenced by write_qcc(), and write_qcd().

## write_tlm_begin()

bool grk::CodeStreamCompress::write_tlm_begin | ( |  | ) |

private

Begin writing the TLM marker (Tile Length Marker)

References compressorState_, grk::CodeStream::cp_, grk::CodeStream::stream_, grk::CodingParams::tlm_markers, grk::CompressorState::total_tile_parts_, and grk::TileLengthMarkers::writeBegin().

Referenced by init_header_writing().

## write_tlm_end()

bool grk::CodeStreamCompress::write_tlm_end | ( |  | ) |

private

End writing the updated tlm.

References grk::CodeStream::cp_, grk::CodingParams::tlm_markers, and grk::TileLengthMarkers::writeEnd().

Referenced by end().

## writePoc()

bool grk::CodeStreamCompress::writePoc | ( |  | ) |

private

Writes the POC marker (Progression Order Change)

References grk::CodeStream::cp_, grk::CodeStream::getHeaderImage(), getPocSize(), grk::grk_read(), grk::J2K_MS_POC, grk::CodeStream::stream_, grk::TileCodingParams::tccps, grk::CodingParams::tcps, grk::BufferedStream::writeByte(), and grk::BufferedStream::writeShort().

Referenced by init_header_writing(), and writeTilePart().

## writeTilePart()

bool grk::CodeStreamCompress::writeTilePart | ( | TileProcessor * | tileProcessor | ) |

private

References grk::TileProcessor::canPreCalculateTileLen(), grk::TileProcessor::canWritePocMarker(), grk::CodeStream::cp_, grk::TileProcessor::getIndex(), getPocSize(), grk::TileProcessor::getPreCalculatedTileLen(), grk::GRK_ERROR(), grk::grk_read(), grk::CodeStream::headerImage_, _grk_image::numcomps, grk::TileLengthMarkers::push(), grk::sot_marker_segment_len_minus_tile_data_len, grk::CodeStream::stream_, grk::CodingParams::tcps, grk::BufferedStream::tell(), grk::TileProcessor::tilePartCounter_, grk::CodingParams::tlm_markers, writePoc(), and grk::TileProcessor::writeTilePartT2().

Referenced by writeTileParts().

## writeTileParts()

bool grk::CodeStreamCompress::writeTileParts | ( | TileProcessor * | tileProcessor | ) |

private

References grk::CodeStream::cp_, grk::CodeStream::currentTileProcessor_, grk::TileProcessor::first_poc_tile_part_, grk::TileProcessor::getIndex(), getNumTilePartsForProgression(), grk::GRK_ERROR(), grk::grk_read(), grk::TileProcessor::incrementIndex(), grk::maxTilePartsPerTileJ2K, grk::TileProcessor::pino, grk::CodingParams::tcps, grk::TileProcessor::tilePartCounter_, and writeTilePart().

Referenced by compress().

## Member Data Documentation

## compressorState_

CompressorState grk::CodeStreamCompress::compressorState_

private

Referenced by init_header_writing(), and write_tlm_begin().

The documentation for this class was generated from the following files:

- CodeStreamCompress.h
- CodeStreamCompress.cpp