summaryrefslogtreecommitdiff
path: root/libopenjpeg/tcd.c
diff options
context:
space:
mode:
authorParvatha Elangovan <p.elangovan@intopix.com>2007-09-18 13:07:29 +0000
committerParvatha Elangovan <p.elangovan@intopix.com>2007-09-18 13:07:29 +0000
commita6ba04cdf49772f2e90515b277f174a0849bc8b6 (patch)
tree3e6c84b511eea2b4e8cdee54b8b346d9846e1251 /libopenjpeg/tcd.c
parent55c4c14352519b84ad79abcb2f8527e1c25b9e54 (diff)
Fixed issues with Reading and Writing TIF images in convert.c to avoid segmentation fault.
Fixed issues relating to using user specified rates for CINEMA option for multiple images.
Diffstat (limited to 'libopenjpeg/tcd.c')
-rw-r--r--libopenjpeg/tcd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c
index 8f59caa4..42c07384 100644
--- a/libopenjpeg/tcd.c
+++ b/libopenjpeg/tcd.c
@@ -1069,11 +1069,12 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
==> possible to have some lossy layers and the last layer for sure lossless */
if ( ((cp->disto_alloc==1) && (tcd_tcp->rates[layno]>0)) || ((cp->fixed_quality==1) && (tcd_tcp->distoratio[layno]>0))) {
opj_t2_t *t2 = t2_create(tcd->cinfo, tcd->image, cp);
+ double thresh = 0;
for (i = 0; i < 32; i++) {
- double thresh = (lo + hi) / 2;
int l = 0;
double distoachieved = 0; /* fixed_quality */
+ thresh = (lo + hi) / 2;
tcd_makelayer(tcd, layno, thresh, 0);
@@ -1117,7 +1118,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_codestre
}
}
success = 1;
- goodthresh = stable_thresh;
+ goodthresh = stable_thresh == 0? thresh : stable_thresh;
t2_destroy(t2);
} else {
success = 1;