summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/j2k.h
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-09-19 16:52:07 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-09-19 17:06:19 +0200
commit7e2b6bebff12eab8bdc17fc9af017e8c11652f4f (patch)
tree1f1456a4b3962862d3ab581e7b1b080919c53d34 /src/lib/openjp2/j2k.h
parentce199f42e77f972d6ee782b63492f6d861891053 (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/j2k.h')
-rw-r--r--src/lib/openjp2/j2k.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h
index c9308f7d..b5fa5143 100644
--- a/src/lib/openjp2/j2k.h
+++ b/src/lib/openjp2/j2k.h
@@ -480,6 +480,10 @@ typedef struct opj_j2k_dec {
* SOD reader function. FIXME NOT USED for the moment
*/
OPJ_BOOL m_last_tile_part;
+
+ OPJ_UINT32 m_numcomps_to_decode;
+ OPJ_UINT32 *m_comps_indices_to_decode;
+
/** to tell that a tile can be decoded. */
OPJ_BITFIELD m_can_decode : 1;
OPJ_BITFIELD m_discard_tiles : 1;
@@ -705,6 +709,21 @@ OPJ_BOOL opj_j2k_read_tile_header(opj_j2k_t * p_j2k,
opj_event_mgr_t * p_manager);
+/** Sets the indices of the components to decode.
+ *
+ * @param p_j2k the jpeg2000 codec.
+ * @param numcomps Number of components to decode.
+ * @param comps_indices Array of num_compts indices (numbering starting at 0)
+ * corresponding to the components to decode.
+ * @param p_manager Event manager
+ *
+ * @return OPJ_TRUE in case of success.
+ */
+OPJ_BOOL opj_j2k_set_decoded_components(opj_j2k_t *p_j2k,
+ OPJ_UINT32 numcomps,
+ const OPJ_UINT32* comps_indices,
+ opj_event_mgr_t * p_manager);
+
/**
* Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading.
*