diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-09-19 16:52:07 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-09-19 17:06:19 +0200 |
| commit | 7e2b6bebff12eab8bdc17fc9af017e8c11652f4f (patch) | |
| tree | 1f1456a4b3962862d3ab581e7b1b080919c53d34 /src/lib/openjp2/openjpeg.h | |
| parent | ce199f42e77f972d6ee782b63492f6d861891053 (diff) | |
Add capability to decode only a subset of all components of an image.
This adds a opj_set_decoded_components(opj_codec_t *p_codec,
OPJ_UINT32 numcomps, const OPJ_UINT32* comps_indices) function,
and equivalent "opj_decompress -c compno[,compno]*" option.
When specified, neither the MCT transform nor JP2 channel transformations
will be applied.
Tests added for various combinations of whole image vs tiled-based decoding,
full or reduced resolution, use of decode area or not.
Diffstat (limited to 'src/lib/openjp2/openjpeg.h')
| -rw-r--r-- | src/lib/openjp2/openjpeg.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h index 79e0bb4f..2888e4d1 100644 --- a/src/lib/openjp2/openjpeg.h +++ b/src/lib/openjp2/openjpeg.h @@ -1336,6 +1336,29 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_read_header(opj_stream_t *p_stream, opj_codec_t *p_codec, opj_image_t **p_image); + +/** Restrict the number of components to decode. + * + * This function should be called after opj_read_header(). + * + * Normally all the components are decoded. This call enables to restrict + * the set of decoded components to the specified indices. + * Note that neither the MCT transform nor JP2 channel transformatios will be applied. + * + * Note: opj_decode_tile_data() should not be used together with opj_set_decoded_components(). + * + * @param p_codec the jpeg2000 codec to read. + * @param numcomps Size of the comps_indices array. + * @param comps_indices Array of numcomps values representing the indices + * of the components to decode (relative to the + * codestream, starting at 0) + * + * @return OPJ_TRUE in case of success. + */ +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_set_decoded_components(opj_codec_t *p_codec, + OPJ_UINT32 numcomps, + const OPJ_UINT32* comps_indices); + /** * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. * @@ -1452,6 +1475,8 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_read_tile_header(opj_codec_t *p_codec, * Reads a tile data. This function is compulsory and allows one to decode tile data. opj_read_tile_header should be called before. * The user may need to refer to the image got by opj_read_header to understand the size being taken by the tile. * + * Note: opj_decode_tile_data() should not be used together with opj_set_decoded_components(). + * * @param p_codec the jpeg2000 codec. * @param p_tile_index the index of the tile being decoded, this should be the value set by opj_read_tile_header. * @param p_data pointer to a memory block that will hold the decoded data. |
