opj_compress help: revert 3257261776 and indicate 1 again as being the value to get lossless for -r. In opj_j2k_setup_encoder(), make sure that ll rates[] <= 1.0 are set to 0. Document 0 as being lossless for -q / tcp_distoratio (#1009)

This commit is contained in:
Even Rouault 2017-09-01 19:16:35 +02:00
parent 3257261776
commit 09929bb615
3 changed files with 13 additions and 5 deletions

View File

@ -169,16 +169,17 @@ static void encode_help_display(void)
fprintf(stdout, " Different compression ratios for successive layers.\n");
fprintf(stdout,
" The rate specified for each quality level is the desired\n");
fprintf(stdout, " compression factor (use 0 for lossless)\n");
fprintf(stdout, " compression factor (use 1 for lossless)\n");
fprintf(stdout, " Decreasing ratios required.\n");
fprintf(stdout, " Example: -r 20,10,0 means \n");
fprintf(stdout, " Example: -r 20,10,1 means \n");
fprintf(stdout, " quality layer 1: compress 20x, \n");
fprintf(stdout, " quality layer 2: compress 10x \n");
fprintf(stdout, " quality layer 3: compress lossless\n");
fprintf(stdout, " Options -r and -q cannot be used together.\n");
fprintf(stdout, "-q <psnr value>,<psnr value>,<psnr value>,...\n");
fprintf(stdout, " Different psnr for successive layers (-q 30,40,50).\n");
fprintf(stdout, " Increasing PSNR values required.\n");
fprintf(stdout, " Increasing PSNR values required, except 0 which can\n");
fprintf(stdout, " be used for the last layer to indicate it is lossless.\n");
fprintf(stdout, " Options -r and -q cannot be used together.\n");
fprintf(stdout, "-n <number of resolutions>\n");
fprintf(stdout, " Number of resolutions.\n");

View File

@ -7060,6 +7060,10 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
tcp->rates[j] = parameters->tcp_rates[j];
}
}
if (!cp->m_specific_param.m_enc.m_fixed_quality &&
tcp->rates[j] <= 1.0) {
tcp->rates[j] = 0.0; /* force lossless */
}
}
tcp->csty = (OPJ_UINT32)parameters->csty;

View File

@ -381,9 +381,12 @@ typedef struct opj_cparameters {
OPJ_UINT32 numpocs;
/** number of layers */
int tcp_numlayers;
/** rates of layers - might be subsequently limited by the max_cs_size field */
/** rates of layers - might be subsequently limited by the max_cs_size field.
* Should be decreasing. 1 can be
* used as last value to indicate the last layer is lossless. */
float tcp_rates[100];
/** different psnr for successive layers */
/** different psnr for successive layers. Should be increasing. 0 can be
* used as last value to indicate the last layer is lossless. */
float tcp_distoratio[100];
/** number of resolutions */
int numresolution;