[trunk] WIP: update jp2 dump functions with the new V2 framework
authorMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 7 Oct 2011 17:31:35 +0000 (17:31 +0000)
committerMickael Savinaud <savmickael@users.noreply.github.com>
Fri, 7 Oct 2011 17:31:35 +0000 (17:31 +0000)
CHANGES
libopenjpeg/jp2.c
libopenjpeg/jp2.h
libopenjpeg/openjpeg.c
tests/nonregression/CMakeLists.txt

diff --git a/CHANGES b/CHANGES
index 4ded77f3a76a1104bd47cb0f572c7ca993333c91..dec64d315a71af3781a15c43d603af62550009d3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,7 @@ What's New for OpenJPEG
 + : added
 
 October 07, 2011
++ [mickael] WIP: update jp2 dump functions with the new V2 framework
 + [mickael] WIP: update output filename of conformance dump test to be compatible with new baseline
 * [mickael] WIP: correct wrong input in dump_codec function and add missing return value
 * [mickael] WIP: correct mistake inside set_decoded_area function (credit to Francois De Vieilleville)
index 840b3b867da8426d14b263b3b94e9c7c281be193..618f9ab4767339053bdb334266df75a2e580f156 100644 (file)
@@ -2441,7 +2441,7 @@ opj_bool jp2_read_header( struct opj_stream_private *p_stream,
                                                        struct opj_event_mgr * p_manager
                                                        )
 {
-       // preconditions
+       /* preconditions */
        assert(jp2 != 00);
        assert(p_stream != 00);
        assert(p_manager != 00);
@@ -2648,3 +2648,24 @@ opj_jp2_v2_t* jp2_create(opj_bool p_is_decoder)
 
        return jp2;
 }
+
+void jp2_dump(opj_jp2_v2_t* p_jp2, OPJ_INT32 flag, FILE* out_stream)
+{
+       /* preconditions */
+       assert(p_jp2 != 00);
+
+       j2k_dump(p_jp2->j2k,
+                                       flag,
+                                       out_stream);
+}
+
+opj_codestream_index_t* jp2_get_cstr_index(opj_jp2_v2_t* p_jp2)
+{
+       return j2k_get_cstr_index(p_jp2->j2k);
+}
+
+opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2)
+{
+       return j2k_get_cstr_info(p_jp2->j2k);
+}
+
index 22669b92dc1809bfb16831cdcdd8707709d9f4f2..58cd51c3e7431180c1f65150202af5d880440fb2 100644 (file)
@@ -421,6 +421,35 @@ opj_bool jp2_set_decode_area(
                        struct opj_event_mgr * p_manager
                        );
 
+
+/**
+ * Dump some elements from the JP2 decompression structure .
+ *
+ *@param p_jp2                         the jp2 codec.
+ *@param flag                          flag to describe what elments are dump.
+ *@param out_stream                    output stream where dump the elements.
+ *
+*/
+void jp2_dump (opj_jp2_v2_t* p_jp2, OPJ_INT32 flag, FILE* out_stream);
+
+/**
+ * Get the codestream info from a JPEG2000 codec.
+ *
+ *@param       p_jp2                           jp2 codec.
+ *
+ *@return      the codestream information extract from the jpg2000 codec
+ */
+opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2);
+
+/**
+ * Get the codestream index from a JPEG2000 codec.
+ *
+ *@param       p_jp2                           jp2 codec.
+ *
+ *@return      the codestream index extract from the jpg2000 codec
+ */
+opj_codestream_index_t* jp2_get_cstr_index(opj_jp2_v2_t* p_jp2);
+
 /*@}*/
 
 /*@}*/
index 32b6d544cfe22d64edf488c1b2b8f7c82498edde..bec5f225a342af205867c2ff3fb07677ff2565da 100644 (file)
@@ -109,7 +109,7 @@ typedef struct opj_codec_private
        opj_event_mgr_t* m_event_mgr;
        /** Flag to indicate if the codec is used to decode or encode*/
        opj_bool is_decompressor;
-       opj_bool (*opj_dump_codec) (void * p_codec, OPJ_INT32 info_flag, FILE* output_stream);
+       void (*opj_dump_codec) (void * p_codec, OPJ_INT32 info_flag, FILE* output_stream);
        opj_codestream_info_v2_t* (*opj_get_codec_info)(void* p_codec);
        opj_codestream_index_t* (*opj_get_codec_index)(void* p_codec);
 }
@@ -229,7 +229,7 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress_v2(OPJ_CODEC_FORMAT p_format)
 
        switch (p_format) {
                case CODEC_J2K:
-                       l_info->opj_dump_codec = (opj_bool (*) (void*, OPJ_INT32, FILE*)) j2k_dump;
+                       l_info->opj_dump_codec = (void (*) (void*, OPJ_INT32, FILE*)) j2k_dump;
 
                        l_info->opj_get_codec_info = (opj_codestream_info_v2_t* (*) (void*) ) j2k_get_cstr_info;
 
@@ -285,6 +285,12 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress_v2(OPJ_CODEC_FORMAT p_format)
 
                case CODEC_JP2:
                        /* get a JP2 decoder handle */
+                       l_info->opj_dump_codec = (void (*) (void*, OPJ_INT32, FILE*)) jp2_dump;
+
+                       l_info->opj_get_codec_info = (opj_codestream_info_v2_t* (*) (void*) ) jp2_get_cstr_info;
+
+                       l_info->opj_get_codec_index = (opj_codestream_index_t* (*) (void*) ) jp2_get_cstr_index;
+
                        l_info->m_codec_data.m_decompression.opj_decode =
                                        (opj_bool (*) ( void *,
                                                                        struct opj_stream_private *,
index 1229e74fe4501980fea0fc25d0c2841a5a10dece..3e97304ad1d950f5f80e1eac775d1c7dd6f8314f 100644 (file)
@@ -281,7 +281,7 @@ FOREACH(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
         # Compare the dump output with the baseline
         ADD_TEST(NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-compare_dump2base
           ${EXECUTABLE_OUTPUT_PATH}/compare_dump_files
-         -b ${BASELINE_NR}/opj_${INPUT_FILENAME_NAME_WE}.txt
+         -b ${BASELINE_NR}/opj_v2_${INPUT_FILENAME_NAME_WE}.txt
          -t ${TEMP}/${INPUT_FILENAME_NAME}.txt
         )