summaryrefslogtreecommitdiff
path: root/codec
diff options
context:
space:
mode:
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2007-06-04 13:23:26 +0000
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2007-06-04 13:23:26 +0000
commitea9335ff48f106556e04a249d88246dba493a62a (patch)
tree405b1f1960745fa1c4645b0abedab9e7cb8da1a6 /codec
parentadc1aacb600419d6ce8427d652da4f53efc5e408 (diff)
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).
Diffstat (limited to 'codec')
-rw-r--r--codec/compat/getopt.c27
-rw-r--r--codec/convert.c9
-rw-r--r--codec/image_to_j2k.c4
3 files changed, 34 insertions, 6 deletions
diff --git a/codec/compat/getopt.c b/codec/compat/getopt.c
index 3ecbde15..1491bf03 100644
--- a/codec/compat/getopt.c
+++ b/codec/compat/getopt.c
@@ -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;
}
diff --git a/codec/convert.c b/codec/convert.c
index 936d5a48..4aafaae8 100644
--- a/codec/convert.c
+++ b/codec/convert.c
@@ -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++;
}
}
diff --git a/codec/image_to_j2k.c b/codec/image_to_j2k.c
index d54fe383..24276028 100644
--- a/codec/image_to_j2k.c
+++ b/codec/image_to_j2k.c
@@ -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);