summaryrefslogtreecommitdiff
path: root/third_party/libopenjpeg20/openjpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libopenjpeg20/openjpeg.c')
-rw-r--r--third_party/libopenjpeg20/openjpeg.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/third_party/libopenjpeg20/openjpeg.c b/third_party/libopenjpeg20/openjpeg.c
index 4e649a74f3..7b12303423 100644
--- a/third_party/libopenjpeg20/openjpeg.c
+++ b/third_party/libopenjpeg20/openjpeg.c
@@ -245,6 +245,12 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
OPJ_UINT32 res_factor,
struct opj_event_mgr * p_manager)) opj_j2k_set_decoded_resolution_factor;
+ l_codec->m_codec_data.m_decompression.opj_set_decoded_components =
+ (OPJ_BOOL(*)(void * p_codec,
+ OPJ_UINT32 numcomps,
+ const OPJ_UINT32 * comps_indices,
+ struct opj_event_mgr * p_manager)) opj_j2k_set_decoded_components;
+
l_codec->opj_set_threads =
(OPJ_BOOL(*)(void * p_codec, OPJ_UINT32 num_threads)) opj_j2k_set_threads;
@@ -327,6 +333,12 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
OPJ_UINT32 res_factor,
opj_event_mgr_t * p_manager)) opj_jp2_set_decoded_resolution_factor;
+ l_codec->m_codec_data.m_decompression.opj_set_decoded_components =
+ (OPJ_BOOL(*)(void * p_codec,
+ OPJ_UINT32 numcomps,
+ const OPJ_UINT32 * comps_indices,
+ struct opj_event_mgr * p_manager)) opj_jp2_set_decoded_components;
+
l_codec->opj_set_threads =
(OPJ_BOOL(*)(void * p_codec, OPJ_UINT32 num_threads)) opj_jp2_set_threads;
@@ -426,6 +438,36 @@ OPJ_BOOL OPJ_CALLCONV opj_read_header(opj_stream_t *p_stream,
return OPJ_FALSE;
}
+
+OPJ_BOOL OPJ_CALLCONV opj_set_decoded_components(opj_codec_t *p_codec,
+ OPJ_UINT32 numcomps,
+ const OPJ_UINT32* comps_indices,
+ OPJ_BOOL apply_color_transforms)
+{
+ if (p_codec) {
+ opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec;
+
+ if (! l_codec->is_decompressor) {
+ opj_event_msg(&(l_codec->m_event_mgr), EVT_ERROR,
+ "Codec provided to the opj_set_decoded_components function is not a decompressor handler.\n");
+ return OPJ_FALSE;
+ }
+
+ if (apply_color_transforms) {
+ opj_event_msg(&(l_codec->m_event_mgr), EVT_ERROR,
+ "apply_color_transforms = OPJ_TRUE is not supported.\n");
+ return OPJ_FALSE;
+ }
+
+ return l_codec->m_codec_data.m_decompression.opj_set_decoded_components(
+ l_codec->m_codec,
+ numcomps,
+ comps_indices,
+ &(l_codec->m_event_mgr));
+ }
+ return OPJ_FALSE;
+}
+
OPJ_BOOL OPJ_CALLCONV opj_decode(opj_codec_t *p_codec,
opj_stream_t *p_stream,
opj_image_t* p_image)