summaryrefslogtreecommitdiff
path: root/libopenjpeg/tcd.c
diff options
context:
space:
mode:
authorParvatha Elangovan <p.elangovan@intopix.com>2008-02-05 15:15:38 +0000
committerParvatha Elangovan <p.elangovan@intopix.com>2008-02-05 15:15:38 +0000
commit29ea3dde47818da3eecb917ebb1db797a3e80d44 (patch)
treea879f9d2ca1e55500d50b140c4ddb9e1f63e373c /libopenjpeg/tcd.c
parente21d8654402fc9e35e9fe18c68da63ce5a731140 (diff)
In convert.c, corrected imagetobmp() conversion for grayscale. In tcd.c, corrected Rate modification in tcd_init_encode().
Diffstat (limited to 'libopenjpeg/tcd.c')
-rw-r--r--libopenjpeg/tcd.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c
index be6f8f27..01ee3950 100644
--- a/libopenjpeg/tcd.c
+++ b/libopenjpeg/tcd.c
@@ -418,12 +418,19 @@ void tcd_init_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int cur
/* Modification of the RATE >> */
for (j = 0; j < tcp->numlayers; j++) {
tcp->rates[j] = tcp->rates[j] ?
- ((float) (tile->numcomps
- * (tile->x1 - tile->x0)
- * (tile->y1 - tile->y0)
- * image->comps[0].prec))/
- (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)
- : 0;
+ cp->tp_on ?
+ (((float) (tile->numcomps
+ * (tile->x1 - tile->x0)
+ * (tile->y1 - tile->y0)
+ * image->comps[0].prec))
+ /(tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)) - (((tcd->cur_totnum_tp - 1) * 14 )/ tcp->numlayers)
+ :
+ ((float) (tile->numcomps
+ * (tile->x1 - tile->x0)
+ * (tile->y1 - tile->y0)
+ * image->comps[0].prec))/
+ (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy)
+ : 0;
if (tcp->rates[j]) {
if (j && tcp->rates[j] < tcp->rates[j - 1] + 10) {