summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/tcd.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/tcd.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/tcd.h')
-rw-r--r--src/lib/openjp2/tcd.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/openjp2/tcd.h b/src/lib/openjp2/tcd.h
index 63c22c45..e3214c1d 100644
--- a/src/lib/openjp2/tcd.h
+++ b/src/lib/openjp2/tcd.h
@@ -280,6 +280,8 @@ typedef struct opj_tcd {
OPJ_UINT32 win_y1;
/** Only valid for decoding. Whether the whole tile is decoded, or just the region in win_x0/win_y0/win_x1/win_y1 */
OPJ_BOOL whole_tile_decoding;
+ /* Array of size image->numcomps indicating if a component must be decoded. NULL if all components must be decoded */
+ OPJ_BOOL* used_component;
} opj_tcd_t;
/** @name Exported functions */
@@ -381,6 +383,10 @@ Decode a tile from a buffer into a raw image
@param win_y0 Upper left y of region to decode (in grid coordinates)
@param win_x1 Lower right x of region to decode (in grid coordinates)
@param win_y1 Lower right y of region to decode (in grid coordinates)
+@param numcomps_to_decode Size of the comps_indices array, or 0 if decoding all components.
+@param comps_indices Array of numcomps values representing the indices
+ of the components to decode (relative to the
+ codestream, starting at 0). Or NULL if decoding all components.
@param src Source buffer
@param len Length of source buffer
@param tileno Number that identifies one of the tiles to be decoded
@@ -392,6 +398,8 @@ OPJ_BOOL opj_tcd_decode_tile(opj_tcd_t *tcd,
OPJ_UINT32 win_y0,
OPJ_UINT32 win_x1,
OPJ_UINT32 win_y1,
+ OPJ_UINT32 numcomps_to_decode,
+ const OPJ_UINT32 *comps_indices,
OPJ_BYTE *src,
OPJ_UINT32 len,
OPJ_UINT32 tileno,