diff options
| author | Matthieu Darbois <mayeut@users.noreply.github.com> | 2015-09-10 15:46:51 +0200 |
|---|---|---|
| committer | Matthieu Darbois <mayeut@users.noreply.github.com> | 2015-09-10 15:46:51 +0200 |
| commit | ee0f3138482fc5ef44f92e6164206bc8df34efe4 (patch) | |
| tree | 9053c99f66a641f05b5cd4ce5ec783a849f0a438 /src | |
| parent | ccdce606f1baa945e5c717064bc17e8218b7cb29 (diff) | |
Update check in opj_tcd_makelayer to be robust to different float precisions
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/openjp2/tcd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/openjp2/tcd.c b/src/lib/openjp2/tcd.c index d227e388..32db260b 100644 --- a/src/lib/openjp2/tcd.c +++ b/src/lib/openjp2/tcd.c @@ -268,7 +268,7 @@ void opj_tcd_makelayer( opj_tcd_t *tcd, n = passno + 1; continue; } - if (dd / dr > thresh) + if (thresh - (dd / dr) <= DBL_EPSILON) /* do not rely on float equality, check with DBL_EPSILON margin */ n = passno + 1; } @@ -565,7 +565,7 @@ OPJ_BOOL opj_tcd_rateallocate( opj_tcd_t *tcd, opj_t2_destroy(t2); } else { success = OPJ_TRUE; - goodthresh = min - DBL_EPSILON; /* do not rely on float equality for lossless transform */ + goodthresh = min; } if (!success) { |
