diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 043a4659..8b4d190a 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -886,7 +886,7 @@ static opj_bool opj_j2k_read_sod( opj_j2k_v2_t *p_j2k, */ void j2k_update_tlm (opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_part_size ) { - opj_write_bytes(p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current,p_j2k->m_current_tile_number,1); /* PSOT */ + opj_write_bytes(p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current,p_j2k->m_current_tile_number,1); /* PSOT */ ++p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current; opj_write_bytes(p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current,p_tile_part_size,4); /* PSOT */ @@ -6737,7 +6737,7 @@ opj_j2k_t* j2k_create_compress(opj_common_ptr cinfo) { return j2k; } -opj_j2k_v2_t* j2k_create_compress_v2(void) +opj_j2k_v2_t* opj_j2k_create_compress_v2(void) { opj_j2k_v2_t *l_j2k = (opj_j2k_v2_t*) opj_malloc(sizeof(opj_j2k_v2_t)); if (!l_j2k) { @@ -6751,7 +6751,7 @@ opj_j2k_v2_t* j2k_create_compress_v2(void) l_j2k->m_specific_param.m_encoder.m_header_tile_data = (OPJ_BYTE *) opj_malloc(J2K_DEFAULT_HEADER_SIZE); if (! l_j2k->m_specific_param.m_encoder.m_header_tile_data) { - j2k_destroy(l_j2k); + opj_j2k_destroy(l_j2k); return NULL; } @@ -6760,14 +6760,14 @@ opj_j2k_v2_t* j2k_create_compress_v2(void) /* validation list creation*/ l_j2k->m_validation_list = opj_procedure_list_create(); if (! l_j2k->m_validation_list) { - j2k_destroy(l_j2k); + opj_j2k_destroy(l_j2k); return NULL; } /* execution list creation*/ l_j2k->m_procedure_list = opj_procedure_list_create(); if (! l_j2k->m_procedure_list) { - j2k_destroy(l_j2k); + opj_j2k_destroy(l_j2k); return NULL; } @@ -7060,11 +7060,11 @@ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_ } } -void j2k_setup_encoder_v2( opj_j2k_v2_t *p_j2k, - opj_cparameters_t *parameters, - opj_image_t *image, - struct opj_event_mgr * p_manager) -{ +void opj_j2k_setup_encoder_v2( opj_j2k_v2_t *p_j2k, + opj_cparameters_t *parameters, + opj_image_t *image, + struct opj_event_mgr * p_manager) + { OPJ_UINT32 i, j, tileno, numpocs_tile; opj_cp_v2_t *cp = 00; opj_bool l_res; @@ -7278,7 +7278,7 @@ void j2k_setup_encoder_v2( opj_j2k_v2_t *p_j2k, tccp->m_dc_level_shift = l_dc_shift[i]; } - j2k_setup_mct_encoding(tcp,image); + opj_j2k_setup_mct_encoding(tcp,image); */ } else { @@ -7692,15 +7692,15 @@ static void j2k_add_tlmarker_v2(OPJ_UINT32 tileno, opj_codestream_index_t *cstr_ * Ends the decompression procedures and possibiliy add data to be read after the * codestream. */ -opj_bool j2k_end_decompress( - opj_j2k_v2_t *p_j2k, - opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager) +opj_bool opj_j2k_end_decompress(opj_j2k_v2_t *p_j2k, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager + ) { - (void)p_j2k; - (void)p_stream; - (void)p_manager; - return OPJ_TRUE; + (void)p_j2k; + (void)p_stream; + (void)p_manager; + return OPJ_TRUE; } /** @@ -7713,10 +7713,10 @@ opj_bool j2k_end_decompress( * * @return true if the box is valid. */ -opj_bool j2k_read_header( struct opj_stream_private *p_stream, - opj_j2k_v2_t* p_j2k, - opj_image_t** p_image, - struct opj_event_mgr* p_manager ) +opj_bool opj_j2k_read_header( opj_stream_private_t *p_stream, + opj_j2k_v2_t* p_j2k, + opj_image_t** p_image, + opj_event_mgr_t* p_manager ) { /* preconditions */ assert(p_j2k != 00); @@ -7838,7 +7838,7 @@ opj_bool j2k_mct_validation ( opj_j2k_v2_t * p_j2k, return l_is_valid; } -opj_bool j2k_setup_mct_encoding(opj_tcp_v2_t * p_tcp, opj_image_t * p_image) +opj_bool opj_j2k_setup_mct_encoding(opj_tcp_v2_t * p_tcp, opj_image_t * p_image) { OPJ_UINT32 i; OPJ_UINT32 l_indix = 1; @@ -8400,7 +8400,7 @@ const opj_dec_memory_marker_handler_t * opj_j2k_get_marker_handler (OPJ_UINT32 p * * @param p_j2k the jpeg20000 structure to destroy. */ -void j2k_destroy (opj_j2k_v2_t *p_j2k) +void opj_j2k_destroy (opj_j2k_v2_t *p_j2k) { if (p_j2k == 00) { return; @@ -8645,15 +8645,15 @@ void opj_j2k_cp_destroy (opj_cp_v2_t *p_cp) * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ -opj_bool j2k_read_tile_header( opj_j2k_v2_t * p_j2k, - OPJ_UINT32 * p_tile_index, - OPJ_UINT32 * p_data_size, - OPJ_INT32 * p_tile_x0, OPJ_INT32 * p_tile_y0, - OPJ_INT32 * p_tile_x1, OPJ_INT32 * p_tile_y1, - OPJ_UINT32 * p_nb_comps, - opj_bool * p_go_on, - opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager ) +opj_bool opj_j2k_read_tile_header( opj_j2k_v2_t * p_j2k, + OPJ_UINT32 * p_tile_index, + OPJ_UINT32 * p_data_size, + OPJ_INT32 * p_tile_x0, OPJ_INT32 * p_tile_y0, + OPJ_INT32 * p_tile_x1, OPJ_INT32 * p_tile_y1, + OPJ_UINT32 * p_nb_comps, + opj_bool * p_go_on, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_current_marker = J2K_MS_SOT; OPJ_UINT32 l_marker_size; @@ -8849,7 +8849,7 @@ opj_bool j2k_read_tile_header( opj_j2k_v2_t * p_j2k, } -opj_bool j2k_decode_tile ( opj_j2k_v2_t * p_j2k, +opj_bool opj_j2k_decode_tile ( opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_index, OPJ_BYTE * p_data, OPJ_UINT32 p_data_size, @@ -9193,11 +9193,11 @@ opj_bool opj_j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj * * @return true if the area could be set. */ -opj_bool j2k_set_decode_area( opj_j2k_v2_t *p_j2k, - opj_image_t* p_image, - OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, - OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, - struct opj_event_mgr * p_manager ) +opj_bool opj_j2k_set_decode_area( opj_j2k_v2_t *p_j2k, + opj_image_t* p_image, + OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, + OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, + opj_event_mgr_t * p_manager ) { opj_cp_v2_t * l_cp = &(p_j2k->m_cp); opj_image_t * l_image = p_j2k->m_private_image; @@ -9372,14 +9372,14 @@ opj_j2k_v2_t* opj_j2k_create_decompress(void) l_j2k->m_specific_param.m_decoder.m_default_tcp = (opj_tcp_v2_t*) opj_malloc(sizeof(opj_tcp_v2_t)); if (!l_j2k->m_specific_param.m_decoder.m_default_tcp) { - j2k_destroy(l_j2k); + opj_j2k_destroy(l_j2k); return 00; } memset(l_j2k->m_specific_param.m_decoder.m_default_tcp,0,sizeof(opj_tcp_v2_t)); l_j2k->m_specific_param.m_decoder.m_header_data = (OPJ_BYTE *) opj_malloc(J2K_DEFAULT_HEADER_SIZE); if (! l_j2k->m_specific_param.m_decoder.m_header_data) { - j2k_destroy(l_j2k); + opj_j2k_destroy(l_j2k); return 00; } @@ -9394,7 +9394,7 @@ opj_j2k_v2_t* opj_j2k_create_decompress(void) /*(opj_codestream_index_t*) opj_malloc(sizeof(opj_codestream_index_t)); if (!l_j2k->cstr_index){ - j2k_destroy(l_j2k); + opj_j2k_destroy(l_j2k); return NULL; } @@ -9404,14 +9404,14 @@ opj_j2k_v2_t* opj_j2k_create_decompress(void) /* validation list creation */ l_j2k->m_validation_list = opj_procedure_list_create(); if (! l_j2k->m_validation_list) { - j2k_destroy(l_j2k); + opj_j2k_destroy(l_j2k); return 00; } /* execution list creation */ l_j2k->m_procedure_list = opj_procedure_list_create(); if (! l_j2k->m_procedure_list) { - j2k_destroy(l_j2k); + opj_j2k_destroy(l_j2k); return 00; } @@ -10475,7 +10475,7 @@ opj_bool opj_j2k_decode_tiles ( opj_j2k_v2_t *p_j2k, while (OPJ_TRUE) { - if (! j2k_read_tile_header( p_j2k, + if (! opj_j2k_read_tile_header( p_j2k, &l_current_tile_no, &l_data_size, &l_tile_x0, &l_tile_y0, @@ -10502,7 +10502,7 @@ opj_bool opj_j2k_decode_tiles ( opj_j2k_v2_t *p_j2k, l_max_data_size = l_data_size; } - if (! j2k_decode_tile(p_j2k,l_current_tile_no,l_current_data,l_data_size,p_stream,p_manager)) { + if (! opj_j2k_decode_tile(p_j2k,l_current_tile_no,l_current_data,l_data_size,p_stream,p_manager)) { opj_free(l_current_data); return OPJ_FALSE; } @@ -10588,7 +10588,7 @@ static opj_bool opj_j2k_decode_one_tile ( opj_j2k_v2_t *p_j2k, } while (OPJ_TRUE) { - if (! j2k_read_tile_header( p_j2k, + if (! opj_j2k_read_tile_header( p_j2k, &l_current_tile_no, &l_data_size, &l_tile_x0, &l_tile_y0, @@ -10618,7 +10618,7 @@ static opj_bool opj_j2k_decode_one_tile ( opj_j2k_v2_t *p_j2k, - if (! j2k_decode_tile(p_j2k,l_current_tile_no,l_current_data,l_data_size,p_stream,p_manager)) { + if (! opj_j2k_decode_tile(p_j2k,l_current_tile_no,l_current_data,l_data_size,p_stream,p_manager)) { opj_free(l_current_data); return OPJ_FALSE; } @@ -10716,11 +10716,11 @@ opj_bool opj_j2k_decode(opj_j2k_v2_t * p_j2k, * * @return true if succeed. */ -opj_bool j2k_get_tile( opj_j2k_v2_t *p_j2k, - opj_stream_private_t *p_stream, - opj_image_t* p_image, - opj_event_mgr_t * p_manager, - OPJ_UINT32 tile_index ) +opj_bool opj_j2k_get_tile( opj_j2k_v2_t *p_j2k, + opj_stream_private_t *p_stream, + opj_image_t* p_image, + opj_event_mgr_t * p_manager, + OPJ_UINT32 tile_index ) { OPJ_UINT32 compno; OPJ_UINT32 l_tile_x, l_tile_y; @@ -10810,7 +10810,9 @@ opj_bool j2k_get_tile( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -opj_bool j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, OPJ_UINT32 res_factor, opj_event_mgr_t * p_manager) +opj_bool opj_j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, + OPJ_UINT32 res_factor, + opj_event_mgr_t * p_manager) { OPJ_UINT32 it_comp; @@ -10841,9 +10843,9 @@ opj_bool j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, OPJ_UINT32 res_f /** * Encodes all the tiles in a row. */ -opj_bool j2k_encode_v2( opj_j2k_v2_t * p_j2k, - opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager ) +opj_bool opj_j2k_encode_v2( opj_j2k_v2_t * p_j2k, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager ) { OPJ_UINT32 i; OPJ_UINT32 l_nb_tiles; @@ -10892,9 +10894,9 @@ opj_bool j2k_encode_v2( opj_j2k_v2_t * p_j2k, * Ends the compression procedures and possibility add data to be read after the * codestream. */ -opj_bool j2k_end_compress( opj_j2k_v2_t *p_j2k, - opj_stream_private_t *p_stream, - struct opj_event_mgr * p_manager) +opj_bool opj_j2k_end_compress( opj_j2k_v2_t *p_j2k, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager) { /* customization of the encoding */ j2k_setup_end_compress(p_j2k); @@ -10917,10 +10919,10 @@ opj_bool j2k_end_compress( opj_j2k_v2_t *p_j2k, * * @return true if the codec is valid. */ -opj_bool j2k_start_compress(opj_j2k_v2_t *p_j2k, - opj_stream_private_t *p_stream, - opj_image_t * p_image, - opj_event_mgr_t * p_manager) +opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k, + opj_stream_private_t *p_stream, + opj_image_t * p_image, + opj_event_mgr_t * p_manager) { /* preconditions */ assert(p_j2k != 00); @@ -11633,7 +11635,7 @@ static opj_bool opj_j2k_create_tcd( opj_j2k_v2_t *p_j2k, * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ -opj_bool j2k_write_tile (opj_j2k_v2_t * p_j2k, +opj_bool opj_j2k_write_tile (opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_index, OPJ_BYTE * p_data, OPJ_UINT32 p_data_size, diff --git a/libopenjpeg/j2k.h b/libopenjpeg/j2k.h index f3c9f2d4..a1ad194b 100644 --- a/libopenjpeg/j2k.h +++ b/libopenjpeg/j2k.h @@ -812,7 +812,7 @@ Creates a J2K compression structure @param cinfo Codec context info @return Returns a handle to a J2K compressor if successful, returns NULL otherwise */ -opj_j2k_v2_t* j2k_create_compress_v2(void); +opj_j2k_v2_t* opj_j2k_create_compress_v2(void); /** Destroy a J2K compressor handle @@ -828,10 +828,10 @@ Coding parameters are returned in j2k->cp. */ void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_t *image); -void j2k_setup_encoder_v2( opj_j2k_v2_t *p_j2k, - opj_cparameters_t *parameters, - opj_image_t *image, - struct opj_event_mgr * p_manager); +void opj_j2k_setup_encoder_v2( opj_j2k_v2_t *p_j2k, + opj_cparameters_t *parameters, + opj_image_t *image, + struct opj_event_mgr * p_manager); /** Converts an enum type progression order to string type @@ -856,7 +856,9 @@ opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, opj_code * Ends the decompression procedures and possibiliy add data to be read after the * codestream. */ -opj_bool j2k_end_decompress(opj_j2k_v2_t *j2k, struct opj_stream_private *cio, struct opj_event_mgr * p_manager); +opj_bool opj_j2k_end_decompress(opj_j2k_v2_t *j2k, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager); /** * Reads a jpeg2000 codestream header structure. @@ -867,10 +869,10 @@ opj_bool j2k_end_decompress(opj_j2k_v2_t *j2k, struct opj_stream_private *cio, s * * @return true if the box is valid. */ -opj_bool j2k_read_header( struct opj_stream_private *p_stream, - opj_j2k_v2_t* p_j2k, - opj_image_t** p_image, - struct opj_event_mgr* p_manager ); +opj_bool opj_j2k_read_header( opj_stream_private_t *p_stream, + opj_j2k_v2_t* p_j2k, + opj_image_t** p_image, + opj_event_mgr_t* p_manager ); /** @@ -878,7 +880,7 @@ opj_bool j2k_read_header( struct opj_stream_private *p_stream, * * @param p_j2k the jpeg20000 structure to destroy. */ -void j2k_destroy (opj_j2k_v2_t *p_j2k); +void opj_j2k_destroy (opj_j2k_v2_t *p_j2k); /** * Destroys a codestream index structure. @@ -893,14 +895,12 @@ void j2k_destroy_cstr_index (opj_codestream_index_t *p_cstr_ind); * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ -opj_bool j2k_decode_tile ( - opj_j2k_v2_t * p_j2k, - OPJ_UINT32 p_tile_index, - OPJ_BYTE * p_data, - OPJ_UINT32 p_data_size, - struct opj_stream_private *p_stream, - struct opj_event_mgr * p_manager - ); +opj_bool opj_j2k_decode_tile ( opj_j2k_v2_t * p_j2k, + OPJ_UINT32 p_tile_index, + OPJ_BYTE * p_data, + OPJ_UINT32 p_data_size, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager ); /** * Reads a tile header. @@ -908,19 +908,17 @@ opj_bool j2k_decode_tile ( * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ -opj_bool j2k_read_tile_header ( - opj_j2k_v2_t * p_j2k, - OPJ_UINT32 * p_tile_index, - OPJ_UINT32 * p_data_size, - OPJ_INT32 * p_tile_x0, - OPJ_INT32 * p_tile_y0, - OPJ_INT32 * p_tile_x1, - OPJ_INT32 * p_tile_y1, - OPJ_UINT32 * p_nb_comps, - opj_bool * p_go_on, - struct opj_stream_private *p_stream, - struct opj_event_mgr * p_manager - ); +opj_bool opj_j2k_read_tile_header ( opj_j2k_v2_t * p_j2k, + OPJ_UINT32 * p_tile_index, + OPJ_UINT32 * p_data_size, + OPJ_INT32 * p_tile_x0, + OPJ_INT32 * p_tile_y0, + OPJ_INT32 * p_tile_x1, + OPJ_INT32 * p_tile_y1, + OPJ_UINT32 * p_nb_comps, + opj_bool * p_go_on, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager ); /** @@ -935,11 +933,11 @@ opj_bool j2k_read_tile_header ( * * @return true if the area could be set. */ -opj_bool j2k_set_decode_area( opj_j2k_v2_t *p_j2k, - opj_image_t* p_image, - OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, - OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, - struct opj_event_mgr * p_manager ); +opj_bool opj_j2k_set_decode_area( opj_j2k_v2_t *p_j2k, + opj_image_t* p_image, + OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, + OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, + opj_event_mgr_t * p_manager ); /** * Creates a J2K decompression structure. @@ -1010,13 +1008,15 @@ opj_bool opj_j2k_decode(opj_j2k_v2_t *j2k, opj_event_mgr_t *p_manager); -opj_bool j2k_get_tile( opj_j2k_v2_t *p_j2k, - opj_stream_private_t *p_stream, - opj_image_t* p_image, - struct opj_event_mgr * p_manager, - OPJ_UINT32 tile_index ); +opj_bool opj_j2k_get_tile( opj_j2k_v2_t *p_j2k, + opj_stream_private_t *p_stream, + opj_image_t* p_image, + opj_event_mgr_t * p_manager, + OPJ_UINT32 tile_index ); -opj_bool j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, OPJ_UINT32 res_factor, opj_event_mgr_t * p_manager); +opj_bool opj_j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, + OPJ_UINT32 res_factor, + opj_event_mgr_t * p_manager); /** @@ -1025,19 +1025,19 @@ opj_bool j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, OPJ_UINT32 res_f * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ -opj_bool j2k_write_tile ( opj_j2k_v2_t * p_j2k, - OPJ_UINT32 p_tile_index, - OPJ_BYTE * p_data, - OPJ_UINT32 p_data_size, - struct opj_stream_private *p_stream, - struct opj_event_mgr * p_manager ); +opj_bool opj_j2k_write_tile ( opj_j2k_v2_t * p_j2k, + OPJ_UINT32 p_tile_index, + OPJ_BYTE * p_data, + OPJ_UINT32 p_data_size, + opj_stream_private_t *p_stream, + opj_event_mgr_t * p_manager ); /** * Encodes an image into a JPEG-2000 codestream */ -opj_bool j2k_encode_v2( opj_j2k_v2_t * p_j2k, - opj_stream_private_t *cio, - struct opj_event_mgr * p_manager ); +opj_bool opj_j2k_encode_v2( opj_j2k_v2_t * p_j2k, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager ); /** * Starts a compression scheme, i.e. validates the codec parameters, writes the header. @@ -1048,20 +1048,20 @@ opj_bool j2k_encode_v2( opj_j2k_v2_t * p_j2k, * * @return true if the codec is valid. */ -opj_bool j2k_start_compress(opj_j2k_v2_t *p_j2k, - struct opj_stream_private *cio, - struct opj_image * p_image, - struct opj_event_mgr * p_manager ); +opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k, + opj_stream_private_t *p_stream, + opj_image_t * p_image, + opj_event_mgr_t * p_manager); /** * Ends the compression procedures and possibiliy add data to be read after the * codestream. */ -opj_bool j2k_end_compress( opj_j2k_v2_t *p_j2k, - opj_stream_private_t *cio, - struct opj_event_mgr * p_manager); +opj_bool opj_j2k_end_compress( opj_j2k_v2_t *p_j2k, + opj_stream_private_t *cio, + opj_event_mgr_t * p_manager); -opj_bool j2k_setup_mct_encoding (opj_tcp_v2_t * p_tcp, opj_image_t * p_image); +opj_bool opj_j2k_setup_mct_encoding (opj_tcp_v2_t * p_tcp, opj_image_t * p_image); #endif /* __J2K_H */ diff --git a/libopenjpeg/jp2.c b/libopenjpeg/jp2.c index f24eee80..bbe28bf0 100644 --- a/libopenjpeg/jp2.c +++ b/libopenjpeg/jp2.c @@ -1517,7 +1517,7 @@ void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2, return; } - j2k_setup_encoder_v2(jp2->j2k, parameters, image, p_manager ); + opj_j2k_setup_encoder_v2(jp2->j2k, parameters, image, p_manager ); /* setup the JP2 codec */ /* ------------------- */ @@ -1582,7 +1582,7 @@ opj_bool opj_jp2_encode(opj_jp2_v2_t *jp2, opj_stream_private_t *stream, opj_event_mgr_t * p_manager) { - return j2k_encode_v2(jp2->j2k, stream, p_manager); + return opj_j2k_encode_v2(jp2->j2k, stream, p_manager); } @@ -1608,7 +1608,7 @@ opj_bool opj_jp2_end_decompress(opj_jp2_v2_t *jp2, return OPJ_FALSE; } - return j2k_end_decompress(jp2->j2k, cio, p_manager); + return opj_j2k_end_decompress(jp2->j2k, cio, p_manager); } /** @@ -1628,7 +1628,7 @@ opj_bool opj_jp2_end_compress( opj_jp2_v2_t *jp2, /* customization of the end encoding */ opj_jp2_setup_end_header_writting(jp2); - if (! j2k_end_compress(jp2->j2k,cio,p_manager)) { + if (! opj_j2k_end_compress(jp2->j2k,cio,p_manager)) { return OPJ_FALSE; } @@ -1894,7 +1894,7 @@ opj_bool opj_jp2_start_compress(opj_jp2_v2_t *jp2, return OPJ_FALSE; } - return j2k_start_compress(jp2->j2k,stream,p_image,p_manager); + return opj_j2k_start_compress(jp2->j2k,stream,p_image,p_manager); } /** @@ -2264,7 +2264,7 @@ opj_bool opj_jp2_read_header( opj_stream_private_t *p_stream, return OPJ_FALSE; } - return j2k_read_header( p_stream, + return opj_j2k_read_header( p_stream, jp2->j2k, p_image, p_manager); @@ -2345,7 +2345,7 @@ opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2, opj_event_mgr_t * p_manager ) { - return j2k_read_tile_header(p_jp2->j2k, + return opj_j2k_read_tile_header(p_jp2->j2k, p_tile_index, p_data_size, p_tile_x0, p_tile_y0, @@ -2371,7 +2371,7 @@ opj_bool opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2, ) { - return j2k_write_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager); + return opj_j2k_write_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager); } /** @@ -2388,7 +2388,7 @@ opj_bool opj_jp2_decode_tile ( opj_jp2_v2_t * p_jp2, opj_event_mgr_t * p_manager ) { - return j2k_decode_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager); + return opj_j2k_decode_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager); } /** @@ -2400,7 +2400,7 @@ void opj_jp2_destroy(opj_jp2_v2_t *jp2) { if (jp2) { /* destroy the J2K codec */ - j2k_destroy(jp2->j2k); + opj_j2k_destroy(jp2->j2k); jp2->j2k = 00; if (jp2->comps) { @@ -2482,7 +2482,7 @@ opj_bool opj_jp2_set_decode_area( opj_jp2_v2_t *p_jp2, 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 opj_j2k_set_decode_area(p_jp2->j2k, p_image, p_start_x, p_start_y, p_end_x, p_end_y, p_manager); } /** @@ -2508,7 +2508,7 @@ opj_bool opj_jp2_get_tile( opj_jp2_v2_t *p_jp2, 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(p_jp2->j2k, p_stream, p_image, p_manager, tile_index) ){ + if (! opj_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"); return OPJ_FALSE; } @@ -2559,7 +2559,7 @@ opj_jp2_v2_t* opj_jp2_create(opj_bool p_is_decoder) /* create the J2K codec */ if (! p_is_decoder) { - jp2->j2k = j2k_create_compress_v2(); + jp2->j2k = opj_j2k_create_compress_v2(); } else { jp2->j2k = opj_j2k_create_decompress(); @@ -2619,6 +2619,6 @@ 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 opj_j2k_set_decoded_resolution_factor(p_jp2->j2k, res_factor, p_manager); } diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c index 30e8ef1f..df058630 100644 --- a/libopenjpeg/openjpeg.c +++ b/libopenjpeg/openjpeg.c @@ -87,7 +87,9 @@ typedef struct opj_decompression OPJ_UINT32 tile_index); /** Set the decoded resolution factor */ - opj_bool (*opj_set_decoded_resolution_factor) (void * p_codec, OPJ_UINT32 res_factor, struct opj_event_mgr * p_manager); + opj_bool (*opj_set_decoded_resolution_factor) ( void * p_codec, + OPJ_UINT32 res_factor, + opj_event_mgr_t * p_manager); }opj_decompression_t; @@ -301,16 +303,16 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format) l_codec->m_codec_data.m_decompression.opj_end_decompress = (opj_bool (*) ( void *, struct opj_stream_private *, - struct opj_event_mgr *)) j2k_end_decompress; + struct opj_event_mgr *)) opj_j2k_end_decompress; l_codec->m_codec_data.m_decompression.opj_read_header = (opj_bool (*) ( struct opj_stream_private *, void *, opj_image_t **, - struct opj_event_mgr * )) j2k_read_header; + struct opj_event_mgr * )) opj_j2k_read_header; l_codec->m_codec_data.m_decompression.opj_destroy = - (void (*) (void *))j2k_destroy; + (void (*) (void *))opj_j2k_destroy; l_codec->m_codec_data.m_decompression.opj_setup_decoder = (void (*) (void * , opj_dparameters_t * )) opj_j2k_setup_decoder; @@ -324,23 +326,33 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format) OPJ_UINT32*, opj_bool*, struct opj_stream_private *, - struct opj_event_mgr * )) j2k_read_tile_header; + struct opj_event_mgr * )) opj_j2k_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 *)) j2k_decode_tile; + (opj_bool (*) ( void *, + OPJ_UINT32, + OPJ_BYTE*, + OPJ_UINT32, + struct opj_stream_private *, + struct opj_event_mgr *)) opj_j2k_decode_tile; 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 *)) j2k_set_decode_area; + (opj_bool (*) ( void *, + opj_image_t*, + OPJ_INT32, OPJ_INT32, OPJ_INT32, OPJ_INT32, + struct opj_event_mgr *)) opj_j2k_set_decode_area; - l_codec->m_codec_data.m_decompression.opj_get_decoded_tile = (opj_bool (*) (void *p_codec, - opj_stream_private_t *p_cio, - opj_image_t *p_image, - struct opj_event_mgr * p_manager, - OPJ_UINT32 tile_index)) j2k_get_tile; + l_codec->m_codec_data.m_decompression.opj_get_decoded_tile = + (opj_bool (*) ( void *p_codec, + opj_stream_private_t *p_cio, + opj_image_t *p_image, + struct opj_event_mgr * p_manager, + OPJ_UINT32 tile_index)) opj_j2k_get_tile; - l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor = (opj_bool (*) (void * p_codec, - OPJ_UINT32 res_factor, - struct opj_event_mgr * p_manager)) j2k_set_decoded_resolution_factor; + l_codec->m_codec_data.m_decompression.opj_set_decoded_resolution_factor = + (opj_bool (*) ( void * p_codec, + OPJ_UINT32 res_factor, + struct opj_event_mgr * p_manager)) opj_j2k_set_decoded_resolution_factor; l_codec->m_codec = opj_j2k_create_decompress(); @@ -365,44 +377,58 @@ opj_codec_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT p_format) opj_image_t*, 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 *)) opj_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 (*) ( - struct opj_stream_private *, - void *, - opj_image_t **, - struct opj_event_mgr * )) opj_jp2_read_header; + l_codec->m_codec_data.m_decompression.opj_read_header = + (opj_bool (*) ( struct opj_stream_private *, + void *, + opj_image_t **, + struct opj_event_mgr * )) opj_jp2_read_header; - l_codec->m_codec_data.m_decompression.opj_read_tile_header = ( opj_bool (*) ( - void *, - OPJ_UINT32*, - OPJ_UINT32*, - OPJ_INT32*, - OPJ_INT32*, - OPJ_INT32 * , - OPJ_INT32 * , - OPJ_UINT32 * , - opj_bool *, - struct opj_stream_private *, - struct opj_event_mgr * )) opj_jp2_read_tile_header; + l_codec->m_codec_data.m_decompression.opj_read_tile_header = + (opj_bool (*) ( void *, + OPJ_UINT32*, + OPJ_UINT32*, + OPJ_INT32*, + OPJ_INT32*, + OPJ_INT32 * , + OPJ_INT32 * , + OPJ_UINT32 * , + opj_bool *, + struct opj_stream_private *, + 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 * )) opj_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 *))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 * )) opj_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, - opj_stream_private_t *p_cio, - opj_image_t *p_image, - struct opj_event_mgr * p_manager, - OPJ_UINT32 tile_index)) opj_jp2_get_tile; + l_codec->m_codec_data.m_decompression.opj_get_decoded_tile = + (opj_bool (*) ( void *p_codec, + opj_stream_private_t *p_cio, + opj_image_t *p_image, + struct opj_event_mgr * p_manager, + 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, - 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_resolution_factor = + (opj_bool (*) ( void * p_codec, + OPJ_UINT32 res_factor, + opj_event_mgr_t * p_manager)) opj_jp2_set_decoded_resolution_factor; l_codec->m_codec = opj_jp2_create(OPJ_TRUE); @@ -452,7 +478,8 @@ opj_bool OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec; if (! l_codec->is_decompressor) { - opj_event_msg_v2(&(l_codec->m_event_mgr), EVT_ERROR, "Codec provided to the opj_setup_decoder function is not a decompressor handler.\n"); + opj_event_msg_v2(&(l_codec->m_event_mgr), EVT_ERROR, + "Codec provided to the opj_setup_decoder function is not a decompressor handler.\n"); return OPJ_FALSE; } @@ -472,7 +499,8 @@ opj_bool OPJ_CALLCONV opj_read_header ( opj_stream_t *p_stream, opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; if(! l_codec->is_decompressor) { - opj_event_msg_v2(&(l_codec->m_event_mgr), EVT_ERROR, "Codec provided to the opj_read_header function is not a decompressor handler.\n"); + opj_event_msg_v2(&(l_codec->m_event_mgr), EVT_ERROR, + "Codec provided to the opj_read_header function is not a decompressor handler.\n"); return OPJ_FALSE; } @@ -551,8 +579,8 @@ opj_bool OPJ_CALLCONV opj_set_decode_area( opj_codec_t *p_codec, * @param p_codec the jpeg2000 codec. * @param p_tile_index pointer to a value that will hold the index of the tile being decoded, in case of success. * @param p_data_size pointer to a value that will hold the maximum size of the decoded data, in case of success. In case - * of truncated codestreams, the actual number of bytes decoded may be lower. The computation of the size is the same - * as depicted in opj_write_tile. + * of truncated codestreams, the actual number of bytes decoded may be lower. + * The computation of the size is the same as depicted in opj_write_tile. * @param p_tile_x0 pointer to a value that will hold the x0 pos of the tile (in the image). * @param p_tile_y0 pointer to a value that will hold the y0 pos of the tile (in the image). * @param p_tile_x1 pointer to a value that will hold the x1 pos of the tile (in the image). @@ -698,32 +726,32 @@ opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT p_format) case CODEC_J2K: l_codec->m_codec_data.m_compression.opj_encode = (opj_bool (*) (void *, struct opj_stream_private *, - struct opj_event_mgr * )) j2k_encode_v2; + struct opj_event_mgr * )) opj_j2k_encode_v2; l_codec->m_codec_data.m_compression.opj_end_compress = (opj_bool (*) ( void *, struct opj_stream_private *, - struct opj_event_mgr *)) j2k_end_compress; + struct opj_event_mgr *)) opj_j2k_end_compress; l_codec->m_codec_data.m_compression.opj_start_compress = (opj_bool (*) (void *, struct opj_stream_private *, struct opj_image * , - struct opj_event_mgr *)) j2k_start_compress; + struct opj_event_mgr *)) opj_j2k_start_compress; l_codec->m_codec_data.m_compression.opj_write_tile = (opj_bool (*) (void *, OPJ_UINT32, OPJ_BYTE*, OPJ_UINT32, struct opj_stream_private *, - struct opj_event_mgr *) ) j2k_write_tile; + struct opj_event_mgr *) ) opj_j2k_write_tile; - l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) j2k_destroy; + l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) opj_j2k_destroy; l_codec->m_codec_data.m_compression.opj_setup_encoder = (void (*) ( void *, opj_cparameters_t *, struct opj_image *, - struct opj_event_mgr * )) j2k_setup_encoder_v2; + struct opj_event_mgr * )) opj_j2k_setup_encoder_v2; - l_codec->m_codec = j2k_create_compress_v2(); + l_codec->m_codec = opj_j2k_create_compress_v2(); if (! l_codec->m_codec) { opj_free(l_codec); return 00; @@ -934,7 +962,9 @@ opj_bool OPJ_CALLCONV opj_end_decompress ( opj_codec_t *p_codec, } -opj_bool OPJ_CALLCONV opj_set_MCT(opj_cparameters_t *parameters,OPJ_FLOAT32 * pEncodingMatrix,OPJ_INT32 * p_dc_shift,OPJ_UINT32 pNbComp) +opj_bool OPJ_CALLCONV opj_set_MCT(opj_cparameters_t *parameters, + OPJ_FLOAT32 * pEncodingMatrix, + OPJ_INT32 * p_dc_shift,OPJ_UINT32 pNbComp) { OPJ_UINT32 l_matrix_size = pNbComp * pNbComp * sizeof(OPJ_FLOAT32); OPJ_UINT32 l_dc_shift_size = pNbComp * sizeof(OPJ_INT32); @@ -963,9 +993,11 @@ opj_bool OPJ_CALLCONV opj_set_MCT(opj_cparameters_t *parameters,OPJ_FLOAT32 * pE * * @param p_compressor the jpeg2000 codec. * @param p_tile_index the index of the tile to write. At the moment, the tiles must be written from 0 to n-1 in sequence. - * @param p_data pointer to the data to write. Data is arranged in sequence, data_comp0, then data_comp1, then ... NO INTERLEAVING should be set. - * @param p_data_size this value os used to make sure the data being written is correct. The size must be equal to the sum for each component of tile_width * tile_height * component_size. component_size can be 1,2 or 4 bytes, - * depending on the precision of the given component. + * @param p_data pointer to the data to write. Data is arranged in sequence, data_comp0, then data_comp1, + * then ... NO INTERLEAVING should be set. + * @param p_data_size this value os used to make sure the data being written is correct. The size must be + * equal to the sum for each component of tile_width * tile_height * component_size. + * component_size can be 1,2 or 4 bytes, depending on the precision of the given component. * @param p_stream the stream to write data to. */ opj_bool OPJ_CALLCONV opj_write_tile ( opj_codec_t *p_codec,