opj_tcd_rateallocate(): make sure to use all passes for a lossless layer (#1009)

And save a useless loop, which should be a tiny faster.
This commit is contained in:
Even Rouault 2017-09-01 20:01:39 +02:00
parent 7aa071aa27
commit b428b8c7e7
1 changed files with 25 additions and 19 deletions

View File

@ -269,6 +269,10 @@ void opj_tcd_makelayer(opj_tcd_t *tcd,
n = cblk->numpassesinlayers;
if (thresh < 0) {
/* Special value to indicate to use all passes */
n = cblk->totalpasses;
} else {
for (passno = cblk->numpassesinlayers; passno < cblk->totalpasses; passno++) {
OPJ_UINT32 dr;
OPJ_FLOAT64 dd;
@ -293,6 +297,7 @@ void opj_tcd_makelayer(opj_tcd_t *tcd,
n = passno + 1;
}
}
}
layer->numpasses = n - cblk->numpassesinlayers;
@ -613,7 +618,8 @@ OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
opj_t2_destroy(t2);
} else {
goodthresh = min;
/* Special value to indicate to use all passes */
goodthresh = -1;
}
if (cstr_info) { /* Threshold for Marcela Index */