|
OSSIM - Open Source Software Image Map
Version 1.9.0 (20180803)
|
#include <ossimOpjCompressor.h>
Public Types | |
| enum | ossimOpjCompressionQuality { OPJ_UNKNOWN = 0, OPJ_USER_DEFINED = 1, OPJ_NUMERICALLY_LOSSLESS = 2, OPJ_VISUALLY_LOSSLESS = 3, OPJ_LOSSY = 4 } |
Public Member Functions | |
| ossimOpjCompressor () | |
| default constructor More... | |
| ~ossimOpjCompressor () | |
| destructor More... | |
| void | create (std::ostream *os, ossimScalarType scalar, ossim_uint32 bands, const ossimIrect &imageRect, const ossimIpt &tileSize, bool jp2) |
| Create method. More... | |
| void | openJp2Codestream () |
| Calls "open_codestream" on the m_jp2Target. More... | |
| bool | writeTile (ossimImageData *srcTile, ossim_uint32 tileIndex) |
| Write tile method. More... | |
| void | finish () |
| Finish method. More... | |
| void | setQualityType (ossimOpjCompressionQuality type) |
| Sets the quality type. More... | |
| ossimOpjCompressionQuality | getQualityType () const |
| void | setReversibleFlag (bool reversible) |
| Sets the m_reversible flag. More... | |
| bool | getReversibleFlag () const |
| void | setAlphaChannelFlag (bool flag) |
| Set the writer to add an alpha channel to the output png image. More... | |
| bool | getAlphaChannelFlag () const |
| Retrieve the writer's setting for whether or not to add an alpha channel to the output png image. More... | |
| void | setLevels (ossim_int32 levels) |
| Sets the number of levels. More... | |
| ossim_int32 | getLevels () const |
| void | setThreads (ossim_int32 threads) |
| Sets the number of threads. More... | |
| ossim_int32 | getThreads () const |
| void | setOptions (const std::vector< ossimString > &options) |
| Sets the options array. More... | |
| void | getOptions (std::vector< ossimString > &options) const |
| Get the array of options. More... | |
| bool | saveState (ossimKeywordlist &kwl, const char *prefix=0) const |
| saves the state of the object. More... | |
| bool | loadState (const ossimKeywordlist &kwl, const char *prefix=0) |
| Method to the load (recreate) the state of an object from a keyword list. More... | |
| bool | setProperty (ossimRefPtr< ossimProperty > property) |
| Will set the property whose name matches the argument "property->getName()". More... | |
| ossimRefPtr< ossimProperty > | getProperty (const ossimString &name) const |
| void | getPropertyNames (std::vector< ossimString > &propertyNames) const |
| Pushes this's names onto the list of property names. More... | |
| bool | writeGeotiffBox (std::ostream *stream, const ossimImageGeometry *geom, const ossimIrect &rect, const ossimFilename &tmpFile, ossimPixelType pixelType) |
| Writes the geotiff box to the jp2. More... | |
| bool | writeGmlBox (std::ostream *stream, const ossimImageGeometry *geom, const ossimIrect &rect) |
| Writes the gml box to the jp2. More... | |
Private Member Functions | |
| void | initOpjCodingParams (bool jp2, const ossimIpt &tileSize, const ossimIrect &imageRect) |
| int | getNumberOfLayers () const |
| ossimString | getQualityTypeString () const |
| void | setQualityTypeString (const ossimString &s) |
| void | initLevels (const ossimIrect &imageRect) |
| Set levels, class attribute m_levels and m_parameters->numresolution. More... | |
| void | setCodeBlockSize (ossim_int32 xSize, ossim_int32 ySize) |
| Set code block size. More... | |
| void | setProgressionOrder (OPJ_PROG_ORDER progressionOrder) |
| Sets progression order. More... | |
| void | setTlmTileCount (ossim_uint32 tilesToWrite) |
| opj_cparameters_t * | createOpjCodingParameters (bool jp2, const ossimIpt &tileSize, const ossimIrect &imageRect) const |
| opj_codec_t * | createOpjCodec (bool jp2) const |
| opj_stream_t * | createOpjStream (std::ostream *os) const |
| opj_image_t * | createOpjImage (ossimScalarType scalar, ossim_uint32 bands, const ossimIrect &imageRect) const |
Private Attributes | |
| opj_cparameters_t * | m_params |
| opj_codec_t * | m_codec |
| opj_stream_t * | m_stream |
| opj_image_t * | m_image |
| ossimIrect | m_imageRect |
| Image rectangle. More... | |
| bool | m_reversible |
| Lossless or lossy. More... | |
| bool | m_alpha |
| If true write alpha channel. More... | |
| ossim_int32 | m_levels |
| Reduced resolution levels. More... | |
| ossim_int32 | m_threads |
| Number of threads. More... | |
| std::vector< ossimString > | m_options |
| Container for Opj options. More... | |
| ossimOpjCompressionQuality | m_qualityType |
Definition at line 29 of file ossimOpjCompressor.h.
| Enumerator | |
|---|---|
| OPJ_UNKNOWN | |
| OPJ_USER_DEFINED | |
| OPJ_NUMERICALLY_LOSSLESS | |
| OPJ_VISUALLY_LOSSLESS | |
| OPJ_LOSSY | |
Definition at line 34 of file ossimOpjCompressor.h.
| ossimOpjCompressor::ossimOpjCompressor | ( | ) |
default constructor
Definition at line 104 of file ossimOpjCompressor.cpp.
| ossimOpjCompressor::~ossimOpjCompressor | ( | ) |
| void ossimOpjCompressor::create | ( | std::ostream * | os, |
| ossimScalarType | scalar, | ||
| ossim_uint32 | bands, | ||
| const ossimIrect & | imageRect, | ||
| const ossimIpt & | tileSize, | ||
| bool | jp2 | ||
| ) |
Create method.
| os | Stream to write to. |
| scalar | Scalar type of source tiles to be fed to compressor. |
| bands | Number of bands in source tiles to be fed to compressor. |
| imageRect | The image rectangle. |
| tileSize | The size of a tile. |
| jp2 | If true jp2 header and jp2 geotiff block will be written out. |
Definition at line 129 of file ossimOpjCompressor.cpp.
|
private |
Definition at line 1132 of file ossimOpjCompressor.cpp.
References ossim::opj_error_callback(), ossim::opj_info_callback(), and ossim::opj_warning_callback().
|
private |
|
private |
Definition at line 1187 of file ossimOpjCompressor.cpp.
References ossim::getActualBitsPerPixel(), ossim::getBitsPerPixel(), ossimIrect::height(), ossim::isSigned(), and ossimIrect::width().
|
private |
Definition at line 1155 of file ossimOpjCompressor.cpp.
| void ossimOpjCompressor::finish | ( | ) |
Finish method.
Every call to "create" should be matched by a "finish". Note the destructor calls finish.
Definition at line 311 of file ossimOpjCompressor.cpp.
References m_codec, m_image, and m_stream.
Referenced by ~ossimOpjCompressor().
| bool ossimOpjCompressor::getAlphaChannelFlag | ( | ) | const |
Retrieve the writer's setting for whether or not to add an alpha channel to the output png image.
Definition at line 374 of file ossimOpjCompressor.cpp.
References m_alpha.
| ossim_int32 ossimOpjCompressor::getLevels | ( | ) | const |
Definition at line 387 of file ossimOpjCompressor.cpp.
References m_levels.
|
private |
| void ossimOpjCompressor::getOptions | ( | std::vector< ossimString > & | options | ) | const |
Get the array of options.
| options | Array to initialize. |
| ossimRefPtr< ossimProperty > ossimOpjCompressor::getProperty | ( | const ossimString & | name | ) | const |
| name | Name of property to return. |
Definition at line 476 of file ossimOpjCompressor.cpp.
References ossimKeywordNames::COMPRESSION_QUALITY_KW, and getQualityTypeString().
| void ossimOpjCompressor::getPropertyNames | ( | std::vector< ossimString > & | propertyNames | ) | const |
Pushes this's names onto the list of property names.
| propertyNames | array to add this's property names to. |
Definition at line 527 of file ossimOpjCompressor.cpp.
References ossimKeywordNames::COMPRESSION_QUALITY_KW.
| ossimOpjCompressor::ossimOpjCompressionQuality ossimOpjCompressor::getQualityType | ( | ) | const |
Definition at line 353 of file ossimOpjCompressor.cpp.
References m_qualityType.
|
private |
Definition at line 1024 of file ossimOpjCompressor.cpp.
Referenced by getProperty(), and saveState().
| bool ossimOpjCompressor::getReversibleFlag | ( | ) | const |
Definition at line 364 of file ossimOpjCompressor.cpp.
References m_reversible.
| ossim_int32 ossimOpjCompressor::getThreads | ( | ) | const |
Definition at line 400 of file ossimOpjCompressor.cpp.
References m_threads.
|
private |
Set levels, class attribute m_levels and m_parameters->numresolution.
Number of wavelet decomposition levels, or stages. May not exceed 32. Opj Default is 6 (0 - 5)
| imageRect | The image rectangle. |
Definition at line 1066 of file ossimOpjCompressor.cpp.
References ossim::computeLevels(), m_levels, and m_params.
|
private |
Definition at line 809 of file ossimOpjCompressor.cpp.
| bool ossimOpjCompressor::loadState | ( | const ossimKeywordlist & | kwl, |
| const char * | prefix = 0 |
||
| ) |
Method to the load (recreate) the state of an object from a keyword list.
Return true if ok or false on error.
Definition at line 579 of file ossimOpjCompressor.cpp.
References ossimKeywordNames::COMPRESSION_QUALITY_KW, ossimKeywordlist::find(), and setQualityTypeString().
| void ossimOpjCompressor::openJp2Codestream | ( | ) |
Calls "open_codestream" on the m_jp2Target.
Note: Only valid if create method was called with jp2 = true.
Definition at line 260 of file ossimOpjCompressor.cpp.
References m_codec, m_image, and m_stream.
| bool ossimOpjCompressor::saveState | ( | ossimKeywordlist & | kwl, |
| const char * | prefix = 0 |
||
| ) | const |
saves the state of the object.
Definition at line 536 of file ossimOpjCompressor.cpp.
References ossimKeywordlist::add(), ossimKeywordNames::COMPRESSION_QUALITY_KW, and getQualityTypeString().
| void ossimOpjCompressor::setAlphaChannelFlag | ( | bool | flag | ) |
Set the writer to add an alpha channel to the output png image.
| flag | true to create an alpha channel. |
Definition at line 369 of file ossimOpjCompressor.cpp.
References m_alpha.
|
private |
Set code block size.
Nominal code-block dimensions (must be powers of 2 no less than 4 and no greater than 1024). Opj Default block dimensions are {64,64}
| xSize | |
| ySize |
Definition at line 1088 of file ossimOpjCompressor.cpp.
References m_params.
| void ossimOpjCompressor::setLevels | ( | ossim_int32 | levels | ) |
Sets the number of levels.
This must be positive and at least 1. Default = 6 ( r0 - r5 )
| levels | Levels to set. |
Definition at line 379 of file ossimOpjCompressor.cpp.
References m_levels.
| void ossimOpjCompressor::setOptions | ( | const std::vector< ossimString > & | options | ) |
Sets the options array.
These get passed to the generic kdu_params::parse_string method. Note this adds options to the list. Does not zero out existing options.
| options | Array of options to add. |
Definition at line 405 of file ossimOpjCompressor.cpp.
References m_options.
|
private |
Sets progression order.
Default progression order (may be overridden by Porder). The four character identifiers have the following interpretation: L=layer; R=resolution; C=component; P=position. The first character in the identifier refers to the index which progresses most slowly, while the last refers to the index which progresses most quickly. [Default is LRCP] Enumerations: (LRCP=0,RLCP=1,RPCL=2,PCRL=3,CPRL=4)
| corder | The progression order which should be one of the above enumerations. |
Definition at line 1103 of file ossimOpjCompressor.cpp.
References m_params.
| bool ossimOpjCompressor::setProperty | ( | ossimRefPtr< ossimProperty > | property | ) |
Will set the property whose name matches the argument "property->getName()".
| property | Object containing property to set. |
Definition at line 415 of file ossimOpjCompressor.cpp.
References ossimRefPtr< T >::valid().
| void ossimOpjCompressor::setQualityType | ( | ossimOpjCompressionQuality | type | ) |
Sets the quality type.
| type | See enumeration for types. |
Definition at line 333 of file ossimOpjCompressor.cpp.
References m_qualityType, OPJ_LOSSY, OPJ_VISUALLY_LOSSLESS, and setReversibleFlag().
|
private |
Definition at line 1029 of file ossimOpjCompressor.cpp.
References ossimString::downcase().
Referenced by loadState().
| void ossimOpjCompressor::setReversibleFlag | ( | bool | reversible | ) |
Sets the m_reversible flag.
If set to true the compression will be lossless; if not, lossy. Default is lossless.
| reversible | Flag to set. |
Definition at line 359 of file ossimOpjCompressor.cpp.
References m_reversible.
Referenced by setQualityType().
| void ossimOpjCompressor::setThreads | ( | ossim_int32 | threads | ) |
Sets the number of threads.
This must be positive and at least 1. Default = 1 thread.
| threads | The number of threads. |
Definition at line 392 of file ossimOpjCompressor.cpp.
References m_threads.
|
private |
Definition at line 1120 of file ossimOpjCompressor.cpp.
| bool ossimOpjCompressor::writeGeotiffBox | ( | std::ostream * | stream, |
| const ossimImageGeometry * | geom, | ||
| const ossimIrect & | rect, | ||
| const ossimFilename & | tmpFile, | ||
| ossimPixelType | pixelType | ||
| ) |
Writes the geotiff box to the jp2.
| stream | The stream to write to. |
| geom | Output image geometry. |
| rect | Output rectangle (view rect). |
| tmpFile | Temp file written out. |
| pixelType | OSSIM_PIXEL_IS_POINT(0) or OSSIM_PIXEL_IS_AREA(1) |
Definition at line 636 of file ossimOpjCompressor.cpp.
References ossim::byteOrder(), ossimRefPtr< T >::get(), ossimImageGeometry::getProjection(), OSSIM_LITTLE_ENDIAN, ossimEndian::swap(), ossimRefPtr< T >::valid(), and ossimGeoTiff::writeJp2GeotiffBox().
| bool ossimOpjCompressor::writeGmlBox | ( | std::ostream * | stream, |
| const ossimImageGeometry * | geom, | ||
| const ossimIrect & | rect | ||
| ) |
Writes the gml box to the jp2.
| stream | The stream to write to. |
| geom | Output image geometry. |
| rect | Output rectangle (view rect). |
Definition at line 706 of file ossimOpjCompressor.cpp.
References ossim::byteOrder(), ossimGmlSupportData::initialize(), OSSIM_LITTLE_ENDIAN, ossimEndian::swap(), and ossimGmlSupportData::write().
| bool ossimOpjCompressor::writeTile | ( | ossimImageData * | srcTile, |
| ossim_uint32 | tileIndex | ||
| ) |
Write tile method.
Writes tiles stream provided to create method. Note that tiles should be fed to compressor in left to right, top to bottom order.
| srcTile | The source tile to write. |
| tileIndex | Index starting at 0. Currently must be sequential. |
Definition at line 273 of file ossimOpjCompressor.cpp.
References ossimDataObject::getDataObjectStatus(), ossimImageData::getDataSizeInBytes(), ossimImageData::getImageRectangle(), ossimImageData::getUcharBuf(), m_codec, m_stream, OSSIM_NULL, ossimNotify(), and ossimNotifyLevel_WARN.
|
private |
If true write alpha channel.
Definition at line 311 of file ossimOpjCompressor.h.
Referenced by getAlphaChannelFlag(), and setAlphaChannelFlag().
|
private |
Definition at line 294 of file ossimOpjCompressor.h.
Referenced by finish(), openJp2Codestream(), and writeTile().
|
private |
Definition at line 297 of file ossimOpjCompressor.h.
Referenced by finish(), and openJp2Codestream().
|
private |
|
private |
Reduced resolution levels.
Definition at line 314 of file ossimOpjCompressor.h.
Referenced by getLevels(), initLevels(), and setLevels().
|
private |
Container for Opj options.
Definition at line 320 of file ossimOpjCompressor.h.
Referenced by setOptions().
|
private |
Definition at line 293 of file ossimOpjCompressor.h.
Referenced by getNumberOfLayers(), initLevels(), setCodeBlockSize(), and setProgressionOrder().
|
private |
Definition at line 322 of file ossimOpjCompressor.h.
Referenced by getQualityType(), and setQualityType().
|
private |
Lossless or lossy.
Definition at line 308 of file ossimOpjCompressor.h.
Referenced by getReversibleFlag(), and setReversibleFlag().
|
private |
Definition at line 295 of file ossimOpjCompressor.h.
Referenced by finish(), openJp2Codestream(), and writeTile().
|
private |
Number of threads.
Definition at line 317 of file ossimOpjCompressor.h.
Referenced by getThreads(), and setThreads().
1.8.14