From fe085a631d7772e4ae459b013a03459eab1845fd Mon Sep 17 00:00:00 2001 From: Mickael Savinaud Date: Tue, 8 Nov 2011 13:13:05 +0000 Subject: [PATCH] [trunk] WIP: clean and enhance openjpeg.c --- CHANGES | 1 + libopenjpeg/openjpeg.c | 55 ++++++++---------------------------------- 2 files changed, 11 insertions(+), 45 deletions(-) diff --git a/CHANGES b/CHANGES index 24212cee..2c6831cf 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ What's New for OpenJPEG + : added November 8, 2011 ++ [mickael] WIP: clean and enhance openjpeg.c + [mickael] WIP: clean and enhance openjpeg.h and add deprecated macro October 25, 2011 diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c index 5caa139f..b1795f8f 100644 --- a/libopenjpeg/openjpeg.c +++ b/libopenjpeg/openjpeg.c @@ -38,12 +38,12 @@ typedef struct opj_decompression { /** Main header reading function handler*/ - opj_bool (* opj_read_header) ( struct opj_stream_private * cio, + opj_bool (*opj_read_header) ( struct opj_stream_private * cio, void * p_codec, opj_image_t **p_image, struct opj_event_mgr * p_manager); - /** FIXME DOC */ - opj_bool (* opj_decode) ( void * p_codec, + /** Decoding function */ + opj_bool (*opj_decode) ( void * p_codec, struct opj_stream_private *p_cio, opj_image_t *p_image, struct opj_event_mgr * p_manager); @@ -64,12 +64,12 @@ typedef struct opj_decompression OPJ_UINT32 p_data_size, struct opj_stream_private *p_cio, struct opj_event_mgr * p_manager); - /** FIXME DOC */ + /** Reading function used after codestream if necessary */ opj_bool (* opj_end_decompress) ( void *p_codec, struct opj_stream_private *cio, struct opj_event_mgr * p_manager); /** Codec destroy function handler*/ - void (* opj_destroy) (void * p_codec); + void (*opj_destroy) (void * p_codec); /** Setup decoder function handler */ void (*opj_setup_decoder) (void * p_codec, opj_dparameters_t * p_param); /** Set decode area function handler */ @@ -193,7 +193,7 @@ const char* OPJ_CALLCONV opj_version(void) { } - +/* DEPRECATED */ opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) { opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_calloc(1, sizeof(opj_dinfo_t)); if(!dinfo) return NULL; @@ -353,11 +353,10 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress_v2(OPJ_CODEC_FORMAT p_format) return 00; } - // FIXME set_default_event_handler(&(l_info->m_event_mgr)); return (opj_codec_t*) l_info; } - +/* DEPRECATED */ void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo) { if(dinfo) { /* destroy the codec */ @@ -398,6 +397,7 @@ void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *paramete } } +/* DEPRECATED */ void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) { if(dinfo && parameters) { switch(dinfo->codec_format) { @@ -441,10 +441,12 @@ opj_bool OPJ_CALLCONV opj_setup_decoder_v2(opj_codec_t *p_info, opj_dparameters_ return OPJ_TRUE; } +/* DEPRECATED */ opj_image_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) { return opj_decode_with_info(dinfo, cio, NULL); } +/* DEPRECATED */ opj_image_t* OPJ_CALLCONV opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *cio, opj_codestream_info_t *cstr_info) { if(dinfo && cio) { switch(dinfo->codec_format) { @@ -665,43 +667,6 @@ void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info) { } - -#ifdef OLD_WAY_MS -opj_bool OPJ_CALLCONV opj_read_header ( - opj_codec_t *p_codec, - opj_image_t ** p_image, - OPJ_INT32 * p_tile_x0, - OPJ_INT32 * p_tile_y0, - OPJ_UINT32 * p_tile_width, - OPJ_UINT32 * p_tile_height, - OPJ_UINT32 * p_nb_tiles_x, - OPJ_UINT32 * p_nb_tiles_y, - opj_stream_t *p_cio) -{ - if (p_codec && p_cio) { - opj_codec_private_t * l_info = (opj_codec_private_t *) p_codec; - opj_stream_private_t * l_cio = (opj_stream_private_t *) p_cio; - - if(! l_info->is_decompressor) { - return OPJ_FALSE; - } - - return l_info->m_codec_data.m_decompression.opj_read_header( - l_info->m_codec, - p_image, - p_tile_x0, - p_tile_y0, - p_tile_width, - p_tile_height, - p_nb_tiles_x, - p_nb_tiles_y, - l_cio, - l_info->m_event_mgr); //&(l_info->m_event_mgr)); - } - return OPJ_FALSE; -} -#endif - opj_bool OPJ_CALLCONV opj_read_header ( opj_stream_t *p_cio, opj_codec_t *p_codec, opj_image_t **p_image )