X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fbin%2Fjp2%2Fopj_compress.c;h=e9f3eedf78d53795327314f52218fec1c68c83a0;hb=6def7e38b4497b81f9338876548e97e8279c2acd;hp=41959e201f24f9d0e471f6c79ddb3a67aed50245;hpb=7924d3a456c04e376153900f39dc8928f5ae276b;p=openjpeg.git diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index 41959e20..e9f3eedf 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -699,7 +699,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param OPJ_UINT32 numlayers = 0, numresolution = 0, matrix_width = 0; char *s = opj_optarg; - sscanf(s, "%ud", &numlayers); + sscanf(s, "%u", &numlayers); s++; if (numlayers > 9) s++; @@ -871,7 +871,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param char *s = opj_optarg; POC = parameters->POC; - while (sscanf(s, "T%ud=%ud,%ud,%ud,%ud,%ud,%4s", &POC[numpocs].tile, + while (sscanf(s, "T%u=%u,%u,%u,%u,%u,%4s", &POC[numpocs].tile, &POC[numpocs].resno0, &POC[numpocs].compno0, &POC[numpocs].layno1, &POC[numpocs].resno1, &POC[numpocs].compno1, POC[numpocs].progorder) == 7) { @@ -1456,7 +1456,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param }else{ if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) { fprintf(stderr, "[ERROR] Required parameters are missing\n" - "Example: %s -i image.j2k -o image.pgm\n",argv[0]); + "Example: %s -i image.pgm -o image.j2k\n",argv[0]); fprintf(stderr, " Help: %s -h\n",argv[0]); return 1; } @@ -1500,6 +1500,14 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param } } + /* If subsampled image is provided, automatically disable MCT */ + if ( ((parameters->decod_format == RAW_DFMT) || (parameters->decod_format == RAWL_DFMT)) + && ( ((raw_cp->rawComp > 1 ) && ((raw_cp->rawComps[1].dx > 1) || (raw_cp->rawComps[1].dy > 1))) + || ((raw_cp->rawComp > 2 ) && ((raw_cp->rawComps[2].dx > 1) || (raw_cp->rawComps[2].dy > 1))) + )) { + parameters->tcp_mct = 0; + } + return 0; } @@ -1572,22 +1580,6 @@ int main(int argc, char **argv) { return 1; } - /* Create comment for codestream */ - if(parameters.cp_comment == NULL) { - const char comment[] = "Created by OpenJPEG version "; - const size_t clen = strlen(comment); - const char *version = opj_version(); - /* UniPG>> */ -#ifdef USE_JPWL - parameters.cp_comment = (char*)malloc(clen+strlen(version)+11); - sprintf(parameters.cp_comment,"%s%s with JPWL", comment, version); -#else - parameters.cp_comment = (char*)malloc(clen+strlen(version)+1); - sprintf(parameters.cp_comment,"%s%s", comment, version); -#endif - /* <