Code improvements using 'g++-4.4.0' to trace the code (v2.0). Thanks to Winfried for this patch.

This commit is contained in:
Francois-Olivier Devaux 2010-03-24 11:21:19 +00:00
parent 67b5ab3c04
commit 73b4d32638
11 changed files with 117 additions and 96 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed ! : changed
+ : added + : added
March 24, 2010
* [FOD] Code improvements using 'g++-4.4.0' to trace the code. Thanks to Winfried for this patch.
March 7, 2010 March 7, 2010
* [FOD] Fixed small compatibility issues with win32 in codec (moved include <strings.h>) * [FOD] Fixed small compatibility issues with win32 in codec (moved include <strings.h>)

View File

@ -49,7 +49,7 @@ const char *optarg; /* argument associated with option */
typedef struct option typedef struct option
{ {
char *name; const char *name;
int has_arg; int has_arg;
int *flag; int *flag;
int val; int val;

View File

@ -5,7 +5,7 @@
typedef struct option typedef struct option
{ {
char *name; const char *name;
int has_arg; int has_arg;
int *flag; int *flag;
int val; int val;

View File

@ -1458,7 +1458,7 @@ int imagetotif(opj_image_t * image, const char *outfile) {
unsigned char *dat8; unsigned char *dat8;
int i, ssize; int i, ssize;
ssize = TIFFStripSize(tif); ssize = TIFFStripSize(tif);
dat8 = buf; dat8 = (unsigned char*)buf;
if (image->comps[0].prec == 8){ if (image->comps[0].prec == 8){
for (i=0; i<ssize-2; i+=3) { // 8 bits per pixel for (i=0; i<ssize-2; i+=3) { // 8 bits per pixel
int r = 0,g = 0,b = 0; int r = 0,g = 0,b = 0;
@ -1653,7 +1653,7 @@ int imagetotif(opj_image_t * image, const char *outfile) {
for (strip = 0; strip < TIFFNumberOfStrips(tif); strip++) { for (strip = 0; strip < TIFFNumberOfStrips(tif); strip++) {
unsigned char *dat8; unsigned char *dat8;
int i; int i;
dat8 = buf; dat8 = (unsigned char*)buf;
if (image->comps[0].prec == 8){ if (image->comps[0].prec == 8){
for (i=0; i<TIFFStripSize(tif); i+=1) { // 8 bits per pixel for (i=0; i<TIFFStripSize(tif); i+=1) { // 8 bits per pixel
if(index < imgsize){ if(index < imgsize){
@ -1794,7 +1794,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
unsigned char *dat8; unsigned char *dat8;
int i, ssize; int i, ssize;
ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size); ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size);
dat8 = buf; dat8 = (unsigned char*)buf;
if (Info.tiBps==12){ if (Info.tiBps==12){
for (i=0; i<ssize; i+=9) { /*12 bits per pixel*/ for (i=0; i<ssize; i+=9) { /*12 bits per pixel*/
@ -1890,7 +1890,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
unsigned char *dat8; unsigned char *dat8;
int i, ssize; int i, ssize;
ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size); ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size);
dat8 = buf; dat8 = (unsigned char*)buf;
if (Info.tiBps==12){ if (Info.tiBps==12){
for (i=0; i<ssize; i+=3) { /* 12 bits per pixel*/ for (i=0; i<ssize; i+=3) { /* 12 bits per pixel*/

View File

@ -75,7 +75,7 @@ typedef struct img_folder{
/** The directory path of the folder containing input images*/ /** The directory path of the folder containing input images*/
char *imgdirpath; char *imgdirpath;
/** Output format*/ /** Output format*/
char *out_format; const char *out_format;
/** Enable option*/ /** Enable option*/
char set_imgdir; char set_imgdir;
/** Enable Cod Format for output*/ /** Enable Cod Format for output*/

View File

@ -398,7 +398,7 @@ INLINE bool dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_function)(O
rh = l_cur_res->y1 - l_cur_res->y0; rh = l_cur_res->y1 - l_cur_res->y0;
l_data_size = dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * sizeof(OPJ_INT32); l_data_size = dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * sizeof(OPJ_INT32);
bj = opj_malloc(l_data_size); bj = (OPJ_INT32*)opj_malloc(l_data_size);
if if
(! bj) (! bj)
{ {
@ -563,7 +563,8 @@ static bool dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1DF
OPJ_UINT32 w = tilec->x1 - tilec->x0; OPJ_UINT32 w = tilec->x1 - tilec->x0;
h.mem = opj_aligned_malloc(dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32)); h.mem = (OPJ_INT32*)
opj_aligned_malloc(dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
if if
(! h.mem) (! h.mem)
{ {

View File

@ -49,7 +49,8 @@ opj_procedure_list_t * opj_procedure_list_create()
/* initialization */ /* initialization */
memset(l_validation,0,sizeof(opj_procedure_list_t)); memset(l_validation,0,sizeof(opj_procedure_list_t));
l_validation->m_nb_max_procedures = OPJ_VALIDATION_SIZE; l_validation->m_nb_max_procedures = OPJ_VALIDATION_SIZE;
l_validation->m_procedures = opj_malloc(OPJ_VALIDATION_SIZE * sizeof(opj_procedure)); l_validation->m_procedures = (void**)opj_malloc(
OPJ_VALIDATION_SIZE * sizeof(opj_procedure));
if if
(! l_validation->m_procedures) (! l_validation->m_procedures)
{ {
@ -95,7 +96,8 @@ bool opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list
(p_validation_list->m_nb_max_procedures == p_validation_list->m_nb_procedures) (p_validation_list->m_nb_max_procedures == p_validation_list->m_nb_procedures)
{ {
p_validation_list->m_nb_max_procedures += OPJ_VALIDATION_SIZE; p_validation_list->m_nb_max_procedures += OPJ_VALIDATION_SIZE;
p_validation_list->m_procedures = opj_realloc(p_validation_list->m_procedures,p_validation_list->m_nb_max_procedures * sizeof(opj_procedure)); p_validation_list->m_procedures = (void**)opj_realloc(
p_validation_list->m_procedures,p_validation_list->m_nb_max_procedures * sizeof(opj_procedure));
if if
(! p_validation_list->m_procedures) (! p_validation_list->m_procedures)
{ {

View File

@ -58,7 +58,7 @@
typedef struct j2k_prog_order typedef struct j2k_prog_order
{ {
OPJ_PROG_ORDER enum_prog; OPJ_PROG_ORDER enum_prog;
OPJ_CHAR str_prog[4]; OPJ_CHAR str_prog[5];
} }
j2k_prog_order_t; j2k_prog_order_t;
@ -1254,7 +1254,7 @@ const j2k_prog_order_t j2k_prog_order_list [] =
{PCRL, "PCRL"}, {PCRL, "PCRL"},
{RLCP, "RLCP"}, {RLCP, "RLCP"},
{RPCL, "RPCL"}, {RPCL, "RPCL"},
{-1, ""} {(OPJ_PROG_ORDER)-1, ""}
}; };
const OPJ_UINT32 MCT_ELEMENT_SIZE [] = const OPJ_UINT32 MCT_ELEMENT_SIZE [] =
@ -1969,7 +1969,7 @@ bool j2k_write_siz(
(l_size_len > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_size_len > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_size_len); l_size_len);
if if
@ -2289,7 +2289,8 @@ bool j2k_read_siz (
} }
memset(p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps ,0,l_image->numcomps*sizeof(opj_tccp_t)); memset(p_j2k->m_specific_param.m_decoder.m_default_tcp->tccps ,0,l_image->numcomps*sizeof(opj_tccp_t));
p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records = opj_malloc(J2K_MCT_DEFAULT_NB_RECORDS * sizeof(opj_mct_data_t)); p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records =
(opj_mct_data_t*)opj_malloc(J2K_MCT_DEFAULT_NB_RECORDS * sizeof(opj_mct_data_t));
if if
(! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records) (! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records)
{ {
@ -2299,7 +2300,9 @@ bool j2k_read_siz (
memset(p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records,0,J2K_MCT_DEFAULT_NB_RECORDS * sizeof(opj_mct_data_t)); memset(p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mct_records,0,J2K_MCT_DEFAULT_NB_RECORDS * sizeof(opj_mct_data_t));
p_j2k->m_specific_param.m_decoder.m_default_tcp->m_nb_max_mct_records = J2K_MCT_DEFAULT_NB_RECORDS; p_j2k->m_specific_param.m_decoder.m_default_tcp->m_nb_max_mct_records = J2K_MCT_DEFAULT_NB_RECORDS;
p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records = opj_malloc(J2K_MCC_DEFAULT_NB_RECORDS * sizeof(opj_simple_mcc_decorrelation_data_t)); p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records =
(opj_simple_mcc_decorrelation_data_t*)
opj_malloc(J2K_MCC_DEFAULT_NB_RECORDS * sizeof(opj_simple_mcc_decorrelation_data_t));
if if
(! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records) (! p_j2k->m_specific_param.m_decoder.m_default_tcp->m_mcc_records)
{ {
@ -2396,7 +2399,7 @@ bool j2k_write_com(
(l_total_com_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_total_com_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_total_com_size); l_total_com_size);
if if
@ -2757,7 +2760,7 @@ bool j2k_write_cod(
(l_code_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_code_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_code_size); l_code_size);
if if
@ -2938,7 +2941,7 @@ bool j2k_write_coc(
(l_coc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_coc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_coc_size); l_coc_size);
if if
@ -3490,7 +3493,7 @@ bool j2k_write_qcd(
(l_qcd_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_qcd_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_qcd_size); l_qcd_size);
if if
@ -3595,7 +3598,7 @@ bool j2k_write_qcc(
(l_qcc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_qcc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_qcc_size); l_qcc_size);
if if
@ -3797,7 +3800,7 @@ bool j2k_write_cbd(
(l_cbd_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_cbd_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_cbd_size); l_cbd_size);
if if
@ -3927,7 +3930,7 @@ bool j2k_write_mcc_record(
(l_mcc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_mcc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_mcc_size); l_mcc_size);
if if
@ -4073,7 +4076,8 @@ bool j2k_read_mcc (
(l_tcp->m_nb_mcc_records == l_tcp->m_nb_max_mcc_records) (l_tcp->m_nb_mcc_records == l_tcp->m_nb_max_mcc_records)
{ {
l_tcp->m_nb_max_mcc_records += J2K_MCC_DEFAULT_NB_RECORDS; l_tcp->m_nb_max_mcc_records += J2K_MCC_DEFAULT_NB_RECORDS;
l_tcp->m_mcc_records = opj_realloc(l_tcp->m_mcc_records,l_tcp->m_nb_max_mcc_records * sizeof(opj_simple_mcc_decorrelation_data_t)); l_tcp->m_mcc_records = (opj_simple_mcc_decorrelation_data_t*)
opj_realloc(l_tcp->m_mcc_records,l_tcp->m_nb_max_mcc_records * sizeof(opj_simple_mcc_decorrelation_data_t));
if if
(! l_tcp->m_mcc_records) (! l_tcp->m_mcc_records)
{ {
@ -4265,7 +4269,7 @@ bool j2k_write_mct_record(
(l_mct_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_mct_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_mct_size); l_mct_size);
if if
@ -4371,7 +4375,7 @@ bool j2k_read_mct (
(l_tcp->m_nb_mct_records == l_tcp->m_nb_max_mct_records) (l_tcp->m_nb_mct_records == l_tcp->m_nb_max_mct_records)
{ {
l_tcp->m_nb_max_mct_records += J2K_MCT_DEFAULT_NB_RECORDS; l_tcp->m_nb_max_mct_records += J2K_MCT_DEFAULT_NB_RECORDS;
l_tcp->m_mct_records = opj_realloc(l_tcp->m_mct_records,l_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t)); l_tcp->m_mct_records = (opj_mct_data_t*)opj_realloc(l_tcp->m_mct_records,l_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t));
if if
(! l_tcp->m_mct_records) (! l_tcp->m_mct_records)
{ {
@ -4390,8 +4394,8 @@ bool j2k_read_mct (
l_mct_data->m_data = 00; l_mct_data->m_data = 00;
} }
l_mct_data->m_index = l_indix; l_mct_data->m_index = l_indix;
l_mct_data->m_array_type = (l_tmp >> 8) & 3; l_mct_data->m_array_type = (J2K_MCT_ARRAY_TYPE)((l_tmp >> 8) & 3);
l_mct_data->m_element_type = (l_tmp >> 10) & 3; l_mct_data->m_element_type = (J2K_MCT_ELEMENT_TYPE)((l_tmp >> 10) & 3);
opj_read_bytes(p_header_data,&l_tmp,2); /* Ymct */ opj_read_bytes(p_header_data,&l_tmp,2); /* Ymct */
p_header_data+=2; p_header_data+=2;
@ -4402,7 +4406,7 @@ bool j2k_read_mct (
return true; return true;
} }
p_header_size -= 6; p_header_size -= 6;
l_mct_data->m_data = opj_malloc(p_header_size); l_mct_data->m_data = (OPJ_BYTE*)opj_malloc(p_header_size);
if if
(! l_mct_data->m_data) (! l_mct_data->m_data)
{ {
@ -4441,7 +4445,7 @@ bool j2k_setup_mct_encoding (opj_tcp_t * p_tcp,opj_image_t * p_image)
(p_tcp->m_nb_mct_records == p_tcp->m_nb_max_mct_records) (p_tcp->m_nb_mct_records == p_tcp->m_nb_max_mct_records)
{ {
p_tcp->m_nb_max_mct_records += J2K_MCT_DEFAULT_NB_RECORDS; p_tcp->m_nb_max_mct_records += J2K_MCT_DEFAULT_NB_RECORDS;
p_tcp->m_mct_records = opj_realloc(p_tcp->m_mct_records,p_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t)); p_tcp->m_mct_records = (opj_mct_data_t*)opj_realloc(p_tcp->m_mct_records,p_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t));
if if
(! p_tcp->m_mct_records) (! p_tcp->m_mct_records)
{ {
@ -4463,7 +4467,7 @@ bool j2k_setup_mct_encoding (opj_tcp_t * p_tcp,opj_image_t * p_image)
l_mct_deco_data->m_element_type = MCT_TYPE_FLOAT; l_mct_deco_data->m_element_type = MCT_TYPE_FLOAT;
l_nb_elem = p_image->numcomps * p_image->numcomps; l_nb_elem = p_image->numcomps * p_image->numcomps;
l_mct_size = l_nb_elem * MCT_ELEMENT_SIZE[l_mct_deco_data->m_element_type]; l_mct_size = l_nb_elem * MCT_ELEMENT_SIZE[l_mct_deco_data->m_element_type];
l_mct_deco_data->m_data = opj_malloc(l_mct_size ); l_mct_deco_data->m_data = (OPJ_BYTE*)opj_malloc(l_mct_size );
if if
(! l_mct_deco_data->m_data) (! l_mct_deco_data->m_data)
{ {
@ -4478,7 +4482,7 @@ bool j2k_setup_mct_encoding (opj_tcp_t * p_tcp,opj_image_t * p_image)
(p_tcp->m_nb_mct_records == p_tcp->m_nb_max_mct_records) (p_tcp->m_nb_mct_records == p_tcp->m_nb_max_mct_records)
{ {
p_tcp->m_nb_max_mct_records += J2K_MCT_DEFAULT_NB_RECORDS; p_tcp->m_nb_max_mct_records += J2K_MCT_DEFAULT_NB_RECORDS;
p_tcp->m_mct_records = opj_realloc(p_tcp->m_mct_records,p_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t)); p_tcp->m_mct_records = (opj_mct_data_t*)opj_realloc(p_tcp->m_mct_records,p_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t));
if if
(! p_tcp->m_mct_records) (! p_tcp->m_mct_records)
{ {
@ -4505,13 +4509,13 @@ bool j2k_setup_mct_encoding (opj_tcp_t * p_tcp,opj_image_t * p_image)
l_mct_offset_data->m_element_type = MCT_TYPE_FLOAT; l_mct_offset_data->m_element_type = MCT_TYPE_FLOAT;
l_nb_elem = p_image->numcomps; l_nb_elem = p_image->numcomps;
l_mct_size = l_nb_elem * MCT_ELEMENT_SIZE[l_mct_offset_data->m_element_type]; l_mct_size = l_nb_elem * MCT_ELEMENT_SIZE[l_mct_offset_data->m_element_type];
l_mct_offset_data->m_data = opj_malloc(l_mct_size ); l_mct_offset_data->m_data = (OPJ_BYTE*)opj_malloc(l_mct_size );
if if
(! l_mct_offset_data->m_data) (! l_mct_offset_data->m_data)
{ {
return false; return false;
} }
l_data = opj_malloc(l_nb_elem * sizeof(OPJ_FLOAT32)); l_data = (OPJ_FLOAT32*)opj_malloc(l_nb_elem * sizeof(OPJ_FLOAT32));
if if
(! l_data) (! l_data)
{ {
@ -4536,7 +4540,8 @@ bool j2k_setup_mct_encoding (opj_tcp_t * p_tcp,opj_image_t * p_image)
(p_tcp->m_nb_mcc_records == p_tcp->m_nb_max_mcc_records) (p_tcp->m_nb_mcc_records == p_tcp->m_nb_max_mcc_records)
{ {
p_tcp->m_nb_max_mcc_records += J2K_MCT_DEFAULT_NB_RECORDS; p_tcp->m_nb_max_mcc_records += J2K_MCT_DEFAULT_NB_RECORDS;
p_tcp->m_mcc_records = opj_realloc(p_tcp->m_mcc_records,p_tcp->m_nb_max_mcc_records * sizeof(opj_simple_mcc_decorrelation_data_t)); p_tcp->m_mcc_records = (opj_simple_mcc_decorrelation_data_t*)
opj_realloc(p_tcp->m_mcc_records,p_tcp->m_nb_max_mcc_records * sizeof(opj_simple_mcc_decorrelation_data_t));
if if
(! p_tcp->m_mcc_records) (! p_tcp->m_mcc_records)
{ {
@ -4587,7 +4592,7 @@ bool j2k_write_mco(
(l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_mco_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_mco_size); l_mco_size);
if if
@ -4749,7 +4754,7 @@ bool j2k_add_mct(opj_tcp_t * p_tcp,opj_image_t * p_image, OPJ_UINT32 p_index)
} }
l_nb_elem = p_image->numcomps * p_image->numcomps; l_nb_elem = p_image->numcomps * p_image->numcomps;
l_mct_size = l_nb_elem * sizeof(OPJ_FLOAT32); l_mct_size = l_nb_elem * sizeof(OPJ_FLOAT32);
p_tcp->m_mct_decoding_matrix = opj_malloc(l_mct_size); p_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(l_mct_size);
if if
(! p_tcp->m_mct_decoding_matrix ) (! p_tcp->m_mct_decoding_matrix )
{ {
@ -4769,7 +4774,7 @@ bool j2k_add_mct(opj_tcp_t * p_tcp,opj_image_t * p_image, OPJ_UINT32 p_index)
} }
l_nb_elem = p_image->numcomps; l_nb_elem = p_image->numcomps;
l_offset_size = l_nb_elem * sizeof(OPJ_UINT32); l_offset_size = l_nb_elem * sizeof(OPJ_UINT32);
l_offset_data = opj_malloc(l_offset_size); l_offset_data = (OPJ_UINT32*)opj_malloc(l_offset_size);
if if
(! l_offset_data ) (! l_offset_data )
{ {
@ -4893,7 +4898,7 @@ bool j2k_write_poc(
(l_poc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_poc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_poc_size); l_poc_size);
if if
@ -5325,7 +5330,7 @@ bool j2k_write_tlm(
(l_tlm_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) (l_tlm_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size)
{ {
p_j2k->m_specific_param.m_encoder.m_header_tile_data p_j2k->m_specific_param.m_encoder.m_header_tile_data
= opj_realloc( = (OPJ_BYTE*)opj_realloc(
p_j2k->m_specific_param.m_encoder.m_header_tile_data, p_j2k->m_specific_param.m_encoder.m_header_tile_data,
l_tlm_size); l_tlm_size);
if if
@ -7231,10 +7236,10 @@ void j2k_setup_header_reading (opj_j2k_t *p_j2k)
{ {
// preconditions // preconditions
assert(p_j2k != 00); assert(p_j2k != 00);
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_read_header_procedure); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_read_header_procedure);
/* DEVELOPER CORNER, add your custom procedures */ /* DEVELOPER CORNER, add your custom procedures */
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_copy_default_tcp_and_create_tcd); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_copy_default_tcp_and_create_tcd);
} }
@ -7246,7 +7251,7 @@ void j2k_setup_decoding (opj_j2k_t *p_j2k)
// preconditions // preconditions
assert(p_j2k != 00); assert(p_j2k != 00);
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_decode_tiles); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_decode_tiles);
/* DEVELOPER CORNER, add your custom procedures */ /* DEVELOPER CORNER, add your custom procedures */
} }
@ -7258,47 +7263,47 @@ void j2k_setup_header_writting (opj_j2k_t *p_j2k)
{ {
// preconditions // preconditions
assert(p_j2k != 00); assert(p_j2k != 00);
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_init_info ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_init_info );
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_soc ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_soc );
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_siz ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_siz );
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_cod ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_cod );
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_qcd ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_qcd );
if if
(p_j2k->m_cp.m_specific_param.m_enc.m_cinema) (p_j2k->m_cp.m_specific_param.m_enc.m_cinema)
{ {
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_image_components ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_image_components );
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_tlm ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_tlm );
if if
(p_j2k->m_cp.m_specific_param.m_enc.m_cinema == CINEMA4K_24) (p_j2k->m_cp.m_specific_param.m_enc.m_cinema == CINEMA4K_24)
{ {
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_poc ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_poc );
} }
} }
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_regions); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_regions);
if if
(p_j2k->m_cp.comment != 00) (p_j2k->m_cp.comment != 00)
{ {
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_com); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_com);
} }
/* DEVELOPER CORNER, insert your custom procedures */ /* DEVELOPER CORNER, insert your custom procedures */
if if
(p_j2k->m_cp.rsiz & MCT) (p_j2k->m_cp.rsiz & MCT)
{ {
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_mct_data_group ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_mct_data_group );
} }
/* End of Developer Corner */ /* End of Developer Corner */
if if
(p_j2k->cstr_info) (p_j2k->cstr_info)
{ {
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_get_end_header ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_get_end_header );
} }
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_create_tcd); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_create_tcd);
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_update_rates); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_update_rates);
} }
/** /**
@ -7311,15 +7316,15 @@ void j2k_setup_end_compress (opj_j2k_t *p_j2k)
assert(p_j2k != 00); assert(p_j2k != 00);
/* DEVELOPER CORNER, insert your custom procedures */ /* DEVELOPER CORNER, insert your custom procedures */
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_eoc ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_eoc );
if if
(p_j2k->m_cp.m_specific_param.m_enc.m_cinema) (p_j2k->m_cp.m_specific_param.m_enc.m_cinema)
{ {
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_updated_tlm); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_updated_tlm);
} }
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_write_epc ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_write_epc );
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_end_encoding ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_end_encoding );
opj_procedure_list_add_procedure(p_j2k->m_procedure_list,j2k_destroy_header_memory); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(void*)j2k_destroy_header_memory);
} }
@ -7332,12 +7337,12 @@ void j2k_setup_encoding_validation (opj_j2k_t *p_j2k)
{ {
// preconditions // preconditions
assert(p_j2k != 00); assert(p_j2k != 00);
opj_procedure_list_add_procedure(p_j2k->m_validation_list, j2k_build_encoder); opj_procedure_list_add_procedure(p_j2k->m_validation_list, (void*)j2k_build_encoder);
opj_procedure_list_add_procedure(p_j2k->m_validation_list, j2k_encoding_validation); opj_procedure_list_add_procedure(p_j2k->m_validation_list, (void*)j2k_encoding_validation);
/* DEVELOPER CORNER, add your custom validation procedure */ /* DEVELOPER CORNER, add your custom validation procedure */
opj_procedure_list_add_procedure(p_j2k->m_validation_list, j2k_mct_validation); opj_procedure_list_add_procedure(p_j2k->m_validation_list, (void*)j2k_mct_validation);
} }
/** /**
@ -7348,8 +7353,8 @@ void j2k_setup_decoding_validation (opj_j2k_t *p_j2k)
{ {
// preconditions // preconditions
assert(p_j2k != 00); assert(p_j2k != 00);
opj_procedure_list_add_procedure(p_j2k->m_validation_list, j2k_build_decoder); opj_procedure_list_add_procedure(p_j2k->m_validation_list, (void*)j2k_build_decoder);
opj_procedure_list_add_procedure(p_j2k->m_validation_list, j2k_decoding_validation); opj_procedure_list_add_procedure(p_j2k->m_validation_list, (void*)j2k_decoding_validation);
/* DEVELOPER CORNER, add your custom validation procedure */ /* DEVELOPER CORNER, add your custom validation procedure */
} }
@ -7600,7 +7605,7 @@ bool j2k_copy_default_tcp_and_create_tcd
if if
(l_default_tcp->m_mct_decoding_matrix) (l_default_tcp->m_mct_decoding_matrix)
{ {
l_tcp->m_mct_decoding_matrix = opj_malloc(l_mct_size); l_tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(l_mct_size);
if if
(! l_tcp->m_mct_decoding_matrix ) (! l_tcp->m_mct_decoding_matrix )
{ {
@ -7609,7 +7614,7 @@ bool j2k_copy_default_tcp_and_create_tcd
memcpy(l_tcp->m_mct_decoding_matrix,l_default_tcp->m_mct_decoding_matrix,l_mct_size); memcpy(l_tcp->m_mct_decoding_matrix,l_default_tcp->m_mct_decoding_matrix,l_mct_size);
} }
l_mct_records_size = l_default_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t); l_mct_records_size = l_default_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t);
l_tcp->m_mct_records = opj_malloc(l_mct_records_size); l_tcp->m_mct_records = (opj_mct_data_t*)opj_malloc(l_mct_records_size);
if if
(! l_tcp->m_mct_records) (! l_tcp->m_mct_records)
{ {
@ -7624,7 +7629,8 @@ bool j2k_copy_default_tcp_and_create_tcd
if if
(l_src_mct_rec->m_data) (l_src_mct_rec->m_data)
{ {
l_dest_mct_rec->m_data = opj_malloc(l_src_mct_rec->m_data_size); l_dest_mct_rec->m_data = (OPJ_BYTE*)
opj_malloc(l_src_mct_rec->m_data_size);
if if
(! l_dest_mct_rec->m_data) (! l_dest_mct_rec->m_data)
{ {
@ -7636,7 +7642,8 @@ bool j2k_copy_default_tcp_and_create_tcd
++l_dest_mct_rec; ++l_dest_mct_rec;
} }
l_mcc_records_size = l_default_tcp->m_nb_max_mcc_records * sizeof(opj_simple_mcc_decorrelation_data_t); l_mcc_records_size = l_default_tcp->m_nb_max_mcc_records * sizeof(opj_simple_mcc_decorrelation_data_t);
l_tcp->m_mcc_records = opj_malloc(l_mcc_records_size); l_tcp->m_mcc_records = (opj_simple_mcc_decorrelation_data_t*)
opj_malloc(l_mcc_records_size);
if if
(! l_tcp->m_mcc_records) (! l_tcp->m_mcc_records)
{ {
@ -7934,15 +7941,16 @@ void j2k_setup_encoder(opj_j2k_t *p_j2k, opj_cparameters_t *parameters, opj_imag
(parameters->mct_data) (parameters->mct_data)
{ {
OPJ_UINT32 lMctSize = image->numcomps * image->numcomps * sizeof(OPJ_FLOAT32); OPJ_UINT32 lMctSize = image->numcomps * image->numcomps * sizeof(OPJ_FLOAT32);
OPJ_FLOAT32 * lTmpBuf = opj_malloc(lMctSize); OPJ_FLOAT32 * lTmpBuf = (OPJ_FLOAT32*)opj_malloc(lMctSize);
OPJ_INT32 * l_dc_shift = (OPJ_INT32 *) ((OPJ_BYTE *) parameters->mct_data + lMctSize); OPJ_INT32 * l_dc_shift = (OPJ_INT32 *) ((OPJ_BYTE *) parameters->mct_data + lMctSize);
tcp->mct = 2; tcp->mct = 2;
tcp->m_mct_coding_matrix = opj_malloc(lMctSize); tcp->m_mct_coding_matrix = (OPJ_FLOAT32*)opj_malloc(lMctSize);
memcpy(tcp->m_mct_coding_matrix,parameters->mct_data,lMctSize); memcpy(tcp->m_mct_coding_matrix,parameters->mct_data,lMctSize);
memcpy(lTmpBuf,parameters->mct_data,lMctSize); memcpy(lTmpBuf,parameters->mct_data,lMctSize);
tcp->m_mct_decoding_matrix = opj_malloc(lMctSize); tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(lMctSize);
assert(opj_matrix_inversion_f(lTmpBuf,(tcp->m_mct_decoding_matrix),image->numcomps)); assert(opj_matrix_inversion_f(lTmpBuf,(tcp->m_mct_decoding_matrix),image->numcomps));
tcp->mct_norms = opj_malloc(image->numcomps * sizeof(OPJ_FLOAT64)); tcp->mct_norms = (OPJ_FLOAT64*)
opj_malloc(image->numcomps * sizeof(OPJ_FLOAT64));
opj_calculate_norms(tcp->mct_norms,image->numcomps,tcp->m_mct_decoding_matrix); opj_calculate_norms(tcp->mct_norms,image->numcomps,tcp->m_mct_decoding_matrix);
opj_free(lTmpBuf); opj_free(lTmpBuf);
for for
@ -8445,7 +8453,8 @@ bool j2k_read_tile_header (
if if
(l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size)
{ {
p_j2k->m_specific_param.m_decoder.m_header_data = opj_realloc(p_j2k->m_specific_param.m_decoder.m_header_data,l_marker_size); p_j2k->m_specific_param.m_decoder.m_header_data = (OPJ_BYTE*)
opj_realloc(p_j2k->m_specific_param.m_decoder.m_header_data,l_marker_size);
if if
(p_j2k->m_specific_param.m_decoder.m_header_data == 00) (p_j2k->m_specific_param.m_decoder.m_header_data == 00)
{ {
@ -8784,7 +8793,8 @@ bool j2k_read_header_procedure(
if if
(l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size) (l_marker_size > p_j2k->m_specific_param.m_decoder.m_header_data_size)
{ {
p_j2k->m_specific_param.m_decoder.m_header_data = opj_realloc(p_j2k->m_specific_param.m_decoder.m_header_data,l_marker_size); p_j2k->m_specific_param.m_decoder.m_header_data = (OPJ_BYTE*)
opj_realloc(p_j2k->m_specific_param.m_decoder.m_header_data,l_marker_size);
if if
(p_j2k->m_specific_param.m_decoder.m_header_data == 00) (p_j2k->m_specific_param.m_decoder.m_header_data == 00)
{ {
@ -8833,7 +8843,7 @@ bool j2k_decode_tiles (
OPJ_UINT32 l_nb_comps; OPJ_UINT32 l_nb_comps;
OPJ_BYTE * l_current_data; OPJ_BYTE * l_current_data;
l_current_data = opj_malloc(1000); l_current_data = (OPJ_BYTE*)opj_malloc(1000);
if if
(! l_current_data) (! l_current_data)
{ {
@ -8867,7 +8877,7 @@ bool j2k_decode_tiles (
if if
(l_data_size > l_max_data_size) (l_data_size > l_max_data_size)
{ {
l_current_data = opj_realloc(l_current_data,l_data_size); l_current_data = (OPJ_BYTE*)opj_realloc(l_current_data,l_data_size);
if if
(! l_current_data) (! l_current_data)
{ {
@ -8938,7 +8948,7 @@ bool j2k_encode(
assert(p_stream != 00); assert(p_stream != 00);
assert(p_manager != 00); assert(p_manager != 00);
l_current_data = opj_malloc(1000); l_current_data = (OPJ_BYTE*)opj_malloc(1000);
if if
(! l_current_data) (! l_current_data)
{ {
@ -8960,7 +8970,7 @@ bool j2k_encode(
if if
(l_current_tile_size > l_max_tile_size) (l_current_tile_size > l_max_tile_size)
{ {
l_current_data = opj_realloc(l_current_data,l_current_tile_size); l_current_data = (OPJ_BYTE*)opj_realloc(l_current_data,l_current_tile_size);
if if
(! l_current_data) (! l_current_data)
{ {

View File

@ -505,7 +505,7 @@ bool jp2_read_header_procedure(
assert(jp2 != 00); assert(jp2 != 00);
assert(p_manager != 00); assert(p_manager != 00);
l_current_data = opj_malloc(l_last_data_size); l_current_data = (unsigned char*)opj_malloc(l_last_data_size);
if if
(l_current_data == 00) (l_current_data == 00)
@ -549,7 +549,7 @@ bool jp2_read_header_procedure(
if if
(l_current_data_size > l_last_data_size) (l_current_data_size > l_last_data_size)
{ {
l_current_data = opj_realloc(l_current_data,l_current_data_size); l_current_data = (unsigned char*)opj_realloc(l_current_data,l_current_data_size);
l_last_data_size = l_current_data_size; l_last_data_size = l_current_data_size;
} }
l_nb_bytes_read = opj_stream_read_data(cio,l_current_data,l_current_data_size,p_manager); l_nb_bytes_read = opj_stream_read_data(cio,l_current_data,l_current_data_size,p_manager);
@ -1902,7 +1902,7 @@ void jp2_setup_end_header_writting (opj_jp2_t *jp2)
// preconditions // preconditions
assert(jp2 != 00); assert(jp2 != 00);
opj_procedure_list_add_procedure(jp2->m_procedure_list,jp2_write_jp2c ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(void*)jp2_write_jp2c );
/* DEVELOPER CORNER, add your custom procedures */ /* DEVELOPER CORNER, add your custom procedures */
} }
@ -1915,7 +1915,7 @@ void jp2_setup_header_reading (opj_jp2_t *jp2)
// preconditions // preconditions
assert(jp2 != 00); assert(jp2 != 00);
opj_procedure_list_add_procedure(jp2->m_procedure_list,jp2_read_header_procedure ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(void*)jp2_read_header_procedure );
/* DEVELOPER CORNER, add your custom procedures */ /* DEVELOPER CORNER, add your custom procedures */
} }
@ -1927,7 +1927,7 @@ void jp2_setup_end_header_reading (opj_jp2_t *jp2)
{ {
// preconditions // preconditions
assert(jp2 != 00); assert(jp2 != 00);
opj_procedure_list_add_procedure(jp2->m_procedure_list,jp2_read_header_procedure ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(void*)jp2_read_header_procedure );
/* DEVELOPER CORNER, add your custom procedures */ /* DEVELOPER CORNER, add your custom procedures */
} }
@ -2005,7 +2005,7 @@ void jp2_setup_encoding_validation (opj_jp2_t *jp2)
{ {
// preconditions // preconditions
assert(jp2 != 00); assert(jp2 != 00);
opj_procedure_list_add_procedure(jp2->m_validation_list, jp2_default_validation); opj_procedure_list_add_procedure(jp2->m_validation_list, (void*)jp2_default_validation);
/* DEVELOPER CORNER, add your custom validation procedure */ /* DEVELOPER CORNER, add your custom validation procedure */
} }
@ -2027,10 +2027,10 @@ void jp2_setup_header_writting (opj_jp2_t *jp2)
{ {
// preconditions // preconditions
assert(jp2 != 00); assert(jp2 != 00);
opj_procedure_list_add_procedure(jp2->m_procedure_list,jp2_write_jp ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(void*)jp2_write_jp );
opj_procedure_list_add_procedure(jp2->m_procedure_list,jp2_write_ftyp ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(void*)jp2_write_ftyp );
opj_procedure_list_add_procedure(jp2->m_procedure_list,jp2_write_jp2h ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(void*)jp2_write_jp2h );
opj_procedure_list_add_procedure(jp2->m_procedure_list,jp2_skip_jp2c ); opj_procedure_list_add_procedure(jp2->m_procedure_list,(void*)jp2_skip_jp2c );
/* DEVELOPER CORNER, insert your custom procedures */ /* DEVELOPER CORNER, insert your custom procedures */

View File

@ -872,7 +872,8 @@ bool opj_set_MCT(opj_cparameters_t *parameters,OPJ_FLOAT32 * pEncodingMatrix,OPJ
OPJ_UINT32 l_dc_shift_size = pNbComp * sizeof(OPJ_INT32); OPJ_UINT32 l_dc_shift_size = pNbComp * sizeof(OPJ_INT32);
OPJ_UINT32 l_mct_total_size = l_matrix_size + l_dc_shift_size; OPJ_UINT32 l_mct_total_size = l_matrix_size + l_dc_shift_size;
// add MCT capability // add MCT capability
parameters->cp_rsiz |= 0x8100; int rsiz = (int)parameters->cp_rsiz | (int)MCT;
parameters->cp_rsiz = (OPJ_RSIZ_CAPABILITIES)rsiz;
parameters->irreversible = 1; parameters->irreversible = 1;
// use array based MCT // use array based MCT
parameters->tcp_mct = 2; parameters->tcp_mct = 2;

View File

@ -586,13 +586,15 @@ opj_pi_iterator_t *pi_create_decode(
l_bound = l_tcp->numpocs+1; l_bound = l_tcp->numpocs+1;
l_data_stride = 4 * J2K_MAXRLVLS; l_data_stride = 4 * J2K_MAXRLVLS;
l_tmp_data = opj_malloc(l_data_stride * p_image->numcomps * sizeof(OPJ_UINT32)); l_tmp_data = (OPJ_UINT32*)opj_malloc(
l_data_stride * p_image->numcomps * sizeof(OPJ_UINT32));
if if
(! l_tmp_data) (! l_tmp_data)
{ {
return 00; return 00;
} }
l_tmp_ptr = opj_malloc(p_image->numcomps * sizeof(OPJ_UINT32 *)); l_tmp_ptr = (OPJ_UINT32**)opj_malloc(
p_image->numcomps * sizeof(OPJ_UINT32 *));
if if
(! l_tmp_ptr) (! l_tmp_ptr)
{ {
@ -871,13 +873,15 @@ opj_pi_iterator_t *pi_initialise_encode(
l_bound = l_tcp->numpocs+1; l_bound = l_tcp->numpocs+1;
l_data_stride = 4 * J2K_MAXRLVLS; l_data_stride = 4 * J2K_MAXRLVLS;
l_tmp_data = opj_malloc(l_data_stride * p_image->numcomps * sizeof(OPJ_UINT32)); l_tmp_data = (OPJ_UINT32*)opj_malloc(
l_data_stride * p_image->numcomps * sizeof(OPJ_UINT32));
if if
(! l_tmp_data) (! l_tmp_data)
{ {
return 00; return 00;
} }
l_tmp_ptr = opj_malloc(p_image->numcomps * sizeof(OPJ_UINT32 *)); l_tmp_ptr = (OPJ_UINT32**)opj_malloc(
p_image->numcomps * sizeof(OPJ_UINT32 *));
if if
(! l_tmp_ptr) (! l_tmp_ptr)
{ {