Sync coc-qcc branch with master
This commit is contained in:
commit
60301842c7
|
@ -190,7 +190,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||
# For all builds, make sure openjpeg is std99 compliant:
|
||||
# set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
|
||||
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||
set(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||
SET(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# this module looks for JPYLYZER
|
||||
# http://jpylyzer.openpreservation.org
|
||||
#
|
||||
|
||||
find_program(JPYLYZER_EXECUTABLE
|
||||
jpylyzer
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
JPYLYZER_EXECUTABLE
|
||||
)
|
|
@ -2049,7 +2049,7 @@ static opj_image_t* rawtoimage_common(const char *filename, opj_cparameters_t *p
|
|||
{
|
||||
unsigned short value;
|
||||
for(compno = 0; compno < numcomps; compno++) {
|
||||
int nloop = (w*h)/(raw_cp->rawComps[compno].dx*raw_cp->rawComps[compno].dx);
|
||||
int nloop = (w*h)/(raw_cp->rawComps[compno].dx*raw_cp->rawComps[compno].dy);
|
||||
for (i = 0; i < nloop; i++) {
|
||||
unsigned char temp1;
|
||||
unsigned char temp2;
|
||||
|
|
|
@ -85,6 +85,7 @@ if(UNIX)
|
|||
target_link_libraries(${OPENJPEG_LIBRARY_NAME} m)
|
||||
endif()
|
||||
set_target_properties(${OPENJPEG_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
||||
target_compile_options(${OPENJPEG_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
|
||||
|
||||
# Install library
|
||||
install(TARGETS ${OPENJPEG_LIBRARY_NAME}
|
||||
|
|
|
@ -95,6 +95,12 @@ OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, OPJ_INT32 event_type, const c
|
|||
*/
|
||||
void opj_set_default_event_handler(opj_event_mgr_t * p_manager);
|
||||
|
||||
/*
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC poison printf fprintf
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
|
|
@ -69,8 +69,11 @@ void opj_procedure_list_destroy(opj_procedure_list_t * p_list)
|
|||
opj_free(p_list);
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure)
|
||||
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager )
|
||||
{
|
||||
|
||||
assert(p_manager != NULL);
|
||||
|
||||
if (p_validation_list->m_nb_max_procedures == p_validation_list->m_nb_procedures)
|
||||
{
|
||||
opj_procedure * new_procedures;
|
||||
|
@ -84,9 +87,7 @@ OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_l
|
|||
opj_free(p_validation_list->m_procedures);
|
||||
p_validation_list->m_nb_max_procedures = 0;
|
||||
p_validation_list->m_nb_procedures = 0;
|
||||
/* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add a new validation procedure\n"); */
|
||||
fprintf(stderr, "Not enough memory to add a new validation procedure\n");
|
||||
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to add a new validation procedure\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -95,7 +95,7 @@ void opj_procedure_list_destroy(opj_procedure_list_t * p_list);
|
|||
*
|
||||
* @return OPJ_TRUE if the procedure could be added.
|
||||
*/
|
||||
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure);
|
||||
OPJ_BOOL opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure, opj_event_mgr_t* p_manager);
|
||||
|
||||
/**
|
||||
* Gets the number of validation procedures.
|
||||
|
|
|
@ -47,7 +47,8 @@ opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptpa
|
|||
/* allocate memory for the per-component information */
|
||||
image->comps = (opj_image_comp_t*)opj_calloc(1,image->numcomps * sizeof(opj_image_comp_t));
|
||||
if(!image->comps) {
|
||||
fprintf(stderr,"Unable to allocate memory for image.\n");
|
||||
/* TODO replace with event manager, breaks API */
|
||||
/* fprintf(stderr,"Unable to allocate memory for image.\n"); */
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -65,7 +66,8 @@ opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptpa
|
|||
comp->sgnd = cmptparms[compno].sgnd;
|
||||
comp->data = (OPJ_INT32*) opj_calloc(comp->w * comp->h, sizeof(OPJ_INT32));
|
||||
if(!comp->data) {
|
||||
fprintf(stderr,"Unable to allocate memory for image.\n");
|
||||
/* TODO replace with event manager, breaks API */
|
||||
/* fprintf(stderr,"Unable to allocate memory for image.\n"); */
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
/**
|
||||
* Sets up the procedures to do on reading header. Developpers wanting to extend the library can add their own reading procedures.
|
||||
*/
|
||||
static void opj_j2k_setup_header_reading (opj_j2k_t *p_j2k);
|
||||
static OPJ_BOOL opj_j2k_setup_header_reading (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* The read header procedure.
|
||||
|
@ -90,19 +90,19 @@ static OPJ_BOOL opj_j2k_decoding_validation ( opj_j2k_t * p_j2k,
|
|||
* Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters
|
||||
* are valid. Developpers wanting to extend the library can add their own validation procedures.
|
||||
*/
|
||||
static void opj_j2k_setup_encoding_validation (opj_j2k_t *p_j2k);
|
||||
static OPJ_BOOL opj_j2k_setup_encoding_validation (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters
|
||||
* are valid. Developpers wanting to extend the library can add their own validation procedures.
|
||||
*/
|
||||
static void opj_j2k_setup_decoding_validation (opj_j2k_t *p_j2k);
|
||||
static OPJ_BOOL opj_j2k_setup_decoding_validation (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters
|
||||
* are valid. Developpers wanting to extend the library can add their own validation procedures.
|
||||
*/
|
||||
static void opj_j2k_setup_end_compress (opj_j2k_t *p_j2k);
|
||||
static OPJ_BOOL opj_j2k_setup_end_compress (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* The mct encoding validation procedure.
|
||||
|
@ -385,7 +385,7 @@ static OPJ_BOOL opj_j2k_post_write_tile (opj_j2k_t * p_j2k,
|
|||
* Sets up the procedures to do on writing header.
|
||||
* Developers wanting to extend the library can add their own writing procedures.
|
||||
*/
|
||||
static void opj_j2k_setup_header_writing (opj_j2k_t *p_j2k);
|
||||
static OPJ_BOOL opj_j2k_setup_header_writing (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager);
|
||||
|
||||
static OPJ_BOOL opj_j2k_write_first_tile_part( opj_j2k_t *p_j2k,
|
||||
OPJ_BYTE * p_data,
|
||||
|
@ -4993,7 +4993,7 @@ static OPJ_BOOL opj_j2k_write_regions( opj_j2k_t *p_j2k,
|
|||
|
||||
l_tccp = p_j2k->m_cp.tcps->tccps;
|
||||
|
||||
for (compno = 0; compno < p_j2k->m_private_image->numcomps; ++compno) {
|
||||
for (compno = 0; compno < p_j2k->m_private_image->numcomps; ++compno) {
|
||||
if (l_tccp->roishift) {
|
||||
|
||||
if (! opj_j2k_write_rgn(p_j2k,0,compno,p_j2k->m_private_image->numcomps,p_stream,p_manager)) {
|
||||
|
@ -6795,7 +6795,11 @@ OPJ_BOOL opj_j2k_read_header( opj_stream_private_t *p_stream,
|
|||
}
|
||||
|
||||
/* customization of the validation */
|
||||
opj_j2k_setup_decoding_validation(p_j2k);
|
||||
if (! opj_j2k_setup_decoding_validation(p_j2k, p_manager)) {
|
||||
opj_image_destroy(p_j2k->m_private_image);
|
||||
p_j2k->m_private_image = NULL;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* validation of the parameters codec */
|
||||
if (! opj_j2k_exec(p_j2k, p_j2k->m_validation_list, p_stream,p_manager)) {
|
||||
|
@ -6805,7 +6809,11 @@ OPJ_BOOL opj_j2k_read_header( opj_stream_private_t *p_stream,
|
|||
}
|
||||
|
||||
/* customization of the encoding */
|
||||
opj_j2k_setup_header_reading(p_j2k);
|
||||
if (! opj_j2k_setup_header_reading(p_j2k, p_manager)) {
|
||||
opj_image_destroy(p_j2k->m_private_image);
|
||||
p_j2k->m_private_image = NULL;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* read header */
|
||||
if (! opj_j2k_exec (p_j2k,p_j2k->m_procedure_list,p_stream,p_manager)) {
|
||||
|
@ -6830,27 +6838,39 @@ OPJ_BOOL opj_j2k_read_header( opj_stream_private_t *p_stream,
|
|||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_j2k_setup_header_reading (opj_j2k_t *p_j2k)
|
||||
static OPJ_BOOL opj_j2k_setup_header_reading (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions*/
|
||||
assert(p_j2k != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_read_header_procedure);
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_read_header_procedure, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* DEVELOPER CORNER, add your custom procedures */
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_copy_default_tcp_and_create_tcd);
|
||||
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_copy_default_tcp_and_create_tcd, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_j2k_setup_decoding_validation (opj_j2k_t *p_j2k)
|
||||
static OPJ_BOOL opj_j2k_setup_decoding_validation (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions*/
|
||||
assert(p_j2k != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list,(opj_procedure)opj_j2k_build_decoder, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list,(opj_procedure)opj_j2k_decoding_validation, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_build_decoder);
|
||||
opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_decoding_validation);
|
||||
/* DEVELOPER CORNER, add your custom validation procedure */
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL opj_j2k_mct_validation ( opj_j2k_t * p_j2k,
|
||||
|
@ -8048,7 +8068,7 @@ OPJ_BOOL opj_j2k_read_tile_header( opj_j2k_t * p_j2k,
|
|||
return OPJ_FALSE;
|
||||
}
|
||||
/*FIXME ???*/
|
||||
if (! opj_tcd_init_decode_tile(p_j2k->m_tcd, p_j2k->m_current_tile_number)) {
|
||||
if (! opj_tcd_init_decode_tile(p_j2k->m_tcd, p_j2k->m_current_tile_number, p_manager)) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Cannot decode tile, memory error\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
@ -8101,7 +8121,7 @@ OPJ_BOOL opj_j2k_decode_tile ( opj_j2k_t * p_j2k,
|
|||
l_tcp->m_data,
|
||||
l_tcp->m_data_size,
|
||||
p_tile_index,
|
||||
p_j2k->cstr_index) ) {
|
||||
p_j2k->cstr_index, p_manager) ) {
|
||||
opj_j2k_tcp_destroy(l_tcp);
|
||||
p_j2k->m_specific_param.m_decoder.m_state |= 0x8000;/*FIXME J2K_DEC_STATE_ERR;*/
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Failed to decode.\n");
|
||||
|
@ -9743,14 +9763,18 @@ static OPJ_BOOL opj_j2k_decode_tiles ( opj_j2k_t *p_j2k,
|
|||
/**
|
||||
* Sets up the procedures to do on decoding data. Developpers wanting to extend the library can add their own reading procedures.
|
||||
*/
|
||||
static void opj_j2k_setup_decoding (opj_j2k_t *p_j2k)
|
||||
static OPJ_BOOL opj_j2k_setup_decoding (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions*/
|
||||
assert(p_j2k != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_decode_tiles);
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_decode_tiles, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/* DEVELOPER CORNER, add your custom procedures */
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -9876,14 +9900,18 @@ static OPJ_BOOL opj_j2k_decode_one_tile ( opj_j2k_t *p_j2k,
|
|||
/**
|
||||
* Sets up the procedures to do on decoding one tile. Developpers wanting to extend the library can add their own reading procedures.
|
||||
*/
|
||||
static void opj_j2k_setup_decoding_tile (opj_j2k_t *p_j2k)
|
||||
static OPJ_BOOL opj_j2k_setup_decoding_tile (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions*/
|
||||
assert(p_j2k != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_decode_one_tile);
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_decode_one_tile, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/* DEVELOPER CORNER, add your custom procedures */
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_j2k_decode(opj_j2k_t * p_j2k,
|
||||
|
@ -9903,7 +9931,7 @@ OPJ_BOOL opj_j2k_decode(opj_j2k_t * p_j2k,
|
|||
opj_copy_image_header(p_image, p_j2k->m_output_image);
|
||||
|
||||
/* customization of the decoding */
|
||||
opj_j2k_setup_decoding(p_j2k);
|
||||
opj_j2k_setup_decoding(p_j2k, p_manager);
|
||||
|
||||
/* Decode the codestream */
|
||||
if (! opj_j2k_exec (p_j2k,p_j2k->m_procedure_list,p_stream,p_manager)) {
|
||||
|
@ -9999,7 +10027,7 @@ OPJ_BOOL opj_j2k_get_tile( opj_j2k_t *p_j2k,
|
|||
p_j2k->m_specific_param.m_decoder.m_tile_ind_to_dec = (OPJ_INT32)tile_index;
|
||||
|
||||
/* customization of the decoding */
|
||||
opj_j2k_setup_decoding_tile(p_j2k);
|
||||
opj_j2k_setup_decoding_tile(p_j2k, p_manager);
|
||||
|
||||
/* Decode the codestream */
|
||||
if (! opj_j2k_exec (p_j2k,p_j2k->m_procedure_list,p_stream,p_manager)) {
|
||||
|
@ -10139,7 +10167,9 @@ OPJ_BOOL opj_j2k_end_compress( opj_j2k_t *p_j2k,
|
|||
opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* customization of the encoding */
|
||||
opj_j2k_setup_end_compress(p_j2k);
|
||||
if (! opj_j2k_setup_end_compress(p_j2k, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if (! opj_j2k_exec (p_j2k, p_j2k->m_procedure_list, p_stream, p_manager))
|
||||
{
|
||||
|
@ -10179,7 +10209,9 @@ OPJ_BOOL opj_j2k_start_compress(opj_j2k_t *p_j2k,
|
|||
}
|
||||
|
||||
/* customization of the validation */
|
||||
opj_j2k_setup_encoding_validation (p_j2k);
|
||||
if (! opj_j2k_setup_encoding_validation (p_j2k, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* validation of the parameters codec */
|
||||
if (! opj_j2k_exec(p_j2k,p_j2k->m_validation_list,p_stream,p_manager)) {
|
||||
|
@ -10187,7 +10219,9 @@ OPJ_BOOL opj_j2k_start_compress(opj_j2k_t *p_j2k,
|
|||
}
|
||||
|
||||
/* customization of the encoding */
|
||||
opj_j2k_setup_header_writing(p_j2k);
|
||||
if (! opj_j2k_setup_header_writing(p_j2k, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* write header */
|
||||
if (! opj_j2k_exec (p_j2k,p_j2k->m_procedure_list,p_stream,p_manager)) {
|
||||
|
@ -10215,7 +10249,7 @@ static OPJ_BOOL opj_j2k_pre_write_tile ( opj_j2k_t * p_j2k,
|
|||
p_j2k->m_specific_param.m_encoder.m_current_poc_tile_part_number = 0;
|
||||
|
||||
/* initialisation before tile encoding */
|
||||
if (! opj_tcd_init_encode_tile(p_j2k->m_tcd, p_j2k->m_current_tile_number)) {
|
||||
if (! opj_tcd_init_encode_tile(p_j2k->m_tcd, p_j2k->m_current_tile_number, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
@ -10388,74 +10422,128 @@ static OPJ_BOOL opj_j2k_post_write_tile ( opj_j2k_t * p_j2k,
|
|||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_j2k_setup_end_compress (opj_j2k_t *p_j2k)
|
||||
static OPJ_BOOL opj_j2k_setup_end_compress (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(p_j2k != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
/* DEVELOPER CORNER, insert your custom procedures */
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_eoc );
|
||||
|
||||
if (OPJ_IS_CINEMA(p_j2k->m_cp.rsiz)) {
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_updated_tlm);
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_eoc, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_epc );
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_end_encoding );
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_destroy_header_memory);
|
||||
}
|
||||
|
||||
static void opj_j2k_setup_encoding_validation (opj_j2k_t *p_j2k)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(p_j2k != 00);
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_build_encoder);
|
||||
opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_encoding_validation);
|
||||
|
||||
/* DEVELOPER CORNER, add your custom validation procedure */
|
||||
opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_mct_validation);
|
||||
}
|
||||
|
||||
static void opj_j2k_setup_header_writing (opj_j2k_t *p_j2k)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(p_j2k != 00);
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_init_info );
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_soc );
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_siz );
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_cod );
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_qcd );
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_all_coc );
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_all_qcc );
|
||||
|
||||
if (OPJ_IS_CINEMA(p_j2k->m_cp.rsiz)) {
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_tlm );
|
||||
|
||||
if (p_j2k->m_cp.rsiz == OPJ_PROFILE_CINEMA_4K) {
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_poc );
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_updated_tlm, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_regions);
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_epc, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_end_encoding, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_destroy_header_memory, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL opj_j2k_setup_encoding_validation (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(p_j2k != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_build_encoder, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_encoding_validation, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* DEVELOPER CORNER, add your custom validation procedure */
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_mct_validation, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL opj_j2k_setup_header_writing (opj_j2k_t *p_j2k, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(p_j2k != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_init_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_soc, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_siz, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_cod, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_qcd, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_all_coc, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_all_qcc, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if (OPJ_IS_CINEMA(p_j2k->m_cp.rsiz)) {
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_tlm, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if (p_j2k->m_cp.rsiz == OPJ_PROFILE_CINEMA_4K) {
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_poc, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_regions, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if (p_j2k->m_cp.comment != 00) {
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_com);
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_com, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* DEVELOPER CORNER, insert your custom procedures */
|
||||
if (p_j2k->m_cp.rsiz & OPJ_EXTENSION_MCT) {
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_mct_data_group );
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_mct_data_group, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
/* End of Developer Corner */
|
||||
|
||||
if (p_j2k->cstr_index) {
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_get_end_header );
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_get_end_header, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_create_tcd);
|
||||
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_update_rates);
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_create_tcd, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_update_rates, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL opj_j2k_write_first_tile_part (opj_j2k_t *p_j2k,
|
||||
|
|
|
@ -266,7 +266,7 @@ typedef struct opj_tcp
|
|||
/** ppt markers data (table indexed by Zppt) */
|
||||
opj_ppx* ppt_markers;
|
||||
|
||||
/** packet header store there for futur use in t2_decode_packet */
|
||||
/** packet header store there for future use in t2_decode_packet */
|
||||
OPJ_BYTE *ppt_data;
|
||||
/** used to keep a track of the allocated memory */
|
||||
OPJ_BYTE *ppt_buffer;
|
||||
|
@ -376,7 +376,7 @@ typedef struct opj_cp
|
|||
/** ppm markers data (table indexed by Zppm) */
|
||||
opj_ppx* ppm_markers;
|
||||
|
||||
/** packet header store there for futur use in t2_decode_packet */
|
||||
/** packet header store there for future use in t2_decode_packet */
|
||||
OPJ_BYTE *ppm_data;
|
||||
/** size of the ppm_data*/
|
||||
OPJ_UINT32 ppm_len;
|
||||
|
|
|
@ -106,7 +106,7 @@ static OPJ_BOOL opj_jp2_read_cdef( opj_jp2_t * jp2,
|
|||
OPJ_UINT32 p_cdef_header_size,
|
||||
opj_event_mgr_t * p_manager );
|
||||
|
||||
static void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color);
|
||||
static void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color, opj_event_mgr_t *);
|
||||
|
||||
/**
|
||||
* Writes the Channel Definition box.
|
||||
|
@ -326,13 +326,13 @@ static OPJ_BOOL opj_jp2_read_colr( opj_jp2_t *jp2,
|
|||
* Sets up the procedures to do on writing header after the codestream.
|
||||
* Developpers wanting to extend the library can add their own writing procedures.
|
||||
*/
|
||||
static void opj_jp2_setup_end_header_writing (opj_jp2_t *jp2);
|
||||
static OPJ_BOOL opj_jp2_setup_end_header_writing (opj_jp2_t *jp2, opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Sets up the procedures to do on reading header after the codestream.
|
||||
* Developpers wanting to extend the library can add their own writing procedures.
|
||||
*/
|
||||
static void opj_jp2_setup_end_header_reading (opj_jp2_t *jp2);
|
||||
static OPJ_BOOL opj_jp2_setup_end_header_reading (opj_jp2_t *jp2, opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Reads a jpeg2000 file header structure.
|
||||
|
@ -381,12 +381,12 @@ static OPJ_BOOL opj_jp2_read_boxhdr(opj_jp2_box_t *box,
|
|||
* Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters
|
||||
* are valid. Developpers wanting to extend the library can add their own validation procedures.
|
||||
*/
|
||||
static void opj_jp2_setup_encoding_validation (opj_jp2_t *jp2);
|
||||
static OPJ_BOOL opj_jp2_setup_encoding_validation (opj_jp2_t *jp2, opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Sets up the procedures to do on writing header. Developpers wanting to extend the library can add their own writing procedures.
|
||||
*/
|
||||
static void opj_jp2_setup_header_writing (opj_jp2_t *jp2);
|
||||
static OPJ_BOOL opj_jp2_setup_header_writing (opj_jp2_t *jp2, opj_event_mgr_t * p_manager);
|
||||
|
||||
static OPJ_BOOL opj_jp2_default_validation ( opj_jp2_t * jp2,
|
||||
opj_stream_private_t *cio,
|
||||
|
@ -449,13 +449,13 @@ static OPJ_BOOL opj_jp2_read_boxhdr_char( opj_jp2_box_t *box,
|
|||
* Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters
|
||||
* are valid. Developpers wanting to extend the library can add their own validation procedures.
|
||||
*/
|
||||
static void opj_jp2_setup_decoding_validation (opj_jp2_t *jp2);
|
||||
static OPJ_BOOL opj_jp2_setup_decoding_validation (opj_jp2_t *jp2, opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Sets up the procedures to do on reading header.
|
||||
* Developpers wanting to extend the library can add their own writing procedures.
|
||||
*/
|
||||
static void opj_jp2_setup_header_reading (opj_jp2_t *jp2);
|
||||
static OPJ_BOOL opj_jp2_setup_header_reading (opj_jp2_t *jp2, opj_event_mgr_t * p_manager);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
static OPJ_BOOL opj_jp2_read_boxhdr(opj_jp2_box_t *box,
|
||||
|
@ -1210,7 +1210,7 @@ static OPJ_BOOL opj_jp2_read_cmap( opj_jp2_t * jp2,
|
|||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
|
||||
static void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color, opj_event_mgr_t *manager)
|
||||
{
|
||||
opj_jp2_cdef_info_t *info;
|
||||
OPJ_UINT16 i, n, cn, asoc, acn;
|
||||
|
@ -1226,7 +1226,7 @@ static void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
|
|||
|
||||
if( cn >= image->numcomps)
|
||||
{
|
||||
fprintf(stderr, "cn=%d, numcomps=%d\n", cn, image->numcomps);
|
||||
opj_event_msg(manager, EVT_WARNING, "opj_jp2_apply_cdef: cn=%d, numcomps=%d\n", cn, image->numcomps);
|
||||
continue;
|
||||
}
|
||||
if(asoc == 0 || asoc == 65535)
|
||||
|
@ -1238,7 +1238,7 @@ static void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
|
|||
acn = (OPJ_UINT16)(asoc - 1);
|
||||
if( acn >= image->numcomps )
|
||||
{
|
||||
fprintf(stderr, "acn=%d, numcomps=%d\n", acn, image->numcomps);
|
||||
opj_event_msg(manager, EVT_WARNING, "opj_jp2_apply_cdef: acn=%d, numcomps=%d\n", acn, image->numcomps);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1465,7 +1465,7 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
|||
|
||||
/* Apply the color space if needed */
|
||||
if(jp2->color.jp2_cdef) {
|
||||
opj_jp2_apply_cdef(p_image, &(jp2->color));
|
||||
opj_jp2_apply_cdef(p_image, &(jp2->color), p_manager);
|
||||
}
|
||||
|
||||
if(jp2->color.icc_profile_buf) {
|
||||
|
@ -1899,7 +1899,9 @@ OPJ_BOOL opj_jp2_end_decompress(opj_jp2_t *jp2,
|
|||
assert(p_manager != 00);
|
||||
|
||||
/* customization of the end encoding */
|
||||
opj_jp2_setup_end_header_reading(jp2);
|
||||
if (! opj_jp2_setup_end_header_reading(jp2, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* write header */
|
||||
if (! opj_jp2_exec (jp2,jp2->m_procedure_list,cio,p_manager)) {
|
||||
|
@ -1920,7 +1922,9 @@ OPJ_BOOL opj_jp2_end_compress( opj_jp2_t *jp2,
|
|||
assert(p_manager != 00);
|
||||
|
||||
/* customization of the end encoding */
|
||||
opj_jp2_setup_end_header_writing(jp2);
|
||||
if (! opj_jp2_setup_end_header_writing(jp2, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if (! opj_j2k_end_compress(jp2->j2k,cio,p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
|
@ -1930,32 +1934,49 @@ OPJ_BOOL opj_jp2_end_compress( opj_jp2_t *jp2,
|
|||
return opj_jp2_exec(jp2,jp2->m_procedure_list,cio,p_manager);
|
||||
}
|
||||
|
||||
static void opj_jp2_setup_end_header_writing (opj_jp2_t *jp2)
|
||||
static OPJ_BOOL opj_jp2_setup_end_header_writing (opj_jp2_t *jp2, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(jp2 != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
#ifdef USE_JPIP
|
||||
if( jp2->jpip_on )
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jpip_write_iptr );
|
||||
if( jp2->jpip_on ) {
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jpip_write_iptr, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_jp2c );
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_jp2c, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/* DEVELOPER CORNER, add your custom procedures */
|
||||
#ifdef USE_JPIP
|
||||
if( jp2->jpip_on )
|
||||
{
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jpip_write_cidx );
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jpip_write_fidx );
|
||||
}
|
||||
{
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jpip_write_cidx, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jpip_write_fidx, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_jp2_setup_end_header_reading (opj_jp2_t *jp2)
|
||||
static OPJ_BOOL opj_jp2_setup_end_header_reading (opj_jp2_t *jp2, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(jp2 != 00);
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_read_header_procedure );
|
||||
assert(p_manager != 00);
|
||||
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_read_header_procedure, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/* DEVELOPER CORNER, add your custom procedures */
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL opj_jp2_default_validation ( opj_jp2_t * jp2,
|
||||
|
@ -2190,7 +2211,9 @@ OPJ_BOOL opj_jp2_start_compress(opj_jp2_t *jp2,
|
|||
assert(p_manager != 00);
|
||||
|
||||
/* customization of the validation */
|
||||
opj_jp2_setup_encoding_validation (jp2);
|
||||
if (! opj_jp2_setup_encoding_validation (jp2, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* validation of the parameters codec */
|
||||
if (! opj_jp2_exec(jp2,jp2->m_validation_list,stream,p_manager)) {
|
||||
|
@ -2198,7 +2221,9 @@ OPJ_BOOL opj_jp2_start_compress(opj_jp2_t *jp2,
|
|||
}
|
||||
|
||||
/* customization of the encoding */
|
||||
opj_jp2_setup_header_writing(jp2);
|
||||
if (! opj_jp2_setup_header_writing(jp2, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* write header */
|
||||
if (! opj_jp2_exec (jp2,jp2->m_procedure_list,stream,p_manager)) {
|
||||
|
@ -2552,10 +2577,14 @@ OPJ_BOOL opj_jp2_read_header( opj_stream_private_t *p_stream,
|
|||
assert(p_manager != 00);
|
||||
|
||||
/* customization of the validation */
|
||||
opj_jp2_setup_decoding_validation (jp2);
|
||||
if (! opj_jp2_setup_decoding_validation (jp2, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* customization of the encoding */
|
||||
opj_jp2_setup_header_reading(jp2);
|
||||
if (! opj_jp2_setup_header_reading(jp2, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* validation of the parameters codec */
|
||||
if (! opj_jp2_exec(jp2,jp2->m_validation_list,p_stream,p_manager)) {
|
||||
|
@ -2573,45 +2602,73 @@ OPJ_BOOL opj_jp2_read_header( opj_stream_private_t *p_stream,
|
|||
p_manager);
|
||||
}
|
||||
|
||||
static void opj_jp2_setup_encoding_validation (opj_jp2_t *jp2)
|
||||
static OPJ_BOOL opj_jp2_setup_encoding_validation (opj_jp2_t *jp2, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(jp2 != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
opj_procedure_list_add_procedure(jp2->m_validation_list, (opj_procedure)opj_jp2_default_validation);
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_validation_list, (opj_procedure)opj_jp2_default_validation, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/* DEVELOPER CORNER, add your custom validation procedure */
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_jp2_setup_decoding_validation (opj_jp2_t *jp2)
|
||||
static OPJ_BOOL opj_jp2_setup_decoding_validation (opj_jp2_t *jp2, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(jp2 != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
/* DEVELOPER CORNER, add your custom validation procedure */
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_jp2_setup_header_writing (opj_jp2_t *jp2)
|
||||
static OPJ_BOOL opj_jp2_setup_header_writing (opj_jp2_t *jp2, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(jp2 != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_jp );
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_ftyp );
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_jp2h );
|
||||
if( jp2->jpip_on )
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jpip_skip_iptr );
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_skip_jp2c );
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_jp, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_ftyp, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_write_jp2h, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if( jp2->jpip_on ) {
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jpip_skip_iptr, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_skip_jp2c,p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* DEVELOPER CORNER, insert your custom procedures */
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_jp2_setup_header_reading (opj_jp2_t *jp2)
|
||||
static OPJ_BOOL opj_jp2_setup_header_reading (opj_jp2_t *jp2, opj_event_mgr_t * p_manager)
|
||||
{
|
||||
/* preconditions */
|
||||
assert(jp2 != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_read_header_procedure );
|
||||
if (! opj_procedure_list_add_procedure(jp2->m_procedure_list,(opj_procedure)opj_jp2_read_header_procedure, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* DEVELOPER CORNER, add your custom procedures */
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_jp2_read_tile_header ( opj_jp2_t * p_jp2,
|
||||
|
@ -2780,7 +2837,7 @@ OPJ_BOOL opj_jp2_get_tile( opj_jp2_t *p_jp2,
|
|||
|
||||
/* Apply the color space if needed */
|
||||
if(p_jp2->color.jp2_cdef) {
|
||||
opj_jp2_apply_cdef(p_image, &(p_jp2->color));
|
||||
opj_jp2_apply_cdef(p_image, &(p_jp2->color), p_manager);
|
||||
}
|
||||
|
||||
if(p_jp2->color.icc_profile_buf) {
|
||||
|
|
|
@ -866,7 +866,8 @@ void OPJ_CALLCONV opj_dump_codec( opj_codec_t *p_codec,
|
|||
return;
|
||||
}
|
||||
|
||||
fprintf(stderr, "[ERROR] Input parameter of the dump_codec function are incorrect.\n");
|
||||
/* TODO return error */
|
||||
/* fprintf(stderr, "[ERROR] Input parameter of the dump_codec function are incorrect.\n"); */
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,16 +167,16 @@ static INLINE long opj_lrintf(float f) {
|
|||
#endif
|
||||
|
||||
/* MSVC x86 is really bad at doing int64 = int32 * int32 on its own. Use intrinsic. */
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(__emul)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(__emul)
|
||||
#endif
|
||||
|
||||
#include "opj_inttypes.h"
|
||||
#include "opj_clock.h"
|
||||
#include "opj_malloc.h"
|
||||
#include "function_list.h"
|
||||
#include "event.h"
|
||||
#include "function_list.h"
|
||||
#include "bio.h"
|
||||
#include "cio.h"
|
||||
|
||||
|
|
|
@ -97,7 +97,8 @@ static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* t2,
|
|||
OPJ_BYTE *src,
|
||||
OPJ_UINT32 * data_read,
|
||||
OPJ_UINT32 max_length,
|
||||
opj_packet_info_t *pack_info);
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
|
@ -106,7 +107,8 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
|||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info);
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
|
@ -116,7 +118,8 @@ static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
|||
OPJ_BYTE *p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info);
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
|
@ -124,14 +127,16 @@ static OPJ_BOOL opj_t2_read_packet_data(opj_t2_t* p_t2,
|
|||
OPJ_BYTE *p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *pack_info);
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_t2_skip_packet_data(opj_t2_t* p_t2,
|
||||
opj_tcd_tile_t *p_tile,
|
||||
opj_pi_iterator_t *p_pi,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *pack_info);
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
/**
|
||||
@param cblk
|
||||
|
@ -345,7 +350,8 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
|
|||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_len,
|
||||
opj_codestream_index_t *p_cstr_index)
|
||||
opj_codestream_index_t *p_cstr_index,
|
||||
opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_BYTE *l_current_data = p_src;
|
||||
opj_pi_iterator_t *l_pi = 00;
|
||||
|
@ -413,7 +419,7 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
|
|||
|
||||
first_pass_failed[l_current_pi->compno] = OPJ_FALSE;
|
||||
|
||||
if (! opj_t2_decode_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info)) {
|
||||
if (! opj_t2_decode_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info, p_manager)) {
|
||||
opj_pi_destroy(l_pi,l_nb_pocs);
|
||||
opj_free(first_pass_failed);
|
||||
return OPJ_FALSE;
|
||||
|
@ -424,7 +430,7 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *p_t2,
|
|||
}
|
||||
else {
|
||||
l_nb_bytes_read = 0;
|
||||
if (! opj_t2_skip_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info)) {
|
||||
if (! opj_t2_skip_packet(p_t2,p_tile,l_tcp,l_current_pi,l_current_data,&l_nb_bytes_read,p_max_len,l_pack_info, p_manager)) {
|
||||
opj_pi_destroy(l_pi,l_nb_pocs);
|
||||
opj_free(first_pass_failed);
|
||||
return OPJ_FALSE;
|
||||
|
@ -518,7 +524,8 @@ static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
|
|||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info)
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_BOOL l_read_data;
|
||||
OPJ_UINT32 l_nb_bytes_read = 0;
|
||||
|
@ -526,7 +533,7 @@ static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
|
|||
|
||||
*p_data_read = 0;
|
||||
|
||||
if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_src,&l_nb_bytes_read,p_max_length,p_pack_info)) {
|
||||
if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_src,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
@ -538,7 +545,7 @@ static OPJ_BOOL opj_t2_decode_packet( opj_t2_t* p_t2,
|
|||
if (l_read_data) {
|
||||
l_nb_bytes_read = 0;
|
||||
|
||||
if (! opj_t2_read_packet_data(p_t2,p_tile,p_pi,p_src,&l_nb_bytes_read,p_max_length,p_pack_info)) {
|
||||
if (! opj_t2_read_packet_data(p_t2,p_tile,p_pi,p_src,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
@ -793,7 +800,8 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
|||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info)
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_BOOL l_read_data;
|
||||
OPJ_UINT32 l_nb_bytes_read = 0;
|
||||
|
@ -801,7 +809,7 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
|||
|
||||
*p_data_read = 0;
|
||||
|
||||
if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_src,&l_nb_bytes_read,p_max_length,p_pack_info)) {
|
||||
if (! opj_t2_read_packet_header(p_t2,p_tile,p_tcp,p_pi,&l_read_data,p_src,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
@ -813,7 +821,7 @@ static OPJ_BOOL opj_t2_skip_packet( opj_t2_t* p_t2,
|
|||
if (l_read_data) {
|
||||
l_nb_bytes_read = 0;
|
||||
|
||||
if (! opj_t2_skip_packet_data(p_t2,p_tile,p_pi,&l_nb_bytes_read,p_max_length,p_pack_info)) {
|
||||
if (! opj_t2_skip_packet_data(p_t2,p_tile,p_pi,&l_nb_bytes_read,p_max_length,p_pack_info, p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
@ -833,7 +841,8 @@ static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
|||
OPJ_BYTE *p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *p_pack_info)
|
||||
opj_packet_info_t *p_pack_info,
|
||||
opj_event_mgr_t *p_manager)
|
||||
|
||||
{
|
||||
/* loop */
|
||||
|
@ -882,11 +891,9 @@ static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
|||
|
||||
if (p_tcp->csty & J2K_CP_CSTY_SOP) {
|
||||
if (p_max_length < 6) {
|
||||
/* TODO opj_event_msg(p_t2->cinfo->event_mgr, EVT_WARNING, "Not enough space for expected SOP marker\n"); */
|
||||
fprintf(stderr, "Not enough space for expected SOP marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Not enough space for expected SOP marker\n");
|
||||
} else if ((*l_current_data) != 0xff || (*(l_current_data + 1) != 0x91)) {
|
||||
/* TODO opj_event_msg(p_t2->cinfo->event_mgr, EVT_WARNING, "Expected SOP marker\n"); */
|
||||
fprintf(stderr, "Warning: expected SOP marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Expected SOP marker\n");
|
||||
} else {
|
||||
l_current_data += 6;
|
||||
}
|
||||
|
@ -937,9 +944,9 @@ static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
|||
/* EPH markers */
|
||||
if (p_tcp->csty & J2K_CP_CSTY_EPH) {
|
||||
if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data - *l_header_data_start)) < 2U) {
|
||||
fprintf(stderr, "Not enough space for expected EPH marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Not enough space for expected EPH marker\n");
|
||||
} else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
|
||||
fprintf(stderr, "Error : expected EPH marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Expected EPH marker\n");
|
||||
} else {
|
||||
l_header_data += 2;
|
||||
}
|
||||
|
@ -990,7 +997,7 @@ static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
|||
if (!l_included) {
|
||||
l_cblk->numnewpasses = 0;
|
||||
++l_cblk;
|
||||
JAS_FPRINTF(stderr, "included=%d \n", l_included);
|
||||
JAS_FPRINTF(stderr, "included=%d \n", l_included);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1065,10 +1072,9 @@ static OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
|||
/* EPH markers */
|
||||
if (p_tcp->csty & J2K_CP_CSTY_EPH) {
|
||||
if ((*l_modified_length_ptr - (OPJ_UINT32)(l_header_data - *l_header_data_start)) < 2U) {
|
||||
fprintf(stderr, "Not enough space for expected EPH marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Not enough space for expected EPH marker\n");
|
||||
} else if ((*l_header_data) != 0xff || (*(l_header_data + 1) != 0x92)) {
|
||||
/* TODO opj_event_msg(t2->cinfo->event_mgr, EVT_ERROR, "Expected EPH marker\n"); */
|
||||
fprintf(stderr, "Error : expected EPH marker\n");
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Expected EPH marker\n");
|
||||
} else {
|
||||
l_header_data += 2;
|
||||
}
|
||||
|
@ -1100,7 +1106,8 @@ static OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
|
|||
OPJ_BYTE *p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *pack_info)
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t* p_manager)
|
||||
{
|
||||
OPJ_UINT32 bandno, cblkno;
|
||||
OPJ_UINT32 l_nb_code_blocks;
|
||||
|
@ -1150,8 +1157,8 @@ static OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
|
|||
do {
|
||||
/* Check possible overflow (on l_current_data only, assumes input args already checked) then size */
|
||||
if ((((OPJ_SIZE_T)l_current_data + (OPJ_SIZE_T)l_seg->newlen) < (OPJ_SIZE_T)l_current_data) || (l_current_data + l_seg->newlen > p_src_data + p_max_length)) {
|
||||
fprintf(stderr, "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
opj_event_msg(p_manager, EVT_ERROR, "read: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1161,22 +1168,22 @@ static OPJ_BOOL opj_t2_read_packet_data( opj_t2_t* p_t2,
|
|||
|
||||
/* let's check that we are not exceeding */
|
||||
if ((l_cblk->len + l_seg->newlen) > 8192) {
|
||||
opj_event_msg(p_t2->cinfo, EVT_WARNING,
|
||||
opj_event_msg(p_manager, EVT_WARNING,
|
||||
"JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
if (!JPWL_ASSUME) {
|
||||
opj_event_msg(p_t2->cinfo, EVT_ERROR, "JPWL: giving up\n");
|
||||
opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
l_seg->newlen = 8192 - l_cblk->len;
|
||||
opj_event_msg(p_t2->cinfo, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
|
||||
opj_event_msg(p_manager, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
|
||||
break;
|
||||
};
|
||||
|
||||
#endif /* USE_JPWL */
|
||||
/* Check possible overflow on size */
|
||||
if ((l_cblk->data_current_size + l_seg->newlen) < l_cblk->data_current_size) {
|
||||
fprintf(stderr, "read: segment too long (%d) with current size (%d > %d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
opj_event_msg(p_manager, EVT_ERROR, "read: segment too long (%d) with current size (%d > %d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, l_cblk->data_current_size, 0xFFFFFFFF - l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
@ -1233,7 +1240,8 @@ static OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
|
|||
opj_pi_iterator_t *p_pi,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_length,
|
||||
opj_packet_info_t *pack_info)
|
||||
opj_packet_info_t *pack_info,
|
||||
opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_UINT32 bandno, cblkno;
|
||||
OPJ_UINT32 l_nb_code_blocks;
|
||||
|
@ -1284,7 +1292,7 @@ static OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
|
|||
do {
|
||||
/* Check possible overflow then size */
|
||||
if (((*p_data_read + l_seg->newlen) < (*p_data_read)) || ((*p_data_read + l_seg->newlen) > p_max_length)) {
|
||||
fprintf(stderr, "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
opj_event_msg(p_manager, EVT_ERROR, "skip: segment too long (%d) with max (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, p_max_length, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
@ -1295,15 +1303,15 @@ static OPJ_BOOL opj_t2_skip_packet_data( opj_t2_t* p_t2,
|
|||
|
||||
/* let's check that we are not exceeding */
|
||||
if ((l_cblk->len + l_seg->newlen) > 8192) {
|
||||
opj_event_msg(p_t2->cinfo, EVT_WARNING,
|
||||
opj_event_msg(p_manager, EVT_WARNING,
|
||||
"JPWL: segment too long (%d) for codeblock %d (p=%d, b=%d, r=%d, c=%d)\n",
|
||||
l_seg->newlen, cblkno, p_pi->precno, bandno, p_pi->resno, p_pi->compno);
|
||||
if (!JPWL_ASSUME) {
|
||||
opj_event_msg(p_t2->cinfo, EVT_ERROR, "JPWL: giving up\n");
|
||||
opj_event_msg(p_manager, EVT_ERROR, "JPWL: giving up\n");
|
||||
return -999;
|
||||
}
|
||||
l_seg->newlen = 8192 - l_cblk->len;
|
||||
opj_event_msg(p_t2->cinfo, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
|
||||
opj_event_msg(p_manager, EVT_WARNING, " - truncating segment to %d\n", l_seg->newlen);
|
||||
break;
|
||||
};
|
||||
|
||||
|
|
|
@ -108,7 +108,8 @@ OPJ_BOOL opj_t2_decode_packets( opj_t2_t *t2,
|
|||
OPJ_BYTE *src,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 len,
|
||||
opj_codestream_index_t *cstr_info);
|
||||
opj_codestream_index_t *cstr_info,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
/**
|
||||
* Creates a Tier 2 handle
|
||||
|
|
|
@ -107,7 +107,7 @@ void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t * img) {
|
|||
/**
|
||||
* Initializes tile coding/decoding
|
||||
*/
|
||||
static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block);
|
||||
static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block, opj_event_mgr_t* manager);
|
||||
|
||||
/**
|
||||
* Allocates memory for a decoding code block.
|
||||
|
@ -146,13 +146,14 @@ static OPJ_BOOL opj_tcd_t2_decode ( opj_tcd_t *p_tcd,
|
|||
OPJ_BYTE * p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_src_size,
|
||||
opj_codestream_index_t *p_cstr_index );
|
||||
opj_codestream_index_t *p_cstr_index,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_tcd_t1_decode (opj_tcd_t *p_tcd);
|
||||
|
||||
static OPJ_BOOL opj_tcd_dwt_decode (opj_tcd_t *p_tcd);
|
||||
|
||||
static OPJ_BOOL opj_tcd_mct_decode (opj_tcd_t *p_tcd);
|
||||
static OPJ_BOOL opj_tcd_mct_decode (opj_tcd_t *p_tcd, opj_event_mgr_t *p_manager);
|
||||
|
||||
static OPJ_BOOL opj_tcd_dc_level_shift_decode (opj_tcd_t *p_tcd);
|
||||
|
||||
|
@ -655,7 +656,7 @@ OPJ_BOOL opj_alloc_tile_component_data(opj_tcd_tilecomp_t *l_tilec)
|
|||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block)
|
||||
static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block, opj_event_mgr_t* manager)
|
||||
{
|
||||
OPJ_UINT32 (*l_gain_ptr)(OPJ_UINT32) = 00;
|
||||
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
|
||||
|
@ -711,7 +712,7 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
|
|||
|
||||
/* testcase 1888.pdf.asan.35.988 */
|
||||
if (l_tccp->numresolutions == 0) {
|
||||
fprintf(stderr, "tiles require at least one resolution\n");
|
||||
opj_event_msg(manager, EVT_ERROR, "tiles require at least one resolution\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/*fprintf(stderr, "Tile border = %d,%d,%d,%d\n", l_tile->x0, l_tile->y0,l_tile->x1,l_tile->y1);*/
|
||||
|
@ -730,13 +731,13 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
|
|||
/* compute l_data_size with overflow check */
|
||||
l_data_size = (OPJ_UINT32)(l_tilec->x1 - l_tilec->x0);
|
||||
if ((((OPJ_UINT32)-1) / l_data_size) < (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0)) {
|
||||
/* TODO event */
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile data\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
l_data_size = l_data_size * (OPJ_UINT32)(l_tilec->y1 - l_tilec->y0);
|
||||
|
||||
if ((((OPJ_UINT32)-1) / (OPJ_UINT32)sizeof(OPJ_UINT32)) < l_data_size) {
|
||||
/* TODO event */
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile data\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
l_data_size = l_data_size * (OPJ_UINT32)sizeof(OPJ_UINT32);
|
||||
|
@ -750,6 +751,7 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
|
|||
|
||||
l_tilec->data_size_needed = l_data_size;
|
||||
if (p_tcd->m_is_decoder && !opj_alloc_tile_component_data(l_tilec)) {
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile data\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
|
@ -767,8 +769,7 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
|
|||
else if (l_data_size > l_tilec->resolutions_size) {
|
||||
opj_tcd_resolution_t* new_resolutions = (opj_tcd_resolution_t *) opj_realloc(l_tilec->resolutions, l_data_size);
|
||||
if (! new_resolutions) {
|
||||
/* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to tile resolutions\n"); */
|
||||
fprintf(stderr, "Not enough memory to tile resolutions\n");
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory for tile resolutions\n");
|
||||
opj_free(l_tilec->resolutions);
|
||||
l_tilec->resolutions = NULL;
|
||||
l_tilec->resolutions_size = 0;
|
||||
|
@ -886,8 +887,7 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
|
|||
|
||||
opj_tcd_precinct_t * new_precincts = (opj_tcd_precinct_t *) opj_realloc(l_band->precincts,/*3 * */ l_nb_precinct_size);
|
||||
if (! new_precincts) {
|
||||
/* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to handle band precints\n"); */
|
||||
fprintf(stderr, "Not enough memory to handle band precints\n");
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory to handle band precints\n");
|
||||
opj_free(l_band->precincts);
|
||||
l_band->precincts = NULL;
|
||||
l_band->precincts_data_size = 0;
|
||||
|
@ -950,8 +950,7 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
|
|||
opj_free(l_current_precinct->cblks.blocks);
|
||||
l_current_precinct->cblks.blocks = NULL;
|
||||
l_current_precinct->block_size = 0;
|
||||
/* opj_event_msg(p_manager, EVT_ERROR, "Not enough memory for current precinct codeblock element\n"); */
|
||||
fprintf(stderr, "Not enough memory for current precinct codeblock element\n");
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory for current precinct codeblock element\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
l_current_precinct->cblks.blocks = new_blocks;
|
||||
|
@ -965,34 +964,26 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
|
|||
}
|
||||
|
||||
if (! l_current_precinct->incltree) {
|
||||
l_current_precinct->incltree = opj_tgt_create(l_current_precinct->cw,
|
||||
l_current_precinct->ch);
|
||||
l_current_precinct->incltree = opj_tgt_create(l_current_precinct->cw, l_current_precinct->ch, manager);
|
||||
}
|
||||
else{
|
||||
l_current_precinct->incltree = opj_tgt_init(l_current_precinct->incltree,
|
||||
l_current_precinct->cw,
|
||||
l_current_precinct->ch);
|
||||
l_current_precinct->incltree = opj_tgt_init(l_current_precinct->incltree, l_current_precinct->cw, l_current_precinct->ch, manager);
|
||||
}
|
||||
|
||||
if (! l_current_precinct->incltree) {
|
||||
fprintf(stderr, "WARNING: No incltree created.\n");
|
||||
opj_event_msg(manager, EVT_WARNING, "No incltree created.\n");
|
||||
/*return OPJ_FALSE;*/
|
||||
}
|
||||
|
||||
if (! l_current_precinct->imsbtree) {
|
||||
l_current_precinct->imsbtree = opj_tgt_create(
|
||||
l_current_precinct->cw,
|
||||
l_current_precinct->ch);
|
||||
l_current_precinct->imsbtree = opj_tgt_create(l_current_precinct->cw, l_current_precinct->ch, manager);
|
||||
}
|
||||
else {
|
||||
l_current_precinct->imsbtree = opj_tgt_init(
|
||||
l_current_precinct->imsbtree,
|
||||
l_current_precinct->cw,
|
||||
l_current_precinct->ch);
|
||||
l_current_precinct->imsbtree = opj_tgt_init(l_current_precinct->imsbtree, l_current_precinct->cw, l_current_precinct->ch, manager);
|
||||
}
|
||||
|
||||
if (! l_current_precinct->imsbtree) {
|
||||
fprintf(stderr, "WARNING: No imsbtree created.\n");
|
||||
opj_event_msg(manager, EVT_WARNING, "No imsbtree created.\n");
|
||||
/*return OPJ_FALSE;*/
|
||||
}
|
||||
|
||||
|
@ -1045,14 +1036,14 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
|
|||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_tcd_init_encode_tile (opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no)
|
||||
OPJ_BOOL opj_tcd_init_encode_tile (opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager)
|
||||
{
|
||||
return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_TRUE, 1.0F, sizeof(opj_tcd_cblk_enc_t));
|
||||
return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_TRUE, 1.0F, sizeof(opj_tcd_cblk_enc_t), p_manager);
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_tcd_init_decode_tile (opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no)
|
||||
OPJ_BOOL opj_tcd_init_decode_tile (opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager)
|
||||
{
|
||||
return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_FALSE, 0.5F, sizeof(opj_tcd_cblk_dec_t));
|
||||
return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_FALSE, 0.5F, sizeof(opj_tcd_cblk_dec_t), p_manager);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1266,7 +1257,8 @@ OPJ_BOOL opj_tcd_decode_tile( opj_tcd_t *p_tcd,
|
|||
OPJ_BYTE *p_src,
|
||||
OPJ_UINT32 p_max_length,
|
||||
OPJ_UINT32 p_tile_no,
|
||||
opj_codestream_index_t *p_cstr_index
|
||||
opj_codestream_index_t *p_cstr_index,
|
||||
opj_event_mgr_t *p_manager
|
||||
)
|
||||
{
|
||||
OPJ_UINT32 l_data_read;
|
||||
|
@ -1299,7 +1291,7 @@ OPJ_BOOL opj_tcd_decode_tile( opj_tcd_t *p_tcd,
|
|||
/*--------------TIER2------------------*/
|
||||
/* FIXME _ProfStart(PGROUP_T2); */
|
||||
l_data_read = 0;
|
||||
if (! opj_tcd_t2_decode(p_tcd, p_src, &l_data_read, p_max_length, p_cstr_index))
|
||||
if (! opj_tcd_t2_decode(p_tcd, p_src, &l_data_read, p_max_length, p_cstr_index, p_manager))
|
||||
{
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
@ -1328,7 +1320,7 @@ OPJ_BOOL opj_tcd_decode_tile( opj_tcd_t *p_tcd,
|
|||
/*----------------MCT-------------------*/
|
||||
/* FIXME _ProfStart(PGROUP_MCT); */
|
||||
if
|
||||
(! opj_tcd_mct_decode(p_tcd))
|
||||
(! opj_tcd_mct_decode(p_tcd, p_manager))
|
||||
{
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
@ -1549,7 +1541,8 @@ static OPJ_BOOL opj_tcd_t2_decode (opj_tcd_t *p_tcd,
|
|||
OPJ_BYTE * p_src_data,
|
||||
OPJ_UINT32 * p_data_read,
|
||||
OPJ_UINT32 p_max_src_size,
|
||||
opj_codestream_index_t *p_cstr_index
|
||||
opj_codestream_index_t *p_cstr_index,
|
||||
opj_event_mgr_t *p_manager
|
||||
)
|
||||
{
|
||||
opj_t2_t * l_t2;
|
||||
|
@ -1566,7 +1559,8 @@ static OPJ_BOOL opj_tcd_t2_decode (opj_tcd_t *p_tcd,
|
|||
p_src_data,
|
||||
p_data_read,
|
||||
p_max_src_size,
|
||||
p_cstr_index)) {
|
||||
p_cstr_index,
|
||||
p_manager)) {
|
||||
opj_t2_destroy(l_t2);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
@ -1647,7 +1641,7 @@ static OPJ_BOOL opj_tcd_dwt_decode ( opj_tcd_t *p_tcd )
|
|||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
static OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t *p_tcd )
|
||||
static OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t *p_tcd, opj_event_mgr_t *p_manager)
|
||||
{
|
||||
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
|
||||
opj_tcp_t * l_tcp = p_tcd->tcp;
|
||||
|
@ -1665,7 +1659,7 @@ static OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t *p_tcd )
|
|||
if ((l_tile->comps[0].x1 - l_tile->comps[0].x0) * (l_tile->comps[0].y1 - l_tile->comps[0].y0) < (OPJ_INT32)l_samples ||
|
||||
(l_tile->comps[1].x1 - l_tile->comps[1].x0) * (l_tile->comps[1].y1 - l_tile->comps[1].y0) < (OPJ_INT32)l_samples ||
|
||||
(l_tile->comps[2].x1 - l_tile->comps[2].x0) * (l_tile->comps[2].y1 - l_tile->comps[2].y0) < (OPJ_INT32)l_samples) {
|
||||
fprintf(stderr, "Tiles don't all have the same dimension. Skip the MCT step.\n");
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Tiles don't all have the same dimension. Skip the MCT step.\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
else if (l_tcp->mct == 2) {
|
||||
|
@ -1717,8 +1711,7 @@ static OPJ_BOOL opj_tcd_mct_decode ( opj_tcd_t *p_tcd )
|
|||
}
|
||||
}
|
||||
else {
|
||||
/* FIXME need to use opj_event_msg function */
|
||||
fprintf(stderr,"Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",l_tile->numcomps);
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",l_tile->numcomps);
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
|
|
|
@ -262,10 +262,11 @@ OPJ_BOOL opj_tcd_init( opj_tcd_t *p_tcd,
|
|||
* @param p_tcd the tile decoder.
|
||||
* @param p_tile_no the index of the tile received in sequence. This not necessarily lead to the
|
||||
* tile at index p_tile_no.
|
||||
* @param p_manager the event manager.
|
||||
*
|
||||
* @return true if the remaining data is sufficient.
|
||||
*/
|
||||
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no);
|
||||
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager);
|
||||
|
||||
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno, OPJ_UINT32 final);
|
||||
|
||||
|
@ -312,12 +313,14 @@ Decode a tile from a buffer into a raw image
|
|||
@param len Length of source buffer
|
||||
@param tileno Number that identifies one of the tiles to be decoded
|
||||
@param cstr_info FIXME DOC
|
||||
@param manager the event manager.
|
||||
*/
|
||||
OPJ_BOOL opj_tcd_decode_tile( opj_tcd_t *tcd,
|
||||
OPJ_BYTE *src,
|
||||
OPJ_UINT32 len,
|
||||
OPJ_UINT32 tileno,
|
||||
opj_codestream_index_t *cstr_info);
|
||||
opj_codestream_index_t *cstr_info,
|
||||
opj_event_mgr_t *manager);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -337,11 +340,12 @@ OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_t *p_tcd );
|
|||
*
|
||||
* @param p_tcd TCD handle.
|
||||
* @param p_tile_no current tile index to encode.
|
||||
* @param p_manager the event manager.
|
||||
*
|
||||
* @return true if the encoding values could be set (false otherwise).
|
||||
*/
|
||||
OPJ_BOOL opj_tcd_init_encode_tile ( opj_tcd_t *p_tcd,
|
||||
OPJ_UINT32 p_tile_no );
|
||||
OPJ_UINT32 p_tile_no, opj_event_mgr_t* p_manager );
|
||||
|
||||
/**
|
||||
* Copies tile data from the given memory block onto the system.
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
==========================================================
|
||||
*/
|
||||
|
||||
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) {
|
||||
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv, opj_event_mgr_t *manager) {
|
||||
OPJ_INT32 nplh[32];
|
||||
OPJ_INT32 nplv[32];
|
||||
opj_tgt_node_t *node = 00;
|
||||
|
@ -59,7 +59,7 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) {
|
|||
|
||||
tree = (opj_tgt_tree_t *) opj_calloc(1,sizeof(opj_tgt_tree_t));
|
||||
if(!tree) {
|
||||
fprintf(stderr, "ERROR in tgt_create while allocating tree\n");
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory to create Tag-tree\n");
|
||||
return 00;
|
||||
}
|
||||
|
||||
|
@ -81,13 +81,13 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) {
|
|||
/* ADD */
|
||||
if (tree->numnodes == 0) {
|
||||
opj_free(tree);
|
||||
fprintf(stderr, "WARNING in tgt_create tree->numnodes == 0, no tree created.\n");
|
||||
opj_event_msg(manager, EVT_WARNING, "tgt_create tree->numnodes == 0, no tree created.\n");
|
||||
return 00;
|
||||
}
|
||||
|
||||
tree->nodes = (opj_tgt_node_t*) opj_calloc(tree->numnodes, sizeof(opj_tgt_node_t));
|
||||
if(!tree->nodes) {
|
||||
fprintf(stderr, "ERROR in tgt_create while allocating node of the tree\n");
|
||||
opj_event_msg(manager, EVT_ERROR, "Not enough memory to create Tag-tree nodes\n");
|
||||
opj_free(tree);
|
||||
return 00;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv) {
|
|||
* @param p_num_leafs_v the height of the array of leafs of the tree
|
||||
* @return a new tag-tree if successful, NULL otherwise
|
||||
*/
|
||||
opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,OPJ_UINT32 p_num_leafs_h, OPJ_UINT32 p_num_leafs_v)
|
||||
opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,OPJ_UINT32 p_num_leafs_h, OPJ_UINT32 p_num_leafs_v, opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_INT32 l_nplh[32];
|
||||
OPJ_INT32 l_nplv[32];
|
||||
|
@ -175,7 +175,7 @@ opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,OPJ_UINT32 p_num_leafs_h, O
|
|||
if (l_node_size > p_tree->nodes_size) {
|
||||
opj_tgt_node_t* new_nodes = (opj_tgt_node_t*) opj_realloc(p_tree->nodes, l_node_size);
|
||||
if (! new_nodes) {
|
||||
fprintf(stderr, "ERROR Not enough memory to reinitialize the tag tree\n");
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to reinitialize the tag tree\n");
|
||||
opj_tgt_destroy(p_tree);
|
||||
return 00;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ Create a tag-tree
|
|||
@param numleafsv Height of the array of leafs of the tree
|
||||
@return Returns a new tag-tree if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv);
|
||||
opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv, opj_event_mgr_t *manager);
|
||||
|
||||
/**
|
||||
* Reinitialises a tag-tree from an exixting one.
|
||||
|
@ -91,11 +91,12 @@ opj_tgt_tree_t *opj_tgt_create(OPJ_UINT32 numleafsh, OPJ_UINT32 numleafsv);
|
|||
* @param p_tree the tree to reinitialize.
|
||||
* @param p_num_leafs_h the width of the array of leafs of the tree
|
||||
* @param p_num_leafs_v the height of the array of leafs of the tree
|
||||
* @param p_manager the event manager
|
||||
* @return a new tag-tree if successful, NULL otherwise
|
||||
*/
|
||||
opj_tgt_tree_t *opj_tgt_init(opj_tgt_tree_t * p_tree,
|
||||
OPJ_UINT32 p_num_leafs_h,
|
||||
OPJ_UINT32 p_num_leafs_v);
|
||||
OPJ_UINT32 p_num_leafs_v, opj_event_mgr_t *p_manager);
|
||||
/**
|
||||
Destroy a tag-tree, liberating memory
|
||||
@param tree Tag-tree to destroy
|
||||
|
|
|
@ -27,6 +27,7 @@ if(UNIX)
|
|||
target_link_libraries(${OPENJP3D_LIBRARY_NAME} m)
|
||||
endif()
|
||||
set_target_properties(${OPENJP3D_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
||||
target_compile_options(${OPENJP3D_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
|
||||
|
||||
# Install library
|
||||
install(TARGETS ${OPENJP3D_LIBRARY_NAME}
|
||||
|
|
|
@ -61,6 +61,7 @@ endif()
|
|||
add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS})
|
||||
set_target_properties(openjpip
|
||||
PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
||||
target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
|
||||
target_link_libraries(openjpip ${OPENJPEG_LIBRARY_NAME})
|
||||
if(WIN32)
|
||||
# add Winsock on windows+mingw
|
||||
|
|
|
@ -51,6 +51,7 @@ if(UNIX)
|
|||
endif()
|
||||
set_target_properties(openjpwl
|
||||
PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
||||
target_compile_options(openjpwl PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
|
||||
|
||||
# Install library
|
||||
install(TARGETS openjpwl
|
||||
|
|
|
@ -46,6 +46,7 @@ if(UNIX)
|
|||
target_link_libraries(${OPENMJ2_LIBRARY_NAME} m)
|
||||
endif()
|
||||
set_target_properties(${OPENMJ2_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
||||
target_compile_options(${OPENMJ2_LIBRARY_NAME} PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
|
||||
|
||||
# Install library
|
||||
install(TARGETS ${OPENMJ2_LIBRARY_NAME}
|
||||
|
|
|
@ -13,6 +13,8 @@ set(INPUT_CONF_PATH ${OPJ_DATA_ROOT}/input/conformance)
|
|||
|
||||
# need kdu_expand if possible
|
||||
find_package(KAKADU)
|
||||
# need jpylyzer if possible
|
||||
find_package(JPYLYZER)
|
||||
|
||||
#########################################################################
|
||||
# GENERATION OF THE TEST SUITE (DUMP)
|
||||
|
@ -335,6 +337,20 @@ foreach(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
|
|||
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref)
|
||||
|
||||
endif()
|
||||
|
||||
# Test the encoded file is a valid JP2 file
|
||||
if (JPYLYZER_EXECUTABLE)
|
||||
if (${OUTPUT_FILENAME} MATCHES "\\.jp2$")
|
||||
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-jpylyser
|
||||
COMMAND ${JPYLYZER_EXECUTABLE}
|
||||
${OUTPUT_FILENAME}
|
||||
)
|
||||
set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-jpylyser PROPERTIES
|
||||
DEPENDS NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode
|
||||
PASS_REGULAR_EXPRESSION "<isValidJP2>True</isValidJP2>"
|
||||
)
|
||||
endif()
|
||||
endif(JPYLYZER_EXECUTABLE)
|
||||
endif()
|
||||
|
||||
# DECODER TEST SUITE
|
||||
|
|
Loading…
Reference in New Issue