summaryrefslogtreecommitdiff
path: root/libopenjpeg/tcd.c
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2005-07-18 15:21:56 +0000
committerAntonin Descampe <antonin@gmail.com>2005-07-18 15:21:56 +0000
commitde75303c38253bf5f5aeb31d20769c96167fc3a7 (patch)
tree4526e4de35803f9dbe2a64fe10374921e141ea42 /libopenjpeg/tcd.c
parent32ba9920dba8f60e4da28dafd2903feb826c2d64 (diff)
Several bugs fixed when dealing with pgx-files with more than 8 bpp and the fixed_quality feature.
Diffstat (limited to 'libopenjpeg/tcd.c')
-rw-r--r--libopenjpeg/tcd.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c
index 017b638e..f39d3403 100644
--- a/libopenjpeg/tcd.c
+++ b/libopenjpeg/tcd.c
@@ -1076,11 +1076,7 @@ void tcd_rateallocate(unsigned char *dest, int len, info_image * info_IM)
} /* precno */
} /* bandno */
} /* resno */
-
- maxSE +=
- (double) (((1 << tcd_img->comps[compno].prec) -
- 1) * ((1 << tcd_img->comps[compno].prec) -
- 1)) * (tilec->nbpix);
+ maxSE += (((double)(1 << tcd_img->comps[compno].prec) - 1.0) * ((double)(1 << tcd_img->comps[compno].prec) -1.0)) * ((double)(tilec->nbpix));
} /* compno */
/* add antonin index */
@@ -1103,8 +1099,8 @@ void tcd_rateallocate(unsigned char *dest, int len, info_image * info_IM)
double distotarget; //add fixed_quality
distotarget = tcd_tile->distotile - ((K * maxSE) / pow(10, tcd_tcp->distoratio[layno] / 10)); // add fixed_quality
-
- if (tcd_tcp->rates[layno]) {
+
+ if ((tcd_tcp->rates[layno]) || (tcd_cp->disto_alloc==0)) {
for (i = 0; i < 32; i++) {
volatile double thresh = (lo + hi) / 2;
int l = 0;