Bugs corrected in decoding of command line (getopt.c), in the handling of 16 bit files (t1.c and tcd.c) and the calculation of elapsed time for multiple tiles parts (tcd.c and tdc.h).

This commit is contained in:
Francois-Olivier Devaux
2007-06-04 13:23:26 +00:00
parent adc1aacb60
commit ea9335ff48
7 changed files with 131 additions and 98 deletions

View File

@@ -129,11 +129,27 @@ struct option *longopts, int totlen) {
static int lastidx,lastofs;
char *tmp;
int i,len;
char param = 1;
again:
if (optind>argc || !argv[optind] || *argv[optind]!='-' || argv[optind][1]==0)
if (optind>argc || !argv[optind] || *argv[optind]!='-')
return -1;
if (argv[optind][0]=='-' && argv[optind][1]==0) {
if(optind >= (argc - 1)){ /* no more input parameters */
param = 0;
}
else{ /* more input parameters */
if(argv[optind + 1][0] == '-'){
param = 0; /* Missing parameter after '-' */
}
else{
param = 2;
}
}
}
if (param == 0) {
++optind;
return (BADCH);
}
@@ -144,11 +160,18 @@ again:
o=longopts;
len=sizeof(longopts[0]);
if (param > 1){
arg = argv[optind+1];
optind++;
}
else
arg = argv[optind]+1;
if(strlen(arg)>1){
for (i=0;i<totlen;i=i+len,o++) {
if (!strcmp(o->name,arg)) { /* match */
if (o->has_arg == 0) {
if (!(argv[optind+1][0]=='-')){
if ((argv[optind+1])&&(!(argv[optind+1][0]=='-'))){
fprintf(stderr,"%s: option does not require an argument. Ignoring %s\n",arg,argv[optind+1]);
++optind;
}

View File

@@ -1278,7 +1278,7 @@ opj_image_t* tiftoimage(char *filename, opj_cparameters_t *parameters)
/* initialize image components*/
memset(&cmptparm[0], 0, 3 * sizeof(opj_image_cmptparm_t));
for(j = 0; j < numcomps; j++) {
if ((parameters->cp_cinema) & (Info.tiBps== 16)){
if (parameters->cp_cinema) {
cmptparm[j].prec = 12;
cmptparm[j].bpp = 12;
}else{
@@ -1335,7 +1335,7 @@ opj_image_t* tiftoimage(char *filename, opj_cparameters_t *parameters)
image->comps[0].data[index] = (image->comps[0].data[index] + 0x08) >> 4 ;
image->comps[1].data[index] = (image->comps[1].data[index] + 0x08) >> 4 ;
image->comps[2].data[index] = (image->comps[2].data[index] + 0x08) >> 4 ;
}
}
index++;
}
}
@@ -1344,6 +1344,11 @@ opj_image_t* tiftoimage(char *filename, opj_cparameters_t *parameters)
image->comps[0].data[index] = dat8[i+0]; // R
image->comps[1].data[index] = dat8[i+1]; // G
image->comps[2].data[index] = dat8[i+2]; // B
if(parameters->cp_cinema){/* Rounding to 12 bits*/
image->comps[0].data[index] = image->comps[0].data[index] << 4 ;
image->comps[1].data[index] = image->comps[1].data[index] << 4 ;
image->comps[2].data[index] = image->comps[2].data[index] << 4 ;
}
index++;
}
}

View File

@@ -483,7 +483,7 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image){
parameters->numresolution = 6;
}
if (!((image->comps[0].w == 2048) | (image->comps[0].h == 1080))){
fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nDCI 2K compliance requires that atleast one of coordinates match 2048 x 1080\n",image->comps[0].w,image->comps[0].h);
fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 (2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n",image->comps[0].w,image->comps[0].h);
parameters->cp_rsiz = STD_RSIZ;
}
break;
@@ -495,7 +495,7 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image){
parameters->numresolution = 7;
}
if (!((image->comps[0].w == 4096) | (image->comps[0].h == 2160))){
fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nDCI 4K compliance requires that atleast one of coordinates match 4096 x 2160\n",image->comps[0].w,image->comps[0].h);
fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\JPEG Digital Cinema Profile-4 (4K profile) compliance requires that atleast one of coordinates match 4096 x 2160\n",image->comps[0].w,image->comps[0].h);
parameters->cp_rsiz = STD_RSIZ;
}
parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution);