summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2007-08-21 09:06:13 +0000
committerFrancois-Olivier Devaux <fodevaux@users.noreply.github.com>2007-08-21 09:06:13 +0000
commit00e440ebdbbe730c896567e04ae1869093e7bda6 (patch)
treef2b733bd62f6cf1ad4e9845ad3c44ec796faf986
parent17f0828c74d94b1fd3a4674372518703d4da939c (diff)
Corrected allocation to take into account the EOC marker
-rw-r--r--libopenjpeg/tcd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c
index 003d521e..4c9f0c93 100644
--- a/libopenjpeg/tcd.c
+++ b/libopenjpeg/tcd.c
@@ -172,6 +172,10 @@ void tcd_malloc_encode(opj_tcd_t *tcd, opj_image_t * image, opj_cp_t * cp, int c
if (!j && tcp->rates[j] < 30)
tcp->rates[j] = 30;
}
+
+ if(j == (tcp->numlayers-1)){
+ tcp->rates[j] = tcp->rates[j]- 2;
+ }
}
}
/* << Modification of the RATE */
@@ -1055,8 +1059,7 @@ bool tcd_rateallocate(opj_tcd_t *tcd, unsigned char *dest, int len, opj_image_in
double lo = min;
double hi = max;
int success = 0;
- /* TODO: remove maxlen */
- int maxlen = tcd_tcp->rates[layno] ? int_min(((int) ceil(tcd_tcp->rates[layno]- 2)), len) : len;
+ int maxlen = tcd_tcp->rates[layno] ? int_min(((int) ceil(tcd_tcp->rates[layno])), len) : len;
double goodthresh = 0;
double stable_thresh = 0;
int i;
@@ -1444,3 +1447,4 @@ void tcd_free_decode_tile(opj_tcd_t *tcd, int tileno) {
+