|
|
PDS_JP2
|
#include <JP2_Encoder.hh>
Collaboration diagram for JP2_Encoder:

Public Member Functions | |
| JP2_Encoder () | |
| ~JP2_Encoder () | |
| std::string | source () const |
| Get the PDS image data source pathname. | |
| JP2_Encoder & | source (const std::string &pathname) |
| Set the pathname to the PDS image data source. | |
| std::string | destination () const |
| Get the destination JP2 file pathname. | |
| JP2_Encoder & | destination (const std::string &pathname) |
| Set the destination JP2 file pathname. | |
| std::string | PDS_label_pathname () const |
| Get the PDS/JP2 label file pathname. | |
| JP2_Encoder & | PDS_label_pathname (const std::string &pathname) |
| Set the PDS/JP2 label file pathname. | |
| std::streamoff | image_data_location () const |
| Get the location of the image data in the source file. | |
| JP2_Encoder & | image_data_location (std::streamoff file_offset) |
| Set the location of the image data in the source file. | |
| unsigned int | image_bands () const |
| Get the number of bands (components) in the PDS image. | |
| JP2_Encoder & | image_bands (unsigned int bands) |
| Set the number of bands (components) in the PDS image. | |
| const Size_2D | image_size () const |
| Get the size of the source PDS image data. | |
| JP2_Encoder & | image_size (const Size_2D &size) |
| Set the size of the source PDS image data. | |
| unsigned int | pixel_bytes () const |
| Get the number of bytes per pixel. | |
| JP2_Encoder & | pixel_bytes (unsigned int bytes_per_pixel) |
| Set the number of bytes per pixel. | |
| unsigned int | pixel_bits () const |
| Get the pixel precision. | |
| JP2_Encoder & | pixel_bits (unsigned int bits_per_pixel) |
| Set the number of bits per pixel. | |
| bool | signed_data () const |
| Get the signedness of the pixel data. | |
| JP2_Encoder & | signed_data (bool data_is_signed) |
| Set the signedness of the data. | |
| bool | MSB_data () const |
| Test if the source data will be treated as MSB ordered. | |
| JP2_Encoder & | MSB_data (bool data_is_MSB) |
| Set the source data byte ordering. | |
| bool | swap_pixel_bytes () const |
| Test if multi-byte pixels will be reordered before being sent to the JPEG2000 codestream generation machinery. | |
| JP2_Encoder & | swap_pixel_bytes (bool swap_data) |
| Set if multi-byte pixels will be reordered before being sent to the JPEG2000 codestream generation machinery. | |
| unsigned int | line_prefix_bytes () const |
| Get the number of bytes preceeding each line of image pixel data. | |
| JP2_Encoder & | line_prefix_bytes (unsigned int prefix_bytes) |
| Set the number of bytes preceeding each line of image pixel data. | |
| unsigned int | line_suffix_bytes () const |
| Get the number of bytes following each line of image pixel data. | |
| JP2_Encoder & | line_suffix_bytes (unsigned int suffix_bytes) |
| Set the number of bytes following each line of image pixel data. | |
| const Size_2D | tile_size () const |
| Get the size of the JP2 image tiles. | |
| JP2_Encoder & | tile_size (const Size_2D &size) |
| Set the size of the JP2 image tiles. | |
| unsigned int | resolution_levels () const |
| Get the total number of codestream resolution levels. | |
| JP2_Encoder & | resolution_levels (unsigned int resolution_levels) |
| Set the total number of codestream resolution levels. | |
| std::string | progression_order () const |
| Get the codestream progression order descriptor. | |
| JP2_Encoder & | progression_order (const std::string &progression) |
| Set the codestream progression order. | |
| const std::vector< Size_2D > | precinct_sizes () const |
| Get the precinct sizes for each resolution level. | |
| const Size_2D | precinct_size (unsigned int resolution_level=0) const |
| Get the precinct size for a given resolution level. | |
| JP2_Encoder & | precinct_sizes (const std::vector< Size_2D > &sizes) |
| Set the precinct sizes for each resolution level. | |
| JP2_Encoder & | precinct_size (const Size_2D &size, unsigned int resolution_level=0) |
| Set the precinct size for a given resolution level. | |
| const Size_2D | code_block_size () const |
| Get the code block size. | |
| JP2_Encoder & | code_block_size (const Size_2D &size) |
| Set the code block size. | |
| JP2_Box::JP2_Box_List & | added_boxes () |
| Get the list of user specified data boxes added to the JP2 file. | |
| JP2_Encoder & | add_box (JP2_Box *box) |
| Add a data box to the JP2 file. | |
| bool | remove_box (JP2_Box *box) |
| Remove a data box from the list of user specified boxes. | |
| const unsigned char * | producer_UUID () const |
| Get the product producer signature UUID value. | |
| JP2_Encoder & | producer_UUID (const unsigned char *id) |
| Set the product producer signature UUID value. | |
| bool | ready () const |
| Test if the encoder is ready to compress the image data. | |
| std::string | reasons () const |
| Get a description of the reasons that the encoder is not ready. | |
| int | needs () const |
| Indicates what the encoder needs to do its job. | |
| JP2_Encoder_Error * | encoder_error () const |
| Get the JP2_Encoder_Error describing the last encoder error that occurred. | |
| long long | encode () |
| Encode the image source to a JPEG2000 JP2 destination. | |
| void | open () |
| Open the source JP2 file. | |
| long long | write_header () |
| Write the required metadata boxes to the JP2 file. | |
| long long | write_user_boxes () |
| Write user specified boxes to the JP2 file. | |
| long long | write_codestream () |
| Generate the compressed image data JPEG2000 codestream and write it to the JP2 file. | |
| JP2_Encoder & | incremental_flush_bytes (long long bytes) |
| Set the rate at which compressed image data will be written to the output JP2 file. | |
| long long | incremental_flush_bytes () const |
| Get the rate at which compressed image data will be written to the output JP2 file. | |
| JP2_Encoder & | incremental_flush_lines (unsigned int lines) |
| Set the rate at which compressed image data will be written to the output JP2 file. | |
| int | incremental_flush_lines () const |
| Get the rate at which compressed image data will be written to the output JP2 file. | |
| long long | close () |
| int | invalid_precinct_size (const std::vector< Size_2D > &sizes) |
| Check for valid precinct sizes. | |
Static Public Attributes | |
| static const char *const | ID |
| Class identification name with source code version and date. | |
| static const unsigned int | DEFAULT_RESOLUTION_LEVELS = 6 |
| Default number of resolution levels. | |
| static const unsigned int | MAX_RESOLUTION_LEVELS = 32 |
| Maximum number of resolution levels. | |
| static const char *const | UUID_INFO_BOX_NAME = "uinf" |
| PDS label reference information UUID Info JP2 container box name. | |
| static const char *const | UUID_BOX_NAME = "ulst" |
| Data provider UUID JP2 box name. | |
| static const int | UUID_SIZE = 16 |
| Size of the UUID data content. | |
| static const char *const | URL_BOX_NAME = "url " |
| PDS label relative filename URL JP2 box name. | |
| static const int | MIN_STRIPE_HEIGHT = 256 |
| Image data stripe minimum and maximum number of lines. | |
| static const int | MAX_STRIPE_HEIGHT = 8192 |
| static const int | NEEDS_SOURCE = 1 << 0 |
| What the encoder needs to do its job. | |
| static const int | NEEDS_DESTINATION = 1 << 1 |
| static const int | NEEDS_IMAGE = 1 << 2 |
| static const int | ENCODER_EXCEPTION = 66 |
| JP2_Encoder_Error exception signal value. | |
Protected Member Functions | |
| void | read_stripe (std::istream &source, int band, int line, int lines, kdu_int16 *buffer) |
| Fill an image data buffer with pixel data from a source stream. | |
| void | read_stripe (std::istream &source, int band, int line, int lines, kdu_int32 *buffer) |
| Fill an image data buffer with pixel data from a source stream. | |
Protected Attributes | |
| std::string | Image_Source |
| Image source pathname. | |
| std::string | JP2_Pathname |
| Image destination pathname. | |
| std::streamoff | Image_Offset |
| Image data location as a byte offset within the source file. | |
| unsigned int | Image_Bands |
| Total image bands (components). | |
| Size_2D | Image_Size |
| unsigned int | Line_Prefix_Bytes |
| The number of bytes preceeding and following each line of pixel bytes. | |
| unsigned int | Line_Suffix_Bytes |
| unsigned int | Pixel_Bytes |
| Pixel datum size in bytes. | |
| unsigned int | Pixel_Bits |
| Pixel precision bits. | |
| bool | Signed_Data |
| Whether pixel data is to be treated as signed. | |
| JP2_Box::JP2_Box_List | Added_Boxes |
| std::string | PDS_Label_Pathname |
| PDS label file pathname to be placed in a UUID Info URL box. | |
| unsigned char * | Producer_UUID |
| The UUID to be placed in a UUID List box inside a UUID Info box. | |
| bool | Swap_Pixel_Bytes |
| Whether pixel bytes should be reordered before be encoded. | |
| unsigned int | Resolution_Levels |
| The number of resolution levels to encode. | |
| std::string | Progression_Order |
| The codestream progression order to be used. | |
| Size_2D | Tile_Size |
| Tile size for codestream structure organization. | |
| std::vector< Size_2D > | Precinct_Sizes |
| Precinct sizes for codestream structure organization within tiles. | |
| Size_2D | Code_Block_Size |
| Code block size for codestream packet encoding within precincts. | |
| long long | Incremental_Flush_Bytes |
After a JP2_Encoder is constructed it must be configured. The encoder must be configured with at least an input image data source file, an output JP2 destination file and the image data characterization with at least the image size and number of pixel bytes or pixel bits. By default the image data is assumed to be located at the beginning the source file, has one band (i.e. component), is unsigned, is MSB ordered (if multi-byte) and has no line prefix or suffix bytes.
The JP2_Encoder can also be configured with various JPEG2000 codestream organization information. By default the codestream will be untiled, have DEFAULT_RESOLUTION_LEVELS resolution levels, use Precint-Component-Resolution-Level progression order, have a 64x64 code block size and use precinct sizes determined by the underlying codestream generation machinery.
Once the JP2_Encoder is ready encoding can be started to generate the JP2 file from the image data source. Lossless image data compression will be used to generate the JPEG2000 codestream. A JP2_Encoder may be reused with or without reconfiguration between uses.
This implementation employs the Kakadu Software libraries.
|
|
|
|
|
|
|
|
Get the PDS image data source pathname.
|
|
|
Set the pathname to the PDS image data source. N.B.: If the source has already been opened and the pathname is different than the previous pathname, the source is closed.
|
|
|
Get the destination JP2 file pathname.
|
|
|
Set the destination JP2 file pathname.
|
|
|
Get the PDS/JP2 label file pathname.
|
|
|
Set the PDS/JP2 label file pathname. Only the filename portion of the pathname is used for the relative filename URL reference when the user boxes are written to the JP2 file.
|
|
|
Get the location of the image data in the source file.
|
|
|
Set the location of the image data in the source file.
|
|
|
Get the number of bands (components) in the PDS image.
|
|
|
Set the number of bands (components) in the PDS image.
|
|
|
Get the size of the source PDS image data.
|
|
|
Set the size of the source PDS image data.
|
|
|
Get the number of bytes per pixel.
|
|
|
Set the number of bytes per pixel. N.B.: If the number of pixel bytes is 1 the data will be set to unsigned.
|
|
|
Get the pixel precision.
|
|
|
Set the number of bits per pixel. The number of pixel bytes is enlarged, if necessary, to accommodate all the pixel bits. N.B.: If the number of pixel bits is less than the number of bits in the pixel bytes the data will be set to unsigned.
|
|
|
Get the signedness of the pixel data.
|
|
|
Set the signedness of the data. N.B.: If the number of pixel bytes is 1, or the number of pixel bits is less than the number of bits in the pixel bytes, then the data is unsigned by definition. In such cases the argument will be forced to false.
|
|
|
Test if the source data will be treated as MSB ordered.
|
|
|
Set the source data byte ordering. N.B.: The pixel byte swapping state is set by this method: If the host system is not high endian and the source data is MSB ordered, or the host system is high endian and the source data is LSB ordered, pixel byte swapping will be enabled; otherwise pixel byte swapping will be disabled.
|
|
|
Test if multi-byte pixels will be reordered before being sent to the JPEG2000 codestream generation machinery.
|
|
|
Set if multi-byte pixels will be reordered before being sent to the JPEG2000 codestream generation machinery.
|
|
|
Get the number of bytes preceeding each line of image pixel data.
|
|
|
Set the number of bytes preceeding each line of image pixel data.
|
|
|
Get the number of bytes following each line of image pixel data.
|
|
|
Set the number of bytes following each line of image pixel data.
|
|
|
Get the size of the JP2 image tiles.
|
|
|
Set the size of the JP2 image tiles. If the tile width is zero the width of the image will be use. If the tile height is zero height of the image will be used.
|
|
|
Get the total number of codestream resolution levels. N.B.: The number of resolution levels is one more than the number of JPEG2000 decomposition levels.
|
|
|
Set the total number of codestream resolution levels. N.B.: The number of resolution levels is one more than the number of JPEG2000 decomposition levels.
|
|
|
Get the codestream progression order descriptor.
|
|
|
Set the codestream progression order. The progression order is described by a string which specifies the order in which the JPEG2000 codestream is written. A JPEG2000 codestream has Position (image area), Component (image band), Resolution and Layer (quality) dimensions. The codestream progression order is specified as the first letters of each dimension in the order in which they are to be written; the first dimension specified varies the most slowly while the last dimension specified varies the most quickly. The default progression order is set at compile time by the value of the DEFAULT_PROGRESSION_ORDER symbol.
|
|
|
Get the precinct sizes for each resolution level.
|
|
|
Get the precinct size for a given resolution level.
|
|
|
Set the precinct sizes for each resolution level. Each precinct size dimension must be a non-zero power of two. If the number of precinct sizes is greater than the number of resolution levels the excess size values will be ignored. If the number of precinct sizes is less than the number of resolution levels the last size will be used for the sizes of all remaining resolution levels.
|
|
||||||||||||
|
Set the precinct size for a given resolution level.
|
|
|
Get the code block size.
|
|
|
Set the code block size.
|
|
|
Get the list of user specified data boxes added to the JP2 file.
|
|
|
Add a data box to the JP2 file. The box is placed on the list of user specified boxes that will be added to included in the JP2 file when it is written.
|
|
|
Remove a data box from the list of user specified boxes.
|
|
|
Get the product producer signature UUID value.
|
|
|
Set the product producer signature UUID value. The producer signature UUID value is intended to provide a unique identifier for the product. The UUID will be placed in a UUID List box inside a UUID Info box. N.B.: A producer signature will only be included in the JP2 file if a PDS label pathname has been specified.
|
|
|
Test if the encoder is ready to compress the image data.
|
|
|
Get a description of the reasons that the encoder is not ready.
|
|
|
Indicates what the encoder needs to do its job. The returned bit flag value will be zero if the encoder has all the required user-supplied information. Otherwise it will have one or more of the following bits set:
|
|
|
Get the JP2_Encoder_Error describing the last encoder error that occurred. The JP2_Encoder_Error contains a Message string data member describing the last error. This will be the empty string if no error has occurred.
|
|
|
Encode the image source to a JPEG2000 JP2 destination. This function is the main workhorse of the class. It is responsible for doing the actual work of generating a JP2 file. The destination JP2 file is opened. The JP2 metadata boxes are written to the file, including the required header boxes and any user boxes that have been added and the box to contain a producer signature UUID and PDS label filename URL if this has been specified. The source pixel data is written to a codestream box. The completed JP2 file is then closed.
|
|
|
Open the source JP2 file.
|
|
|
Write the required metadata boxes to the JP2 file.
|
|