[trunk] WIP: clean and enhance openjpeg.c

This commit is contained in:
Mickael Savinaud 2011-11-08 13:13:05 +00:00
parent c7489af844
commit fe085a631d
2 changed files with 11 additions and 45 deletions

View File

@ -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

View File

@ -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 )