enable decimation of input TIF
This commit is contained in:
parent
714c63efee
commit
4735d941d9
|
@ -1507,6 +1507,10 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||||
scale_component(&(image->comps[j]), 12);
|
scale_component(&(image->comps[j]), 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if ((parameters->target_bitdepth > 0) && (parameters->target_bitdepth != tiBps)) {
|
||||||
|
for (j = 0; j < numcomps; ++j) {
|
||||||
|
scale_component(&(image->comps[j]), parameters->target_bitdepth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,10 @@ static void encode_help_display(void)
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
" It corresponds to the number of DWT decompositions +1. \n");
|
" It corresponds to the number of DWT decompositions +1. \n");
|
||||||
fprintf(stdout, " Default: 6.\n");
|
fprintf(stdout, " Default: 6.\n");
|
||||||
|
fprintf(stdout, "-X <target bitdepth>\n");
|
||||||
|
fprintf(stdout, " Target bitdepth.\n");
|
||||||
|
fprintf(stdout, " Number of bits per component to use from input image\n");
|
||||||
|
fprintf(stdout, " if all bits are unwanted. \n");
|
||||||
fprintf(stdout, "-b <cblk width>,<cblk height>\n");
|
fprintf(stdout, "-b <cblk width>,<cblk height>\n");
|
||||||
fprintf(stdout,
|
fprintf(stdout,
|
||||||
" Code-block size. The dimension must respect the constraint \n");
|
" Code-block size. The dimension must respect the constraint \n");
|
||||||
|
@ -623,7 +627,7 @@ static int parse_cmdline_encoder(int argc, char **argv,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* parse the command line */
|
/* parse the command line */
|
||||||
const char optlist[] = "i:o:r:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:u:JY:"
|
const char optlist[] = "i:o:r:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:u:JY:X:"
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
"W:"
|
"W:"
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
|
@ -908,6 +912,19 @@ static int parse_cmdline_encoder(int argc, char **argv,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
case 'X': { /* target bitdepth */
|
||||||
|
int target_bitdepth = 0;
|
||||||
|
char *s = opj_optarg;
|
||||||
|
sscanf(s, "%d", &target_bitdepth);
|
||||||
|
if (target_bitdepth <= 0) {
|
||||||
|
fprintf(stderr, "Target bitdepth must be at least 1 bit.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
parameters->target_bitdepth = target_bitdepth;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
case 'n': { /* resolution */
|
case 'n': { /* resolution */
|
||||||
|
|
|
@ -756,6 +756,7 @@ void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t
|
||||||
parameters->tp_on = 0;
|
parameters->tp_on = 0;
|
||||||
parameters->decod_format = -1;
|
parameters->decod_format = -1;
|
||||||
parameters->cod_format = -1;
|
parameters->cod_format = -1;
|
||||||
|
parameters->target_bitdepth = -1;
|
||||||
parameters->tcp_rates[0] = 0;
|
parameters->tcp_rates[0] = 0;
|
||||||
parameters->tcp_numlayers = 0;
|
parameters->tcp_numlayers = 0;
|
||||||
parameters->cp_disto_alloc = 0;
|
parameters->cp_disto_alloc = 0;
|
||||||
|
|
|
@ -465,6 +465,8 @@ typedef struct opj_cparameters {
|
||||||
int decod_format;
|
int decod_format;
|
||||||
/** output file format 0: J2K, 1: JP2, 2: JPT */
|
/** output file format 0: J2K, 1: JP2, 2: JPT */
|
||||||
int cod_format;
|
int cod_format;
|
||||||
|
/** desired bitdepth from input file */
|
||||||
|
int target_bitdepth;
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
/* UniPG>> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */
|
/* UniPG>> */ /* NOT YET USED IN THE V2 VERSION OF OPENJPEG */
|
||||||
|
|
Loading…
Reference in New Issue