[trunk] Fix a set of warnings about C90 issues

This commit is contained in:
Mathieu Malaterre 2012-10-01 10:01:09 +00:00
parent aa6b4b4970
commit abdb8ee3f7
17 changed files with 119 additions and 118 deletions

View File

@ -709,10 +709,10 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
if(parameters->numresolution[2] != 1) {
parameters->transform_format = TRF_3D_DWT;
//fprintf(stdout, "[Warning] Resolution level in axial dim > 1 : 3D-DWT will be performed... \n");
/*fprintf(stdout, "[Warning] Resolution level in axial dim > 1 : 3D-DWT will be performed... \n");*/
} else if (parameters->numresolution[2] == 1) {
parameters->transform_format = TRF_2D_DWT;
//fprintf(stdout, "[Warning] Resolution level in axial dim == 1 : 2D-DWT will be performed... \n");
/*fprintf(stdout, "[Warning] Resolution level in axial dim == 1 : 2D-DWT will be performed... \n");*/
}
if ((parameters->cod_format == J2K_CFMT) && (parameters->transform_format != TRF_2D_DWT || parameters->encoding_format != ENCOD_2EB)) {
@ -860,7 +860,7 @@ int main(int argc, char **argv) {
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
/* encode the volume */
//fprintf(stdout, "[INFO] Encode the volume\n");
/*fprintf(stdout, "[INFO] Encode the volume\n");*/
bSuccess = opj_encode(cinfo, cio, volume, parameters.index);
if (!bSuccess) {
opj_cio_close(cio);

View File

@ -257,10 +257,10 @@ int main(int argc, char **argv)
memset(&mj2_parameters, 0, sizeof(mj2_cparameters_t));
/* default value */
/* ------------- */
mj2_parameters.w = 352; // CIF default value
mj2_parameters.h = 288; // CIF default value
mj2_parameters.CbCr_subsampling_dx = 2; // CIF default value
mj2_parameters.CbCr_subsampling_dy = 2; // CIF default value
mj2_parameters.w = 352; /* CIF default value*/
mj2_parameters.h = 288; /* CIF default value*/
mj2_parameters.CbCr_subsampling_dx = 2; /* CIF default value*/
mj2_parameters.CbCr_subsampling_dy = 2; /* CIF default value*/
mj2_parameters.frame_rate = 25;
mj2_parameters.prec = 8; /* DEFAULT */
mj2_parameters.enumcs = ENUMCS_SYCC; /* FIXME: ENUMCS_YUV420 */
@ -700,7 +700,7 @@ int main(int argc, char **argv)
return 1;
}
// One sample per chunk
/* One sample per chunk*/
movie->tk[0].chunk = (mj2_chunk_t*)
malloc(movie->tk[0].num_samples * sizeof(mj2_chunk_t));
movie->tk[0].sample = (mj2_sample_t*)
@ -711,8 +711,8 @@ int main(int argc, char **argv)
return 1;
}
// Writing JP, FTYP and MDAT boxes
// Assuming that the JP and FTYP boxes won't be longer than 300 bytes:
/* Writing JP, FTYP and MDAT boxes */
/* Assuming that the JP and FTYP boxes won't be longer than 300 bytes:*/
buf = (unsigned char*)
malloc (300 * sizeof(unsigned char));
@ -773,7 +773,7 @@ int main(int argc, char **argv)
cio = opj_cio_open((opj_common_ptr)movie->cinfo, buf, buflen);
cio_skip(cio, 4);
cio_write(cio, JP2_JP2C, 4); // JP2C
cio_write(cio, JP2_JP2C, 4); /* JP2C*/
/* encode the image */
#if 0 /* MM: FIXME */
@ -793,7 +793,7 @@ int main(int argc, char **argv)
tk->sample[sampleno].sample_size = len+8;
tk->sample[sampleno].offset = offset;
tk->chunk[sampleno].offset = offset; // There is one sample per chunk
tk->chunk[sampleno].offset = offset; /* There is one sample per chunk */
fwrite(buf, 1, len+8, mj2file);
offset += len+8;
@ -812,14 +812,14 @@ int main(int argc, char **argv)
buf = (unsigned char*) malloc(4*sizeof(unsigned char));
// Init a cio to write box length variable in a little endian way
/* Init a cio to write box length variable in a little endian way */
cio = opj_cio_open(NULL, buf, 4);
cio_write(cio, offset - mdat_initpos, 4);
fwrite(buf, 4, 1, mj2file);
fseek(mj2file,0,SEEK_END);
free(buf);
// Writing MOOV box
/* Writing MOOV box */
buf = (unsigned char*)
malloc ((TEMP_BUF+numframes*20) * sizeof(unsigned char));
cio = opj_cio_open(movie->cinfo, buf, (TEMP_BUF+numframes*20));
@ -830,7 +830,7 @@ int main(int argc, char **argv)
fprintf(stdout,"Total encoding time: %.2f s for %d frames (%.1f fps)\n",
total_time, numframes, (float)numframes/total_time);
// Ending program
/* Ending program */
fclose(mj2file);
/* free remaining compression structures */

View File

@ -110,9 +110,9 @@ static int test_image(const char *fname, mj2_cparameters_t *cp)
&& (image->comps[2].dx == 2)
&& (image->comps[0].dy == 1)
&& (image->comps[1].dy == 2)
&& (image->comps[2].dy == 2))// horizontal and vertical
&& (image->comps[2].dy == 2))/* horizontal and vertical*/
{
// Y420
/* Y420*/
cp->enumcs = ENUMCS_SYCC;
cp->CbCr_subsampling_dx = 2;
cp->CbCr_subsampling_dy = 2;
@ -123,9 +123,9 @@ static int test_image(const char *fname, mj2_cparameters_t *cp)
&& (image->comps[2].dx == 2)
&& (image->comps[0].dy == 1)
&& (image->comps[1].dy == 1)
&& (image->comps[2].dy == 1))// horizontal only
&& (image->comps[2].dy == 1))/* horizontal only*/
{
// Y422
/* Y422*/
cp->enumcs = ENUMCS_SYCC;
cp->CbCr_subsampling_dx = 2;
cp->CbCr_subsampling_dy = 1;
@ -138,14 +138,14 @@ static int test_image(const char *fname, mj2_cparameters_t *cp)
&& (image->comps[1].dy == 1)
&& (image->comps[2].dy == 1))
{
// Y444 or RGB
/* Y444 or RGB */
if(image->color_space == CLRSPC_SRGB)
{
cp->enumcs = ENUMCS_SRGB;
// cp->CbCr_subsampling_dx = 0;
// cp->CbCr_subsampling_dy = 0;
/* cp->CbCr_subsampling_dx = 0; */
/* cp->CbCr_subsampling_dy = 0; */
}
else
{
@ -163,8 +163,8 @@ static int test_image(const char *fname, mj2_cparameters_t *cp)
else
{
cp->enumcs = ENUMCS_GRAY;
// cp->CbCr_subsampling_dx = 0;
// cp->CbCr_subsampling_dy = 0;
/* cp->CbCr_subsampling_dx = 0; */
/* cp->CbCr_subsampling_dy = 0; */
}
if(image->icc_profile_buf)
{
@ -295,7 +295,7 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
movie->tk[0].sample_rate = 25;
movie->tk[0].jp2_struct.numcomps = image->numcomps; // NC
movie->tk[0].jp2_struct.numcomps = image->numcomps; /* NC */
/* Init Standard jp2 structure */
@ -336,7 +336,7 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
movie->tk[0].jp2_struct.meth = 2;
if (image->numcomps == 1)
movie->tk[0].jp2_struct.enumcs = 17; // Grayscale
movie->tk[0].jp2_struct.enumcs = 17; /* Grayscale */
else
if ((image->comps[0].dx == 1)
@ -345,7 +345,7 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
&& (image->comps[0].dy == 1)
&& (image->comps[1].dy == 1)
&& (image->comps[2].dy == 1))
movie->tk[0].jp2_struct.enumcs = 16; // RGB
movie->tk[0].jp2_struct.enumcs = 16; /* RGB */
else
if ((image->comps[0].dx == 1)
@ -354,10 +354,10 @@ static void setparams(opj_mj2_t *movie, opj_image_t *image) {
&& (image->comps[0].dy == 1)
&& (image->comps[1].dy == 2)
&& (image->comps[2].dy == 2))
movie->tk[0].jp2_struct.enumcs = 18; // YUV
movie->tk[0].jp2_struct.enumcs = 18; /* YUV */
else
movie->tk[0].jp2_struct.enumcs = 0; // Unkown profile */
movie->tk[0].jp2_struct.enumcs = 0; /* Unkown profile */
}
int main(int argc, char *argv[]) {
@ -430,56 +430,58 @@ int main(int argc, char *argv[]) {
fwrite(buf,cio_tell(cio),1,mj2file);
free(buf);
// Insert each j2k codestream in a JP2C box
/* Insert each j2k codestream in a JP2C box */
snum=0;
offset = 0;
while(1)
{
mj2_sample_t * new_sample;
mj2_chunk_t * new_chunk;
sample = &movie->tk[0].sample[snum];
sprintf(j2kfilename,"%s_%05d.j2k",argv[1],snum);
j2kfile = fopen(j2kfilename, "rb");
if (!j2kfile) {
if (snum==0) { // Could not open a single codestream
if (snum==0) { /* Could not open a single codestream */
fprintf(stderr, "failed to open %s for reading\n",j2kfilename);
return 1;
}
else { // Tried to open a inexistant codestream
else { /* Tried to open a inexistant codestream */
fprintf(stdout,"%d frames are being added to the MJ2 file\n",snum);
break;
}
}
// Calculating offset for samples and chunks
/* Calculating offset for samples and chunks */
offset += cio_tell(cio);
sample->offset = offset;
movie->tk[0].chunk[snum].offset = offset; // There will be one sample per chunk
movie->tk[0].chunk[snum].offset = offset; /* There will be one sample per chunk */
// Calculating sample size
/* Calculating sample size */
fseek(j2kfile,0,SEEK_END);
sample->sample_size = ftell(j2kfile) + 8; // Sample size is codestream + JP2C box header
sample->sample_size = ftell(j2kfile) + 8; /* Sample size is codestream + JP2C box header */
fseek(j2kfile,0,SEEK_SET);
// Reading siz marker of j2k image for the first codestream
/* Reading siz marker of j2k image for the first codestream */
if (snum==0)
read_siz_marker(j2kfile, &img);
// Writing JP2C box header
/* Writing JP2C box header */
frame_codestream = (unsigned char*) malloc (sample->sample_size+8);
cio = opj_cio_open(movie->cinfo, frame_codestream, sample->sample_size);
cio_write(cio,sample->sample_size, 4); // Sample size
cio_write(cio,JP2_JP2C, 4); // JP2C
cio_write(cio,sample->sample_size, 4); /* Sample size */
cio_write(cio,JP2_JP2C, 4); /* JP2C */
// Writing codestream from J2K file to MJ2 file
/* Writing codestream from J2K file to MJ2 file */
fread(frame_codestream+8,sample->sample_size-8,1,j2kfile);
fwrite(frame_codestream,sample->sample_size,1,mj2file);
cio_skip(cio, sample->sample_size-8);
// Ending loop
/* Ending loop */
fclose(j2kfile);
snum++;
mj2_sample_t * new_sample = (mj2_sample_t*)
new_sample = (mj2_sample_t*)
realloc(movie->tk[0].sample, (snum+1) * sizeof(mj2_sample_t));
mj2_chunk_t * new_chunk = (mj2_chunk_t*)
new_chunk = (mj2_chunk_t*)
realloc(movie->tk[0].chunk, (snum+1) * sizeof(mj2_chunk_t));
if (new_sample && new_chunk) {
movie->tk[0].sample = new_sample;
@ -491,7 +493,7 @@ int main(int argc, char *argv[]) {
free(frame_codestream);
}
// Writing the MDAT box length in header
/* Writing the MDAT box length in header */
offset += cio_tell(cio);
buf = (unsigned char*) malloc (4 * sizeof(unsigned char));
cio = opj_cio_open(movie->cinfo, buf, 4);
@ -501,18 +503,18 @@ int main(int argc, char *argv[]) {
fseek(mj2file,0,SEEK_END);
free(buf);
// Setting movie parameters
/* Setting movie parameters */
movie->tk[0].num_samples=snum;
movie->tk[0].num_chunks=snum;
setparams(movie, &img);
// Writing MOOV box
/* Writing MOOV box */
buf = (unsigned char*) malloc ((TEMP_BUF+snum*20) * sizeof(unsigned char));
cio = opj_cio_open(movie->cinfo, buf, (TEMP_BUF+snum*20));
mj2_write_moov(movie, cio);
fwrite(buf,cio_tell(cio),1,mj2file);
// Ending program
/* Ending program */
free(img.comps);
opj_cio_close(cio);

View File

@ -94,7 +94,7 @@ opj_bool opj_bio_bytein(opj_bio_t *bio) {
void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
if (bio->ct == 0) {
opj_bio_byteout(bio); // TODO_MSD: check this line
opj_bio_byteout(bio); /* TODO_MSD: check this line */
}
bio->ct--;
bio->buf |= b << bio->ct;
@ -102,7 +102,7 @@ void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) {
OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) {
if (bio->ct == 0) {
opj_bio_bytein(bio); // TODO_MSD: check this line
opj_bio_bytein(bio); /* TODO_MSD: check this line */
}
bio->ct--;
return (bio->buf >> bio->ct) & 1;

View File

@ -711,7 +711,7 @@ typedef struct opj_packet_info {
/**
* Marker structure
* */
typedef struct opj_marker_info_t {
typedef struct opj_marker_info {
/** marker type */
unsigned short int type;
/** position in codestream */

View File

@ -143,7 +143,7 @@ static opj_bool opj_t2_init_seg( opj_tcd_cblk_dec_v2_t* cblk,
/* ----------------------------------------------------------------------- */
/* #define RESTART 0x04 */
// TODO MSD->LHE
/* TODO MSD->LHE */
static void t2_putcommacode(opj_bio_t *bio, int n) {
while (--n >= 0) {
bio_write(bio, 1, 1);
@ -232,7 +232,7 @@ opj_bool opj_t2_encode_packets( opj_t2_v2_t* p_t2,
for (poc = 0; poc < pocno ; ++poc) {
OPJ_UINT32 l_tp_num = compno;
// TODO MSD : check why this function cannot fail (cf. v1)
/* TODO MSD : check why this function cannot fail (cf. v1) */
pi_create_encode_v2(l_pi, l_cp,p_tile_no,poc,l_tp_num,p_tp_pos,p_t2_mode);
while (pi_next(l_current_pi)) {

View File

@ -121,7 +121,7 @@ Read a bit
@return Returns the read bit
*/
/* MOD antonin */
//int bio_getbit(opj_bio_t *bio);
/*int bio_getbit(opj_bio_t *bio);*/
/* DOM */
/* ----------------------------------------------------------------------- */
/*@}*/

View File

@ -26,9 +26,9 @@
#include "opj_includes.h"
// ==========================================================
/* ==========================================================
// Utility functions
// ==========================================================
// ==========================================================*/
#ifndef _WIN32
static char*

View File

@ -471,7 +471,7 @@ static void j3d_read_zsi(opj_j3d_t *j3d) {
volume->comps[i].dz = cio_read(cio, 1); /* ZRsiz_i */
}
//Initialization of volume
/*Initialization of volume*/
cp->tw = int_ceildiv(volume->x1 - cp->tx0, cp->tdx);
cp->th = int_ceildiv(volume->y1 - cp->ty0, cp->tdy);
cp->tl = int_ceildiv(volume->z1 - cp->tz0, cp->tdz);
@ -538,7 +538,7 @@ static void j3d_read_dco(opj_j3d_t *j3d){
opj_cp_t *cp = j3d->cp;
len = cio_read(cio, 2); /* Lsiz */
dcotype = cio_read(cio, 1); //offset 8bit unsigned / 16bit signed integers
dcotype = cio_read(cio, 1); /*offset 8bit unsigned / 16bit signed integers*/
if (dcotype == 0) {
for (i = 0; i < volume->numcomps; i++) {
volume->comps[i].dcoffset = cio_read(cio, 1);
@ -660,7 +660,7 @@ static void j3d_write_siz(opj_j3d_t *j3d) {
cio_write(cio, J3D_MS_SIZ, 2); /* SIZ */
lenp = cio_tell(cio);
cio_skip(cio, 2);
//cio_write(cio, 0, 2); /* Rsiz (capabilities of 15444-1 only) */
/*cio_write(cio, 0, 2);*/ /* Rsiz (capabilities of 15444-1 only) */
Rsiz = J3D_RSIZ_DCO | J3D_RSIZ_ATK; /** | J3D_RSIZ_MCT | J3D_RSIZ_NONLT (not implemented yet)*/
cio_write(cio, Rsiz, 2); /* capabilities of WDv5.2*/
cio_write(cio, volume->x1, 4); /* Xsiz */
@ -725,7 +725,7 @@ static void j3d_read_siz(opj_j3d_t *j3d) {
for (i = 0; i < volume->numcomps; i++)
volume->comps[i].dz = 1;
//Initialization of volume
/*Initialization of volume*/
cp->tw = int_ceildiv(volume->x1 - cp->tx0, cp->tdx);
cp->th = int_ceildiv(volume->y1 - cp->ty0, cp->tdy);
cp->tl = int_ceildiv(volume->z1 - cp->tz0, cp->tdz);
@ -767,10 +767,10 @@ static void j3d_write_com(opj_j3d_t *j3d) {
cio_write(cio, J3D_MS_COM, 2);
lenp = cio_tell(cio);
cio_skip(cio, 2);
//cio_write(cio, 0, 2);
/*cio_write(cio, 0, 2);*/
cio_write(cio, j3d->cp->transform_format,1);
cio_write(cio, j3d->cp->encoding_format,1);
//opj_event_msg(j3d->cinfo, EVT_INFO, "TRF %D ENCOD %d\n",j3d->cp->transform_format,j3d->cp->encoding_format);
/*opj_event_msg(j3d->cinfo, EVT_INFO, "TRF %D ENCOD %d\n",j3d->cp->transform_format,j3d->cp->encoding_format);*/
if (j3d->cp->comment != NULL) {
char *comment = j3d->cp->comment;
for (i = 0; i < strlen(comment); i++) {
@ -791,9 +791,9 @@ static void j3d_read_com(opj_j3d_t *j3d) {
j3d->cp->transform_format = (OPJ_TRANSFORM) cio_read(cio, 1);
j3d->cp->encoding_format = (OPJ_ENTROPY_CODING) cio_read(cio, 1);
//opj_event_msg(j3d->cinfo, EVT_INFO, "TRF %D ENCOD %d\n",j3d->cp->transform_format,j3d->cp->encoding_format);
/*opj_event_msg(j3d->cinfo, EVT_INFO, "TRF %D ENCOD %d\n",j3d->cp->transform_format,j3d->cp->encoding_format);*/
cio_skip(cio, len - 4); //posible comments
cio_skip(cio, len - 4); /*posible comments*/
}
static void j3d_write_cox(opj_j3d_t *j3d, int compno) {
@ -871,7 +871,7 @@ static void j3d_read_cox(opj_j3d_t *j3d, int compno) {
tccp->dwtid[1] = tccp->dwtid[0]; /* SPcox (L) */
tccp->dwtid[2] = tccp->dwtid[0]; /* SPcox (M) */
}
tccp->reversible = (tccp->dwtid[0]>=1 && tccp->dwtid[1]>=1 && tccp->dwtid[2]>=1); //TODO: only valid for irreversible 9x7 WTs
tccp->reversible = (tccp->dwtid[0]>=1 && tccp->dwtid[1]>=1 && tccp->dwtid[2]>=1); /*TODO: only valid for irreversible 9x7 WTs*/
if (tccp->csty & J3D_CP_CSTY_PRT) {
for (i = 0; i < tccp->numresolution[0]; i++) {
int tmp = cio_read(cio, 2); /* SPcox (N_i) */
@ -1494,7 +1494,7 @@ static void j3d_read_eoc(opj_j3d_t *j3d) {
j3d_dump_cp(stdout, tcd->volume, tcd->cp);*/
for (i = 0; i < j3d->cp->tileno_size; i++) {
tileno = j3d->cp->tileno[i];
//opj_event_msg(j3d->cinfo, EVT_INFO, "tcd_decode_tile \n");
/*opj_event_msg(j3d->cinfo, EVT_INFO, "tcd_decode_tile \n");*/
tcd_decode_tile(tcd, j3d->tile_data[tileno], j3d->tile_len[tileno], tileno);
opj_free(j3d->tile_data[tileno]);
j3d->tile_data[tileno] = NULL;
@ -1696,7 +1696,7 @@ opj_volume_t* j3d_decode(opj_j3d_t *j3d, opj_cio_t *cio) {
return 0;
}
e = j3d_dec_mstab_lookup(id);
//opj_event_msg(cinfo, EVT_INFO, "MARKER %x PREVSTATE %d E->STATE %d\n",e->id,j3d->state,e->states);
/*opj_event_msg(cinfo, EVT_INFO, "MARKER %x PREVSTATE %d E->STATE %d\n",e->id,j3d->state,e->states);*/
if (!(j3d->state & e->states)) {
opj_volume_destroy(volume);
opj_event_msg(cinfo, EVT_ERROR, "%.8x: unexpected marker %x\n", cio_tell(cio) - 2, id);
@ -1705,7 +1705,7 @@ opj_volume_t* j3d_decode(opj_j3d_t *j3d, opj_cio_t *cio) {
if (e->handler) {
(*e->handler)(j3d);
}
//opj_event_msg(cinfo, EVT_INFO, "POSTSTATE %d\n",j3d->state);
/*opj_event_msg(cinfo, EVT_INFO, "POSTSTATE %d\n",j3d->state);*/
if (j3d->state == J3D_STATE_MT) {
break;
}
@ -1898,7 +1898,7 @@ void j3d_setup_encoder(opj_j3d_t *j3d, opj_cparameters_t *parameters, opj_volume
tccp->cblk[1] = int_floorlog2(parameters->cblock_init[1]);
tccp->cblk[2] = int_floorlog2(parameters->cblock_init[2]);
assert (tccp->cblk[0]+tccp->cblk[1]+tccp->cblk[1] <= T1_MAXWHD);
tccp->cblksty = parameters->mode; //Codeblock style --> Table A.19 (default 0)
tccp->cblksty = parameters->mode; /*Codeblock style --> Table A.19 (default 0)*/
/*ATK / transform */
tccp->reversible = parameters->irreversible ? 0 : 1; /* 0 => DWT 9-7 || 1 => DWT 5-3 */
@ -1946,7 +1946,7 @@ void j3d_setup_encoder(opj_j3d_t *j3d, opj_cparameters_t *parameters, opj_volume
}
}
}
//Calcular stepsize for each subband (if NOQNT -->stepsize = 1.0)
/*Calcular stepsize for each subband (if NOQNT -->stepsize = 1.0)*/
dwt_calc_explicit_stepsizes(tccp, volume->comps[i].prec);
}
}
@ -2051,8 +2051,8 @@ static int j3d_create_index(opj_j3d_t *j3d, opj_cio_t *cio, opj_volume_info_t *v
*/
for (resno = 0; resno < volume_info->decomposition[0] + 1; resno++) {
/* I suppose components have same XRsiz, YRsiz */
//int x0 = volume_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)volume_info->tw ) * volume_info->tw * volume_info->tile_x;
//int y0 = volume_info->tile_Ox + (int)floor( (float)tileno/(float)volume_info->tw ) * volume_info->tile_y;
/*int x0 = volume_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)volume_info->tw ) * volume_info->tw * volume_info->tile_x;*/
/*int y0 = volume_info->tile_Ox + (int)floor( (float)tileno/(float)volume_info->tw ) * volume_info->tile_y;*/
int x0 = volume_info->tile_Ox + (int)floor( (float)tileno/(float)volume_info->tw ) * volume_info->tile_x;
int y0 = volume_info->tile_Oy + (int)floor( (float)tileno/(float)volume_info->th ) * volume_info->tile_y;
int z0 = volume_info->tile_Ox + (int)floor( (float)tileno/(float)volume_info->tl ) * volume_info->tile_z;
@ -2300,7 +2300,7 @@ bool j3d_encode(opj_j3d_t *j3d, opj_cio_t *cio, opj_volume_t *volume, char *inde
if (cp->tcps[tileno].numpocs) {
j3d_write_poc(j3d);
}
j3d_write_sod(j3d, tcd); //--> tcd_encode_tile
j3d_write_sod(j3d, tcd); /*--> tcd_encode_tile*/
/* INDEX >> */
if(volume_info && volume_info->index_on) {

View File

@ -81,7 +81,7 @@ The functions in J3D.C have for goal to read/write the several parts of the code
#define J3D_MS_EPH 0xff92 /**< EPH marker value */
#define J3D_MS_CRG 0xff63 /**< CRG marker value */
#define J3D_MS_COM 0xff64 /**< COM marker value */
//15444-2
/*15444-2*/
#define J3D_MS_DCO 0xff70 /**< DCO marker value */
#define J3D_MS_VMS 0xff71 /**< VMS marker value */
#define J3D_MS_DFS 0xff72 /**< DFS marker value */

View File

@ -75,7 +75,4 @@
#include "int.h"
#include "fix.h"
//#include "pred.h"
//#include "golomb.h"
#endif /* OPJ_INCLUDES_H */

View File

@ -99,7 +99,7 @@ static bool pi_next_lrcp(opj_pi_iterator_t * pi) {
continue;
}
res = &comp->resolutions[pi->resno];
//for (pi->precno = 0; pi->precno < (res->prctno[0] * res->prctno[1]); pi->precno++) {
/*for (pi->precno = 0; pi->precno < (res->prctno[0] * res->prctno[1]); pi->precno++) {*/
for (pi->precno = 0; pi->precno < (res->prctno[0] * res->prctno[1] * res->prctno[2]); pi->precno++) {
index = pi->layno * pi->step_l
+ pi->resno * pi->step_r
@ -140,7 +140,7 @@ static bool pi_next_rlcp(opj_pi_iterator_t * pi) {
continue;
}
res = &comp->resolutions[pi->resno];
//for (pi->precno = 0; pi->precno < (res->prctno[0] * res->prctno[1]); pi->precno++) {
/*for (pi->precno = 0; pi->precno < (res->prctno[0] * res->prctno[1]); pi->precno++) {*/
for (pi->precno = 0; pi->precno < (res->prctno[0] * res->prctno[1] * res->prctno[2]); pi->precno++) {
index = pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p;
if (!pi->include[index]) {

View File

@ -117,9 +117,9 @@ typedef struct opj_t1 {
int lut_nmsedec_ref[1 << T1_NMSEDEC_BITS];
int lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS];
/** Codeblock data */
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];//int ***data;
int data[T1_CBLKD][T1_CBLKH][T1_CBLKW];/*int ***data;*/
/** Context information for each voxel in codeblock */
int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];//int ***flags;
int flags[T1_CBLKD + 2][T1_CBLKH + 2][T1_CBLKH + 2];/*int ***flags;*/
} opj_t1_t;
/** @name Exported functions */

View File

@ -79,9 +79,9 @@ The functions in T1_3D.C are used by some function in TCD.C.
#define T1_3D_SGN_B 0x8000
#define T1_3D_SGN (T1_3D_SGN_N|T1_3D_SGN_E|T1_3D_SGN_S|T1_3D_SGN_W|T1_3D_SGN_F|T1_3D_SGN_B)
#define T1_3D_SIG 0x0001 //Significance state
#define T1_3D_REFINE 0x0002 //Delayed significance
#define T1_3D_VISIT 0x0004 //First-pass membership
#define T1_3D_SIG 0x0001 /*Significance state*/
#define T1_3D_REFINE 0x0002 /*Delayed significance*/
#define T1_3D_VISIT 0x0004 /*First-pass membership*/
#define T1_3D_NUMCTXS_AGG 1
#define T1_3D_NUMCTXS_ZC 16
@ -90,11 +90,11 @@ The functions in T1_3D.C are used by some function in TCD.C.
#define T1_3D_NUMCTXS_UNI 1
#define T1_3D_CTXNO_AGG 0
#define T1_3D_CTXNO_ZC (T1_3D_CTXNO_AGG+T1_3D_NUMCTXS_AGG) //1
#define T1_3D_CTXNO_MAG (T1_3D_CTXNO_ZC+T1_3D_NUMCTXS_ZC) //17
#define T1_3D_CTXNO_SC (T1_3D_CTXNO_MAG+T1_3D_NUMCTXS_MAG) //20
#define T1_3D_CTXNO_UNI (T1_3D_CTXNO_SC+T1_3D_NUMCTXS_SC) //26
#define T1_3D_NUMCTXS (T1_3D_CTXNO_UNI+T1_3D_NUMCTXS_UNI) //27
#define T1_3D_CTXNO_ZC (T1_3D_CTXNO_AGG+T1_3D_NUMCTXS_AGG) /*1*/
#define T1_3D_CTXNO_MAG (T1_3D_CTXNO_ZC+T1_3D_NUMCTXS_ZC) /*17*/
#define T1_3D_CTXNO_SC (T1_3D_CTXNO_MAG+T1_3D_NUMCTXS_MAG) /*20*/
#define T1_3D_CTXNO_UNI (T1_3D_CTXNO_SC+T1_3D_NUMCTXS_SC) /*26*/
#define T1_3D_NUMCTXS (T1_3D_CTXNO_UNI+T1_3D_NUMCTXS_UNI) /*27*/
/* ----------------------------------------------------------------------- */

View File

@ -156,7 +156,7 @@ void tcd_destroy(opj_tcd_t *tcd) {
/* ----------------------------------------------------------------------- */
void tcd_malloc_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int curtileno) {
int compno, resno, bandno, precno, cblkno, i, j;//, k;
int compno, resno, bandno, precno, cblkno, i, j;/*, k;*/
opj_tcd_tile_t *tile = NULL; /* pointer to tcd->tile */
opj_tcd_tilecomp_t *tilec = NULL; /* pointer to tcd->tilec */
@ -239,7 +239,7 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int
res_max = 0;
for (i = 0;i < 3; i++){
tilec->numresolution[i] = tccp->numresolution[i];
//Greater of 3 resolutions contains all information
/*Greater of 3 resolutions contains all information*/
res_max = (tilec->numresolution[i] > res_max) ? tilec->numresolution[i] : res_max;
}
@ -272,7 +272,7 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int
res->x1 = int_ceildivpow2(tilec->x1, levelnox);
res->y1 = int_ceildivpow2(tilec->y1, levelnoy);
res->z1 = int_ceildivpow2(tilec->z1, levelnoz);
//if (res->z1 < 0)fprintf(stdout,"Res: %d %d/%d --> %d\n",resno,tilec->z1, levelnoz, int_ceildivpow2(tilec->z1, levelnoz));
/*if (res->z1 < 0)fprintf(stdout,"Res: %d %d/%d --> %d\n",resno,tilec->z1, levelnoz, int_ceildivpow2(tilec->z1, levelnoz));*/
res->numbands = (resno == 0) ? 1 : (resno <= diff) ? 3 : 7; /* --> 3D */
@ -323,9 +323,9 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int
cbglengthexpn = pdz - 1;
}
cblkwidthexpn = int_min(tccp->cblk[0], cbgwidthexpn); //6
cblkheightexpn = int_min(tccp->cblk[1], cbgheightexpn); //6
cblklengthexpn = int_min(tccp->cblk[2], cbglengthexpn); //6
cblkwidthexpn = int_min(tccp->cblk[0], cbgwidthexpn); /*6*/
cblkheightexpn = int_min(tccp->cblk[1], cbgheightexpn); /*6*/
cblklengthexpn = int_min(tccp->cblk[2], cbglengthexpn); /*6*/
res->bands = (opj_tcd_band_t *) opj_malloc(res->numbands * sizeof(opj_tcd_band_t));
for (bandno = 0; bandno < res->numbands; bandno++) {
@ -414,7 +414,7 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int
prc->cblks = (opj_tcd_cblk_t *) opj_malloc((prc->cblkno[0] * prc->cblkno[1] * prc->cblkno[2]) * sizeof(opj_tcd_cblk_t));
prc->incltree = tgt_create(prc->cblkno[0], prc->cblkno[1], prc->cblkno[2]);
prc->imsbtree = tgt_create(prc->cblkno[0], prc->cblkno[1], prc->cblkno[2]);
//tgt_tree_dump(stdout,prc->incltree);
/*tgt_tree_dump(stdout,prc->incltree);*/
for (cblkno = 0; cblkno < (prc->cblkno[0] * prc->cblkno[1] * prc->cblkno[2]); cblkno++) {
int cblkxstart = tlcblkxstart + (cblkno % prc->cblkno[0]) * (1 << cblkwidthexpn);
int cblkystart = tlcblkystart + ((cblkno % (prc->cblkno[0] * prc->cblkno[1])) / prc->cblkno[0]) * (1 << cblkheightexpn);
@ -439,7 +439,7 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int
}
}
}
//tcd_dump(stdout, tcd, tcd->tcd_volume);
/*tcd_dump(stdout, tcd, tcd->tcd_volume);*/
}
void tcd_init_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int curtileno) {
@ -518,7 +518,7 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int c
res_max = 0;
for (i = 0;i < 3; i++){
tilec->numresolution[i] = tccp->numresolution[i];
//Greater of 3 resolutions contains all information
/*Greater of 3 resolutions contains all information*/
res_max = (tilec->numresolution[i] > res_max) ? tilec->numresolution[i] : res_max;
}
@ -547,7 +547,8 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int c
res->y1 = int_ceildivpow2(tilec->y1, levelnoy);
res->z1 = int_ceildivpow2(tilec->z1, levelnoz);
// res->numbands = resno == 0 ? 1 : 3; /* --> 2D */
/* res->numbands = resno == 0 ? 1 : 3; *//* --> 2D */
res->numbands = (resno == 0) ? 1 : (resno <= diff) ? 3 : 7; /* --> 3D */
/* p. 30, table A-13, ISO/IEC IS154444-1 : 2002 */
@ -707,7 +708,7 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp, int c
} /* bandno */
} /* resno */
} /* compno */
//tcd_dump(stdout, tcd, tcd->tcd_volume);
/*tcd_dump(stdout, tcd, tcd->tcd_volume);*/
}
@ -715,7 +716,7 @@ void tcd_free_encode(opj_tcd_t *tcd) {
int tileno, compno, resno, bandno, precno;
opj_tcd_tile_t *tile = NULL; /* pointer to tcd->tile */
// opj_tcd_slice_t *slice = NULL; /* pointer to tcd->slice */
/* opj_tcd_slice_t *slice = NULL; */ /* pointer to tcd->slice */
opj_tcd_tilecomp_t *tilec = NULL; /* pointer to tcd->tilec */
opj_tcd_resolution_t *res = NULL; /* pointer to tcd->res */
opj_tcd_band_t *band = NULL; /* pointer to tcd->band */
@ -821,7 +822,7 @@ void tcd_malloc_decode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp) {
res_max = 0;
for (i = 0;i < 3; i++){
tilec->numresolution[i] = tccp->numresolution[i];
//Greater of 3 resolutions contains all information
/*Greater of 3 resolutions contains all information*/
res_max = (tilec->numresolution[i] > res_max) ? tilec->numresolution[i] : res_max;
}
@ -874,13 +875,13 @@ void tcd_malloc_decode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp) {
/* p. 67, B.17 & B.18, ISO/IEC IS15444-1 : 2002 */
if (resno == 0) {
tlcbgxstart = tlprcxstart;//0
tlcbgxstart = tlprcxstart;/*0*/
tlcbgystart = tlprcystart;
tlcbgzstart = tlprczstart;
brcbgxend = brprcxend;//1
brcbgxend = brprcxend;/*1*/
brcbgyend = brprcyend;
brcbgzend = brprczend;
cbgwidthexpn = pdx; //15
cbgwidthexpn = pdx; /*15*/
cbgheightexpn = pdy;
cbglengthexpn = pdz;
} else {
@ -895,9 +896,9 @@ void tcd_malloc_decode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp) {
cbglengthexpn = pdz - 1;
}
cblkwidthexpn = int_min(tccp->cblk[0], cbgwidthexpn); //6
cblkheightexpn = int_min(tccp->cblk[1], cbgheightexpn); //6
cblklengthexpn = int_min(tccp->cblk[2], cbglengthexpn); //6
cblkwidthexpn = int_min(tccp->cblk[0], cbgwidthexpn); /*6*/
cblkheightexpn = int_min(tccp->cblk[1], cbgheightexpn); /*6*/
cblklengthexpn = int_min(tccp->cblk[2], cbglengthexpn); /*6*/
res->bands = (opj_tcd_band_t *) opj_malloc(res->numbands * sizeof(opj_tcd_band_t));
for (bandno = 0; bandno < res->numbands; bandno++) {
@ -1003,7 +1004,7 @@ void tcd_malloc_decode(opj_tcd_t *tcd, opj_volume_t * volume, opj_cp_t * cp) {
} /* compno */
} /* i = 0..cp->tileno_size */
//tcd_dump(stdout, tcd, tcd->tcd_volume);
/*tcd_dump(stdout, tcd, tcd->tcd_volume);*/
/*
Allocate place to store the decoded data = final volume
@ -1234,7 +1235,7 @@ void tcd_makelayer(opj_tcd_t *tcd, int layno, double thresh, int final) {
if (final)
cblk->numpassesinlayers = n;
// fprintf(stdout,"MakeLayer : %d %f %d %d \n",layer->len, layer->disto, layer->numpasses, n);
/* fprintf(stdout,"MakeLayer : %d %f %d %d \n",layer->len, layer->disto, layer->numpasses, n);*/
}
}
}
@ -1346,7 +1347,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_volume_i
lo = thresh;
} else { /* disto_alloc -r, fixed_alloc -f */
l = t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest, maxlen, volume_info);
//fprintf(stdout, "layno %d i %d len=%d max=%d \n",layno,i,l,maxlen);
/*fprintf(stdout, "layno %d i %d len=%d max=%d \n",layno,i,l,maxlen);*/
if (l == -999) {
lo = thresh;
continue;
@ -1433,7 +1434,7 @@ int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, op
opj_tcd_tilecomp_t *tilec = &tile->comps[compno];
int adjust;
int offset_x = int_ceildiv(volume->x0, volume->comps[compno].dx); //ceil(x0 / subsampling_dx)
int offset_x = int_ceildiv(volume->x0, volume->comps[compno].dx); /*ceil(x0 / subsampling_dx)*/
int offset_y = int_ceildiv(volume->y0, volume->comps[compno].dy);
int offset_z = int_ceildiv(volume->z0, volume->comps[compno].dz);
@ -1447,18 +1448,18 @@ int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, op
/* extract tile data from volume.comps[0].data to tile.comps[0].data */
//fprintf(stdout,"[INFO] Extract tile data\n");
/*fprintf(stdout,"[INFO] Extract tile data\n");*/
if (tcd->cp->transform_format == TRF_3D_RLS || tcd->cp->transform_format == TRF_3D_LSE) {
adjust = 0;
} else {
adjust = volume->comps[compno].sgnd ? 0 : 1 << (volume->comps[compno].prec - 1); //sign=='+' --> 2^(prec-1)
adjust = volume->comps[compno].sgnd ? 0 : 1 << (volume->comps[compno].prec - 1); /*sign=='+' --> 2^(prec-1)*/
if (volume->comps[compno].dcoffset != 0){
adjust += volume->comps[compno].dcoffset;
fprintf(stdout,"[INFO] DC Offset applied: DCO = %d -> adjust = %d\n",volume->comps[compno].dcoffset,adjust);
}
}
if (tcd_tcp->tccps[compno].reversible == 1) { //IF perfect reconstruction (DWT.5-3)
if (tcd_tcp->tccps[compno].reversible == 1) { /*IF perfect reconstruction (DWT.5-3)*/
for (z = tilec->z0; z < tilec->z1; z++) {
for (y = tilec->y0; y < tilec->y1; y++) {
/* start of the src tile scanline */
@ -1470,7 +1471,7 @@ int tcd_encode_tile(opj_tcd_t *tcd, int tileno, unsigned char *dest, int len, op
}
}
}
} else if (tcd_tcp->tccps[compno].reversible == 0) { //IF not (DWT.9-7)
} else if (tcd_tcp->tccps[compno].reversible == 0) { /*IF not (DWT.9-7)*/
for (z = tilec->z0; z < tilec->z1; z++) {
for (y = tilec->y0; y < tilec->y1; y++) {
/* start of the src tile scanline */
@ -1694,7 +1695,7 @@ bool tcd_decode_tile(opj_tcd_t *tcd, unsigned char *src, int len, int tileno) {
if (tcd->cp->transform_format == TRF_3D_RLS || tcd->cp->transform_format == TRF_3D_LSE) {
adjust = 0;
} else {
adjust = tcd->volume->comps[compno].sgnd ? 0 : 1 << (tcd->volume->comps[compno].prec - 1); //sign=='+' --> 2^(prec-1)
adjust = tcd->volume->comps[compno].sgnd ? 0 : 1 << (tcd->volume->comps[compno].prec - 1); /*sign=='+' --> 2^(prec-1)*/
if (tcd->volume->comps[compno].dcoffset != 0){
adjust += tcd->volume->comps[compno].dcoffset;
fprintf(stdout,"[INFO] DC Offset applied: DCO = %d -> adjust = %d\n",tcd->volume->comps[compno].dcoffset,adjust);

View File

@ -115,7 +115,7 @@ typedef struct opj_tcd_cblk {
opj_tcd_pass_t passes[100];
/* Data */
unsigned char data[524288];
//unsigned char *data;
/*unsigned char *data;*/
} opj_tcd_cblk_t;
/**

View File

@ -1610,6 +1610,7 @@ opj_bool jpwl_esd_write(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf)
/* update markers struct */
j2k_add_marker(j2k->cstr_info, J2K_MS_ESD, -1, esd->Lesd + 2);
return OPJ_TRUE;
}
unsigned short int jpwl_double_to_pfp(double V, int bytes) {