summaryrefslogtreecommitdiff
path: root/libopenjpeg/tcd.c
diff options
context:
space:
mode:
authorAntonin Descampe <antonin@gmail.com>2006-10-31 17:10:14 +0000
committerAntonin Descampe <antonin@gmail.com>2006-10-31 17:10:14 +0000
commitb565431251c607fe58fda307794bf09399b2681c (patch)
tree74c9a00f6bf266d393c9195fe2cee6d86a850c62 /libopenjpeg/tcd.c
parent480021bc336e22f1b927a3a0267ae38031b902f8 (diff)
added the ability to specify the rate as "float" (before : integer)
Diffstat (limited to 'libopenjpeg/tcd.c')
-rw-r--r--libopenjpeg/tcd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c
index 9222a4d8..bf0a81bf 100644
--- a/libopenjpeg/tcd.c
+++ b/libopenjpeg/tcd.c
@@ -149,11 +149,11 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int c
/* Modification of the RATE >> */
for (j = 0; j < tcp->numlayers; j++) {
tcp->rates[j] = tcp->rates[j] ?
- int_ceildiv(tile->numcomps
+ ((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))
+ * image->comps[0].prec))/
+ (tcp->rates[j] * 8 * image->comps[0].dx * image->comps[0].dy) + 34
: 0;
if (tcp->rates[j]) {
@@ -394,12 +394,12 @@ 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] ?
- int_ceildiv(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;
+ ((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) {
@@ -1020,7 +1020,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_image_in
double hi = max;
int success = 0;
/* TODO: remove maxlen */
- int maxlen = tcd_tcp->rates[layno] ? int_min(tcd_tcp->rates[layno], len) : len;
+ int maxlen = tcd_tcp->rates[layno] ? (tcd_tcp->rates[layno] < len ? tcd_tcp->rates[layno] : len) : len;
double goodthresh = 0;
int i;
double distotarget; /* fixed_quality */