fixed a bug in pi.c, line 473, that appeared when more than 100 precincts were generated in a resolution level

This commit is contained in:
Antonin Descampe 2006-08-04 10:12:14 +00:00
parent 4d6bd49719
commit 7860407cb5
2 changed files with 12 additions and 3 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed ! : changed
+ : added + : added
August 4, 2006
* [Antonin] fixed a bug in pi.c, line 473, that appeared when more than 100 precincts were generated in a resolution level.
July 28, 2006 July 28, 2006
+ [Antonin Descampe] added a readme in /mj2 to warn people that it only works with opj0.97 + [Antonin Descampe] added a readme in /mj2 to warn people that it only works with opj0.97

View File

@ -386,7 +386,6 @@ LABEL_SKIP:;
opj_pi_iterator_t *pi_create(opj_image_t *image, opj_cp_t *cp, int tileno) { opj_pi_iterator_t *pi_create(opj_image_t *image, opj_cp_t *cp, int tileno) {
int p, q; int p, q;
int compno, resno, pino; int compno, resno, pino;
int maxres = 0;
opj_pi_iterator_t *pi = NULL; opj_pi_iterator_t *pi = NULL;
opj_tcp_t *tcp = NULL; opj_tcp_t *tcp = NULL;
opj_tccp_t *tccp = NULL; opj_tccp_t *tccp = NULL;
@ -402,6 +401,8 @@ opj_pi_iterator_t *pi_create(opj_image_t *image, opj_cp_t *cp, int tileno) {
} }
for (pino = 0; pino < tcp->numpocs + 1; pino++) { /* change */ for (pino = 0; pino < tcp->numpocs + 1; pino++) { /* change */
int maxres = 0;
int maxprec = 0;
p = tileno % cp->tw; p = tileno % cp->tw;
q = tileno / cp->tw; q = tileno / cp->tw;
@ -467,17 +468,22 @@ opj_pi_iterator_t *pi_create(opj_image_t *image, opj_cp_t *cp, int tileno) {
py1 = int_ceildivpow2(ry1, res->pdy) << res->pdy; py1 = int_ceildivpow2(ry1, res->pdy) << res->pdy;
res->pw = (rx0==rx1)?0:((px1 - px0) >> res->pdx); res->pw = (rx0==rx1)?0:((px1 - px0) >> res->pdx);
res->ph = (ry0==ry1)?0:((py1 - py0) >> res->pdy); res->ph = (ry0==ry1)?0:((py1 - py0) >> res->pdy);
if (res->pw*res->ph > maxprec) {
maxprec = res->pw*res->ph;
}
} }
} }
tccp = &tcp->tccps[0]; tccp = &tcp->tccps[0];
pi[pino].step_p = 1; pi[pino].step_p = 1;
pi[pino].step_c = 100 * pi[pino].step_p; pi[pino].step_c = maxprec * pi[pino].step_p;
pi[pino].step_r = image->numcomps * pi[pino].step_c; pi[pino].step_r = image->numcomps * pi[pino].step_c;
pi[pino].step_l = maxres * pi[pino].step_r; pi[pino].step_l = maxres * pi[pino].step_r;
if (pino == 0) { if (pino == 0) {
array_size = image->numcomps * maxres * tcp->numlayers * 100 * sizeof(short int); array_size = image->numcomps * maxres * tcp->numlayers * maxprec * sizeof(short int);
pi[pino].include = (short int *) opj_malloc(array_size); pi[pino].include = (short int *) opj_malloc(array_size);
if(!pi[pino].include) { if(!pi[pino].include) {
/* TODO: throw an error */ /* TODO: throw an error */