rename jp2 functions with V2 style and opj_ prefix

This commit is contained in:
Mickael Savinaud 2012-08-13 09:24:15 +00:00
parent 3ec9f5fa0b
commit dd86b85664
3 changed files with 183 additions and 169 deletions

View File

@ -1337,9 +1337,10 @@ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2,
* *
* @return true if writting was successful. * @return true if writting was successful.
*/ */
opj_bool jp2_write_jp2h_v2( opj_jp2_v2_t *jp2, opj_bool opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
opj_stream_private_t *cio, opj_stream_private_t *stream,
opj_event_mgr_t * p_manager ) opj_event_mgr_t * p_manager
)
{ {
opj_jp2_img_header_writer_handler_t l_writers [3]; opj_jp2_img_header_writer_handler_t l_writers [3];
opj_jp2_img_header_writer_handler_t * l_current_writer; opj_jp2_img_header_writer_handler_t * l_current_writer;
@ -1353,7 +1354,7 @@ opj_bool jp2_write_jp2h_v2( opj_jp2_v2_t *jp2,
unsigned char l_jp2h_data [8]; unsigned char l_jp2h_data [8];
// preconditions // preconditions
assert(cio != 00); assert(stream != 00);
assert(jp2 != 00); assert(jp2 != 00);
assert(p_manager != 00); assert(p_manager != 00);
@ -1404,7 +1405,7 @@ opj_bool jp2_write_jp2h_v2( opj_jp2_v2_t *jp2,
opj_write_bytes(l_jp2h_data,l_jp2h_size,4); opj_write_bytes(l_jp2h_data,l_jp2h_size,4);
/* write super box data on stream */ /* write super box data on stream */
if (opj_stream_write_data(cio,l_jp2h_data,8,p_manager) != 8) { if (opj_stream_write_data(stream,l_jp2h_data,8,p_manager) != 8) {
opj_event_msg_v2(p_manager, EVT_ERROR, "Stream error while writing JP2 Header box\n"); opj_event_msg_v2(p_manager, EVT_ERROR, "Stream error while writing JP2 Header box\n");
l_result = OPJ_FALSE; l_result = OPJ_FALSE;
} }
@ -1412,7 +1413,7 @@ opj_bool jp2_write_jp2h_v2( opj_jp2_v2_t *jp2,
if (l_result) { if (l_result) {
l_current_writer = l_writers; l_current_writer = l_writers;
for (i=0;i<l_nb_pass;++i) { for (i=0;i<l_nb_pass;++i) {
if (opj_stream_write_data(cio,l_current_writer->m_data,l_current_writer->m_size,p_manager) != l_current_writer->m_size) { if (opj_stream_write_data(stream,l_current_writer->m_data,l_current_writer->m_size,p_manager) != l_current_writer->m_size) {
opj_event_msg_v2(p_manager, EVT_ERROR, "Stream error while writting JP2 Header box\n"); opj_event_msg_v2(p_manager, EVT_ERROR, "Stream error while writting JP2 Header box\n");
l_result = OPJ_FALSE; l_result = OPJ_FALSE;
break; break;
@ -1720,7 +1721,7 @@ void opj_jp2_setup_decoder(opj_jp2_v2_t *jp2, opj_dparameters_t *parameters)
/* JP2 encoder interface */ /* JP2 encoder interface */
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
void jp2_setup_encoder( opj_jp2_v2_t *jp2, void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2,
opj_cparameters_t *parameters, opj_cparameters_t *parameters,
opj_image_t *image, opj_image_t *image,
opj_event_mgr_t * p_manager) opj_event_mgr_t * p_manager)
@ -1801,7 +1802,7 @@ void jp2_setup_encoder( opj_jp2_v2_t *jp2,
} }
opj_bool opj_jp2_encode_v2( opj_jp2_v2_t *jp2, opj_bool opj_jp2_encode(opj_jp2_v2_t *jp2,
opj_stream_private_t *stream, opj_stream_private_t *stream,
opj_event_mgr_t * p_manager) opj_event_mgr_t * p_manager)
{ {
@ -1813,7 +1814,10 @@ opj_bool opj_jp2_encode_v2( opj_jp2_v2_t *jp2,
* Ends the decompression procedures and possibiliy add data to be read after the * Ends the decompression procedures and possibiliy add data to be read after the
* codestream. * codestream.
*/ */
opj_bool jp2_end_decompress(opj_jp2_v2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t * p_manager) opj_bool opj_jp2_end_decompress(opj_jp2_v2_t *jp2,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager
)
{ {
/* preconditions */ /* preconditions */
assert(jp2 != 00); assert(jp2 != 00);
@ -1835,9 +1839,10 @@ opj_bool jp2_end_decompress(opj_jp2_v2_t *jp2, opj_stream_private_t *cio, opj_ev
* Ends the compression procedures and possibility add data to be read after the * Ends the compression procedures and possibility add data to be read after the
* codestream. * codestream.
*/ */
opj_bool jp2_end_compress( opj_jp2_v2_t *jp2, opj_bool opj_jp2_end_compress( opj_jp2_v2_t *jp2,
opj_stream_private_t *cio, opj_stream_private_t *cio,
opj_event_mgr_t * p_manager) opj_event_mgr_t * p_manager
)
{ {
/* preconditions */ /* preconditions */
assert(jp2 != 00); assert(jp2 != 00);
@ -2086,21 +2091,22 @@ static opj_bool opj_jp2_exec ( opj_jp2_v2_t * jp2,
* *
* @return true if the codec is valid. * @return true if the codec is valid.
*/ */
opj_bool jp2_start_compress(opj_jp2_v2_t *jp2, opj_bool opj_jp2_start_compress(opj_jp2_v2_t *jp2,
struct opj_stream_private *cio, opj_stream_private_t *stream,
opj_image_t * p_image, opj_image_t * p_image,
struct opj_event_mgr * p_manager) opj_event_mgr_t * p_manager
)
{ {
/* preconditions */ /* preconditions */
assert(jp2 != 00); assert(jp2 != 00);
assert(cio != 00); assert(stream != 00);
assert(p_manager != 00); assert(p_manager != 00);
/* customization of the validation */ /* customization of the validation */
jp2_setup_encoding_validation (jp2); jp2_setup_encoding_validation (jp2);
/* validation of the parameters codec */ /* validation of the parameters codec */
if (! opj_jp2_exec(jp2,jp2->m_validation_list,cio,p_manager)) { if (! opj_jp2_exec(jp2,jp2->m_validation_list,stream,p_manager)) {
return OPJ_FALSE; return OPJ_FALSE;
} }
@ -2108,11 +2114,11 @@ opj_bool jp2_start_compress(opj_jp2_v2_t *jp2,
jp2_setup_header_writting(jp2); jp2_setup_header_writting(jp2);
/* write header */ /* write header */
if (! opj_jp2_exec (jp2,jp2->m_procedure_list,cio,p_manager)) { if (! opj_jp2_exec (jp2,jp2->m_procedure_list,stream,p_manager)) {
return OPJ_FALSE; return OPJ_FALSE;
} }
return j2k_start_compress(jp2->j2k,cio,p_image,p_manager); return j2k_start_compress(jp2->j2k,stream,p_image,p_manager);
} }
/** /**
@ -2455,10 +2461,10 @@ opj_bool opj_jp2_read_boxhdr_char( opj_jp2_box_t *box,
* *
* @return true if the box is valid. * @return true if the box is valid.
*/ */
opj_bool jp2_read_header( struct opj_stream_private *p_stream, opj_bool opj_jp2_read_header( opj_stream_private_t *p_stream,
opj_jp2_v2_t *jp2, opj_jp2_v2_t *jp2,
opj_image_t** p_image, opj_image_t ** p_image,
struct opj_event_mgr * p_manager opj_event_mgr_t * p_manager
) )
{ {
/* preconditions */ /* preconditions */
@ -2523,7 +2529,7 @@ void jp2_setup_header_writting (opj_jp2_v2_t *jp2)
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)jp2_write_jp_v2 ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)jp2_write_jp_v2 );
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)jp2_write_ftyp_v2 ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)jp2_write_ftyp_v2 );
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)jp2_write_jp2h_v2 ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_jp2h );
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)jp2_skip_jp2c ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)jp2_skip_jp2c );
/* DEVELOPER CORNER, insert your custom procedures */ /* DEVELOPER CORNER, insert your custom procedures */
@ -2550,15 +2556,18 @@ void opj_jp2_setup_header_reading (opj_jp2_v2_t *jp2)
* @param p_stream the stream to write data to. * @param p_stream the stream to write data to.
* @param p_manager the user event manager. * @param p_manager the user event manager.
*/ */
opj_bool jp2_read_tile_header( opj_jp2_v2_t * p_jp2, opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2,
OPJ_UINT32 * p_tile_index, OPJ_UINT32 * p_tile_index,
OPJ_UINT32 * p_data_size, OPJ_UINT32 * p_data_size,
OPJ_INT32 * p_tile_x0, OPJ_INT32 * p_tile_y0, OPJ_INT32 * p_tile_x0,
OPJ_INT32 * p_tile_x1, OPJ_INT32 * p_tile_y1, OPJ_INT32 * p_tile_y0,
OPJ_INT32 * p_tile_x1,
OPJ_INT32 * p_tile_y1,
OPJ_UINT32 * p_nb_comps, OPJ_UINT32 * p_nb_comps,
opj_bool * p_go_on, opj_bool * p_go_on,
opj_stream_private_t *p_stream, opj_stream_private_t *p_stream,
opj_event_mgr_t * p_manager ) opj_event_mgr_t * p_manager
)
{ {
return j2k_read_tile_header(p_jp2->j2k, return j2k_read_tile_header(p_jp2->j2k,
p_tile_index, p_tile_index,
@ -2577,12 +2586,14 @@ opj_bool jp2_read_tile_header( opj_jp2_v2_t * p_jp2,
* @param p_stream the stream to write data to. * @param p_stream the stream to write data to.
* @param p_manager the user event manager. * @param p_manager the user event manager.
*/ */
opj_bool jp2_write_tile ( opj_jp2_v2_t *p_jp2, opj_bool opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2,
OPJ_UINT32 p_tile_index, OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data, OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size, OPJ_UINT32 p_data_size,
struct opj_stream_private *p_stream, opj_stream_private_t *p_stream,
struct opj_event_mgr * p_manager ) opj_event_mgr_t * p_manager
)
{ {
return j2k_write_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager); return j2k_write_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager);
} }
@ -2593,8 +2604,7 @@ opj_bool jp2_write_tile ( opj_jp2_v2_t *p_jp2,
* @param p_stream the stream to write data to. * @param p_stream the stream to write data to.
* @param p_manager the user event manager. * @param p_manager the user event manager.
*/ */
opj_bool jp2_decode_tile ( opj_bool opj_jp2_decode_tile ( opj_jp2_v2_t * p_jp2,
opj_jp2_v2_t * p_jp2,
OPJ_UINT32 p_tile_index, OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data, OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size, OPJ_UINT32 p_data_size,
@ -2610,7 +2620,7 @@ opj_bool jp2_decode_tile (
* *
* @param jp2 a jpeg2000 file decompressor. * @param jp2 a jpeg2000 file decompressor.
*/ */
void jp2_destroy(opj_jp2_v2_t *jp2) void opj_jp2_destroy(opj_jp2_v2_t *jp2)
{ {
if (jp2) { if (jp2) {
/* destroy the J2K codec */ /* destroy the J2K codec */
@ -2689,11 +2699,12 @@ void jp2_destroy(opj_jp2_v2_t *jp2)
* *
* @return true if the area could be set. * @return true if the area could be set.
*/ */
opj_bool jp2_set_decode_area( opj_jp2_v2_t *p_jp2, opj_bool opj_jp2_set_decode_area( opj_jp2_v2_t *p_jp2,
opj_image_t* p_image, opj_image_t* p_image,
OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, OPJ_INT32 p_start_x, OPJ_INT32 p_start_y,
OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, OPJ_INT32 p_end_x, OPJ_INT32 p_end_y,
struct opj_event_mgr * p_manager ) opj_event_mgr_t * p_manager
)
{ {
return j2k_set_decode_area(p_jp2->j2k, p_image, p_start_x, p_start_y, p_end_x, p_end_y, p_manager); return j2k_set_decode_area(p_jp2->j2k, p_image, p_start_x, p_start_y, p_end_x, p_end_y, p_manager);
} }
@ -2709,49 +2720,50 @@ opj_bool jp2_set_decode_area( opj_jp2_v2_t *p_jp2,
* *
* @return true if succeed. * @return true if succeed.
*/ */
opj_bool jp2_get_tile( opj_jp2_v2_t *jp2, opj_bool opj_jp2_get_tile( opj_jp2_v2_t *p_jp2,
opj_stream_private_t *p_stream, opj_stream_private_t *p_stream,
opj_image_t* p_image, opj_image_t* p_image,
struct opj_event_mgr * p_manager, opj_event_mgr_t * p_manager,
OPJ_UINT32 tile_index ) OPJ_UINT32 tile_index
)
{ {
if (!p_image) if (!p_image)
return OPJ_FALSE; return OPJ_FALSE;
opj_event_msg_v2(p_manager, EVT_WARNING, "JP2 box which are after the codestream will not be read by this function.\n"); opj_event_msg_v2(p_manager, EVT_WARNING, "JP2 box which are after the codestream will not be read by this function.\n");
if (! j2k_get_tile(jp2->j2k, p_stream, p_image, p_manager, tile_index) ){ if (! j2k_get_tile(p_jp2->j2k, p_stream, p_image, p_manager, tile_index) ){
opj_event_msg_v2(p_manager, EVT_ERROR, "Failed to decode the codestream in the JP2 file\n"); opj_event_msg_v2(p_manager, EVT_ERROR, "Failed to decode the codestream in the JP2 file\n");
return OPJ_FALSE; return OPJ_FALSE;
} }
/* Set Image Color Space */ /* Set Image Color Space */
if (jp2->enumcs == 16) if (p_jp2->enumcs == 16)
p_image->color_space = CLRSPC_SRGB; p_image->color_space = CLRSPC_SRGB;
else if (jp2->enumcs == 17) else if (p_jp2->enumcs == 17)
p_image->color_space = CLRSPC_GRAY; p_image->color_space = CLRSPC_GRAY;
else if (jp2->enumcs == 18) else if (p_jp2->enumcs == 18)
p_image->color_space = CLRSPC_SYCC; p_image->color_space = CLRSPC_SYCC;
else else
p_image->color_space = CLRSPC_UNKNOWN; p_image->color_space = CLRSPC_UNKNOWN;
/* Apply the color space if needed */ /* Apply the color space if needed */
if(jp2->color.jp2_cdef) { if(p_jp2->color.jp2_cdef) {
jp2_apply_cdef(p_image, &(jp2->color)); jp2_apply_cdef(p_image, &(p_jp2->color));
} }
if(jp2->color.jp2_pclr) { if(p_jp2->color.jp2_pclr) {
/* Part 1, I.5.3.4: Either both or none : */ /* Part 1, I.5.3.4: Either both or none : */
if( !jp2->color.jp2_pclr->cmap) if( !p_jp2->color.jp2_pclr->cmap)
jp2_free_pclr(&(jp2->color)); jp2_free_pclr(&(p_jp2->color));
else else
jp2_apply_pclr(p_image, &(jp2->color)); jp2_apply_pclr(p_image, &(p_jp2->color));
} }
if(jp2->color.icc_profile_buf) { if(p_jp2->color.icc_profile_buf) {
p_image->icc_profile_buf = jp2->color.icc_profile_buf; p_image->icc_profile_buf = p_jp2->color.icc_profile_buf;
p_image->icc_profile_len = jp2->color.icc_profile_len; p_image->icc_profile_len = p_jp2->color.icc_profile_len;
jp2->color.icc_profile_buf = NULL; p_jp2->color.icc_profile_buf = NULL;
} }
return OPJ_TRUE; return OPJ_TRUE;
@ -2763,7 +2775,7 @@ opj_bool jp2_get_tile( opj_jp2_v2_t *jp2,
/* JP2 encoder interface */ /* JP2 encoder interface */
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
opj_jp2_v2_t* jp2_create(opj_bool p_is_decoder) opj_jp2_v2_t* opj_jp2_create(opj_bool p_is_decoder)
{ {
opj_jp2_v2_t *jp2 = (opj_jp2_v2_t*)opj_malloc(sizeof(opj_jp2_v2_t)); opj_jp2_v2_t *jp2 = (opj_jp2_v2_t*)opj_malloc(sizeof(opj_jp2_v2_t));
if (jp2) { if (jp2) {
@ -2778,7 +2790,7 @@ opj_jp2_v2_t* jp2_create(opj_bool p_is_decoder)
} }
if (jp2->j2k == 00) { if (jp2->j2k == 00) {
jp2_destroy(jp2); opj_jp2_destroy(jp2);
return 00; return 00;
} }
@ -2792,14 +2804,14 @@ opj_jp2_v2_t* jp2_create(opj_bool p_is_decoder)
/* validation list creation */ /* validation list creation */
jp2->m_validation_list = opj_procedure_list_create(); jp2->m_validation_list = opj_procedure_list_create();
if (! jp2->m_validation_list) { if (! jp2->m_validation_list) {
jp2_destroy(jp2); opj_jp2_destroy(jp2);
return 00; return 00;
} }
/* execution list creation */ /* execution list creation */
jp2->m_procedure_list = opj_procedure_list_create(); jp2->m_procedure_list = opj_procedure_list_create();
if (! jp2->m_procedure_list) { if (! jp2->m_procedure_list) {
jp2_destroy(jp2); opj_jp2_destroy(jp2);
return 00; return 00;
} }
} }
@ -2827,7 +2839,9 @@ opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2)
return j2k_get_cstr_info(p_jp2->j2k); return j2k_get_cstr_info(p_jp2->j2k);
} }
opj_bool jp2_set_decoded_resolution_factor(opj_jp2_v2_t *p_jp2, OPJ_UINT32 res_factor, opj_event_mgr_t * p_manager) opj_bool opj_jp2_set_decoded_resolution_factor(opj_jp2_v2_t *p_jp2,
OPJ_UINT32 res_factor,
opj_event_mgr_t * p_manager)
{ {
return j2k_set_decoded_resolution_factor(p_jp2->j2k, res_factor, p_manager); return j2k_set_decoded_resolution_factor(p_jp2->j2k, res_factor, p_manager);
} }

View File

@ -239,11 +239,11 @@ opj_jp2_header_handler_t;
typedef struct opj_jp2_img_header_writer_handler typedef struct opj_jp2_img_header_writer_handler
{ {
/* action to perform */ /* action to perform */
unsigned char* (*handler) (opj_jp2_v2_t *jp2, unsigned int * p_data_size); OPJ_BYTE* (*handler) (opj_jp2_v2_t *jp2, OPJ_UINT32 * p_data_size);
/* result of the action : data */ /* result of the action : data */
unsigned char * m_data; OPJ_BYTE* m_data;
/* size of data */ /* size of data */
unsigned int m_size; OPJ_UINT32 m_size;
} }
opj_jp2_img_header_writer_handler_t; opj_jp2_img_header_writer_handler_t;
@ -260,10 +260,9 @@ opj_jp2_img_header_writer_handler_t;
* *
* @return true if writting was successful. * @return true if writting was successful.
*/ */
opj_bool jp2_write_jp2h_v2( opj_jp2_v2_t *jp2, opj_bool opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
struct opj_stream_private *cio, opj_stream_private_t *stream,
struct opj_event_mgr * p_manager ); opj_event_mgr_t * p_manager );
/** /**
Setup the decoder decoding parameters using user parameters. Setup the decoder decoding parameters using user parameters.
@ -285,8 +284,6 @@ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2,
opj_image_t* p_image, opj_image_t* p_image,
opj_event_mgr_t * p_manager); opj_event_mgr_t * p_manager);
/** /**
Setup the encoder parameters using the current image and using user parameters. Setup the encoder parameters using the current image and using user parameters.
Coding parameters are returned in jp2->j2k->cp. Coding parameters are returned in jp2->j2k->cp.
@ -294,10 +291,10 @@ Coding parameters are returned in jp2->j2k->cp.
@param parameters compression parameters @param parameters compression parameters
@param image input filled image @param image input filled image
*/ */
void jp2_setup_encoder( opj_jp2_v2_t *jp2, void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2,
opj_cparameters_t *parameters, opj_cparameters_t *parameters,
opj_image_t *image, opj_image_t *image,
struct opj_event_mgr * p_manager); opj_event_mgr_t * p_manager);
/** /**
Encode an image into a JPEG-2000 file stream Encode an image into a JPEG-2000 file stream
@ -306,7 +303,7 @@ Encode an image into a JPEG-2000 file stream
@param p_manager event manager @param p_manager event manager
@return Returns true if successful, returns false otherwise @return Returns true if successful, returns false otherwise
*/ */
opj_bool opj_jp2_encode_v2( opj_jp2_v2_t *jp2, opj_bool opj_jp2_encode( opj_jp2_v2_t *jp2,
opj_stream_private_t *stream, opj_stream_private_t *stream,
opj_event_mgr_t * p_manager); opj_event_mgr_t * p_manager);
@ -319,19 +316,19 @@ opj_bool opj_jp2_encode_v2( opj_jp2_v2_t *jp2,
* *
* @return true if the codec is valid. * @return true if the codec is valid.
*/ */
opj_bool jp2_start_compress(opj_jp2_v2_t *jp2, opj_bool opj_jp2_start_compress(opj_jp2_v2_t *jp2,
struct opj_stream_private *cio, opj_stream_private_t *stream,
struct opj_image * p_image, opj_image_t * p_image,
struct opj_event_mgr * p_manager); opj_event_mgr_t * p_manager);
/** /**
* Ends the compression procedures and possibiliy add data to be read after the * Ends the compression procedures and possibiliy add data to be read after the
* codestream. * codestream.
*/ */
opj_bool jp2_end_compress( opj_jp2_v2_t *jp2, opj_bool opj_jp2_end_compress( opj_jp2_v2_t *jp2,
struct opj_stream_private *cio, opj_stream_private_t *cio,
struct opj_event_mgr * p_manager); opj_event_mgr_t * p_manager);
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
@ -339,7 +336,9 @@ opj_bool jp2_end_compress( opj_jp2_v2_t *jp2,
* Ends the decompression procedures and possibiliy add data to be read after the * Ends the decompression procedures and possibiliy add data to be read after the
* codestream. * codestream.
*/ */
opj_bool jp2_end_decompress(opj_jp2_v2_t *jp2, struct opj_stream_private *cio, struct opj_event_mgr * p_manager); opj_bool opj_jp2_end_decompress(opj_jp2_v2_t *jp2,
opj_stream_private_t *cio,
opj_event_mgr_t * p_manager);
/** /**
* Reads a jpeg2000 file header structure. * Reads a jpeg2000 file header structure.
@ -350,11 +349,10 @@ opj_bool jp2_end_decompress(opj_jp2_v2_t *jp2, struct opj_stream_private *cio, s
* *
* @return true if the box is valid. * @return true if the box is valid.
*/ */
opj_bool jp2_read_header( struct opj_stream_private *p_stream, opj_bool opj_jp2_read_header( opj_stream_private_t *p_stream,
opj_jp2_v2_t *jp2, opj_jp2_v2_t *jp2,
opj_image_t ** p_img_header, opj_image_t ** p_image,
struct opj_event_mgr * p_manager opj_event_mgr_t * p_manager );
);
/** /**
* Reads a tile header. * Reads a tile header.
@ -362,8 +360,7 @@ opj_bool jp2_read_header( struct opj_stream_private *p_stream,
* @param p_stream the stream to write data to. * @param p_stream the stream to write data to.
* @param p_manager the user event manager. * @param p_manager the user event manager.
*/ */
opj_bool jp2_read_tile_header ( opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2,
opj_jp2_v2_t * p_j2k,
OPJ_UINT32 * p_tile_index, OPJ_UINT32 * p_tile_index,
OPJ_UINT32 * p_data_size, OPJ_UINT32 * p_data_size,
OPJ_INT32 * p_tile_x0, OPJ_INT32 * p_tile_x0,
@ -372,11 +369,8 @@ opj_bool jp2_read_tile_header (
OPJ_INT32 * p_tile_y1, OPJ_INT32 * p_tile_y1,
OPJ_UINT32 * p_nb_comps, OPJ_UINT32 * p_nb_comps,
opj_bool * p_go_on, opj_bool * p_go_on,
struct opj_stream_private *p_stream, opj_stream_private_t *p_stream,
struct opj_event_mgr * p_manager opj_event_mgr_t * p_manager );
);
/** /**
* Writes a tile. * Writes a tile.
@ -384,12 +378,12 @@ opj_bool jp2_read_tile_header (
* @param p_stream the stream to write data to. * @param p_stream the stream to write data to.
* @param p_manager the user event manager. * @param p_manager the user event manager.
*/ */
opj_bool jp2_write_tile ( opj_jp2_v2_t *p_jp2, opj_bool opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2,
OPJ_UINT32 p_tile_index, OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data, OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size, OPJ_UINT32 p_data_size,
struct opj_stream_private *p_stream, opj_stream_private_t *p_stream,
struct opj_event_mgr * p_manager ); opj_event_mgr_t * p_manager );
/** /**
* Decode tile data. * Decode tile data.
@ -397,27 +391,25 @@ opj_bool jp2_write_tile ( opj_jp2_v2_t *p_jp2,
* @param p_stream the stream to write data to. * @param p_stream the stream to write data to.
* @param p_manager the user event manager. * @param p_manager the user event manager.
*/ */
opj_bool jp2_decode_tile ( opj_bool opj_jp2_decode_tile ( opj_jp2_v2_t * p_jp2,
opj_jp2_v2_t * p_jp2,
OPJ_UINT32 p_tile_index, OPJ_UINT32 p_tile_index,
OPJ_BYTE * p_data, OPJ_BYTE * p_data,
OPJ_UINT32 p_data_size, OPJ_UINT32 p_data_size,
struct opj_stream_private *p_stream, opj_stream_private_t *p_stream,
struct opj_event_mgr * p_manager opj_event_mgr_t * p_manager );
);
/** /**
* Creates a jpeg2000 file decompressor. * Creates a jpeg2000 file decompressor.
* *
* @return an empty jpeg2000 file codec. * @return an empty jpeg2000 file codec.
*/ */
opj_jp2_v2_t* jp2_create (opj_bool p_is_decoder); opj_jp2_v2_t* opj_jp2_create (opj_bool p_is_decoder);
/** /**
Destroy a JP2 decompressor handle Destroy a JP2 decompressor handle
@param jp2 JP2 decompressor handle to destroy @param jp2 JP2 decompressor handle to destroy
*/ */
void jp2_destroy(opj_jp2_v2_t *jp2); void opj_jp2_destroy(opj_jp2_v2_t *jp2);
/** /**
@ -431,22 +423,31 @@ void jp2_destroy(opj_jp2_v2_t *jp2);
* *
* @return true if the area could be set. * @return true if the area could be set.
*/ */
opj_bool jp2_set_decode_area( opj_jp2_v2_t *p_jp2, opj_bool opj_jp2_set_decode_area( opj_jp2_v2_t *p_jp2,
opj_image_t* p_image, opj_image_t* p_image,
OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, OPJ_INT32 p_start_x, OPJ_INT32 p_start_y,
OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, OPJ_INT32 p_end_x, OPJ_INT32 p_end_y,
struct opj_event_mgr * p_manager ); opj_event_mgr_t * p_manager );
/** /**
* *
*/ */
opj_bool jp2_get_tile( opj_jp2_v2_t *p_jp2, opj_bool opj_jp2_get_tile( opj_jp2_v2_t *p_jp2,
opj_stream_private_t *p_stream, opj_stream_private_t *p_stream,
opj_image_t* p_image, opj_image_t* p_image,
struct opj_event_mgr * p_manager, opj_event_mgr_t * p_manager,
OPJ_UINT32 tile_index ); OPJ_UINT32 tile_index );
/**
*
*/
opj_bool opj_jp2_set_decoded_resolution_factor(opj_jp2_v2_t *p_jp2,
OPJ_UINT32 res_factor,
opj_event_mgr_t * p_manager);
/* TODO MSD: clean these 3 functions */
/** /**
* Dump some elements from the JP2 decompression structure . * Dump some elements from the JP2 decompression structure .
* *
@ -475,7 +476,6 @@ opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2);
*/ */
opj_codestream_index_t* jp2_get_cstr_index(opj_jp2_v2_t* p_jp2); opj_codestream_index_t* jp2_get_cstr_index(opj_jp2_v2_t* p_jp2);
opj_bool jp2_set_decoded_resolution_factor(opj_jp2_v2_t *p_jp2, OPJ_UINT32 res_factor, opj_event_mgr_t * p_manager);
/*@}*/ /*@}*/

View File

@ -365,13 +365,13 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
opj_image_t*, opj_image_t*,
struct opj_event_mgr * )) opj_jp2_decode; struct opj_event_mgr * )) opj_jp2_decode;
l_codec->m_codec_data.m_decompression.opj_end_decompress = (opj_bool (*) (void *,struct opj_stream_private *,struct opj_event_mgr *)) jp2_end_decompress; l_codec->m_codec_data.m_decompression.opj_end_decompress = (opj_bool (*) (void *,struct opj_stream_private *,struct opj_event_mgr *)) opj_jp2_end_decompress;
l_codec->m_codec_data.m_decompression.opj_read_header = (opj_bool (*) ( l_codec->m_codec_data.m_decompression.opj_read_header = (opj_bool (*) (
struct opj_stream_private *, struct opj_stream_private *,
void *, void *,
opj_image_t **, opj_image_t **,
struct opj_event_mgr * )) jp2_read_header; struct opj_event_mgr * )) opj_jp2_read_header;
l_codec->m_codec_data.m_decompression.opj_read_tile_header = ( opj_bool (*) ( l_codec->m_codec_data.m_decompression.opj_read_tile_header = ( opj_bool (*) (
void *, void *,
@ -384,27 +384,27 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format)
OPJ_UINT32 * , OPJ_UINT32 * ,
opj_bool *, opj_bool *,
struct opj_stream_private *, struct opj_stream_private *,
struct opj_event_mgr * )) jp2_read_tile_header; struct opj_event_mgr * )) opj_jp2_read_tile_header;
l_codec->m_codec_data.m_decompression.opj_decode_tile_data = (opj_bool (*) (void *,OPJ_UINT32,OPJ_BYTE*,OPJ_UINT32,struct opj_stream_private *, struct opj_event_mgr * )) jp2_decode_tile; l_codec->m_codec_data.m_decompression.opj_decode_tile_data = (opj_bool (*) (void *,OPJ_UINT32,OPJ_BYTE*,OPJ_UINT32,struct opj_stream_private *, struct opj_event_mgr * )) opj_jp2_decode_tile;
l_codec->m_codec_data.m_decompression.opj_destroy = (void (*) (void *))jp2_destroy; l_codec->m_codec_data.m_decompression.opj_destroy = (void (*) (void *))opj_jp2_destroy;
l_codec->m_codec_data.m_decompression.opj_setup_decoder = (void (*) (void * ,opj_dparameters_t * )) opj_jp2_setup_decoder; l_codec->m_codec_data.m_decompression.opj_setup_decoder = (void (*) (void * ,opj_dparameters_t * )) opj_jp2_setup_decoder;
l_codec->m_codec_data.m_decompression.opj_set_decode_area = (opj_bool (*) (void *,opj_image_t*, OPJ_INT32,OPJ_INT32,OPJ_INT32,OPJ_INT32, struct opj_event_mgr * )) jp2_set_decode_area; l_codec->m_codec_data.m_decompression.opj_set_decode_area = (opj_bool (*) (void *,opj_image_t*, OPJ_INT32,OPJ_INT32,OPJ_INT32,OPJ_INT32, struct opj_event_mgr * )) opj_jp2_set_decode_area;
l_codec->m_codec_data.m_decompression.opj_get_decoded_tile = (opj_bool (*) (void *p_codec, l_codec->m_codec_data.m_decompression.opj_get_decoded_tile = (opj_bool (*) (void *p_codec,
opj_stream_private_t *p_cio, opj_stream_private_t *p_cio,
opj_image_t *p_image, opj_image_t *p_image,
struct opj_event_mgr * p_manager, struct opj_event_mgr * p_manager,
OPJ_UINT32 tile_index)) jp2_get_tile; OPJ_UINT32 tile_index)) opj_jp2_get_tile;
l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor = (opj_bool (*) (void * p_codec, l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor = (opj_bool (*) (void * p_codec,
OPJ_UINT32 res_factor, OPJ_UINT32 res_factor,
opj_event_mgr_t * p_manager)) jp2_set_decoded_resolution_factor; opj_event_mgr_t * p_manager)) opj_jp2_set_decoded_resolution_factor;
l_codec->m_codec = jp2_create(OPJ_TRUE); l_codec->m_codec = opj_jp2_create(OPJ_TRUE);
if (! l_codec->m_codec) { if (! l_codec->m_codec) {
opj_free(l_codec); opj_free(l_codec);
@ -735,32 +735,32 @@ opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT p_format)
/* get a JP2 decoder handle */ /* get a JP2 decoder handle */
l_codec->m_codec_data.m_compression.opj_encode = (opj_bool (*) (void *, l_codec->m_codec_data.m_compression.opj_encode = (opj_bool (*) (void *,
struct opj_stream_private *, struct opj_stream_private *,
struct opj_event_mgr * )) opj_jp2_encode_v2; struct opj_event_mgr * )) opj_jp2_encode;
l_codec->m_codec_data.m_compression.opj_end_compress = (opj_bool (*) ( void *, l_codec->m_codec_data.m_compression.opj_end_compress = (opj_bool (*) ( void *,
struct opj_stream_private *, struct opj_stream_private *,
struct opj_event_mgr *)) jp2_end_compress; struct opj_event_mgr *)) opj_jp2_end_compress;
l_codec->m_codec_data.m_compression.opj_start_compress = (opj_bool (*) (void *, l_codec->m_codec_data.m_compression.opj_start_compress = (opj_bool (*) (void *,
struct opj_stream_private *, struct opj_stream_private *,
struct opj_image * , struct opj_image * ,
struct opj_event_mgr *)) jp2_start_compress; struct opj_event_mgr *)) opj_jp2_start_compress;
l_codec->m_codec_data.m_compression.opj_write_tile = (opj_bool (*) (void *, l_codec->m_codec_data.m_compression.opj_write_tile = (opj_bool (*) (void *,
OPJ_UINT32, OPJ_UINT32,
OPJ_BYTE*, OPJ_BYTE*,
OPJ_UINT32, OPJ_UINT32,
struct opj_stream_private *, struct opj_stream_private *,
struct opj_event_mgr *)) jp2_write_tile; struct opj_event_mgr *)) opj_jp2_write_tile;
l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) jp2_destroy; l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) opj_jp2_destroy;
l_codec->m_codec_data.m_compression.opj_setup_encoder = (void (*) ( void *, l_codec->m_codec_data.m_compression.opj_setup_encoder = (void (*) ( void *,
opj_cparameters_t *, opj_cparameters_t *,
struct opj_image *, struct opj_image *,
struct opj_event_mgr * )) jp2_setup_encoder; struct opj_event_mgr * )) opj_jp2_setup_encoder;
l_codec->m_codec = jp2_create(OPJ_FALSE); l_codec->m_codec = opj_jp2_create(OPJ_FALSE);
if (! l_codec->m_codec) { if (! l_codec->m_codec) {
opj_free(l_codec); opj_free(l_codec);
return 00; return 00;