Fixes overflow when high number of decompositions

Update #603
This commit is contained in:
Antonin Descampe 2015-10-09 16:56:54 +02:00
parent 959ebdab5e
commit 618e50954f
2 changed files with 7 additions and 7 deletions

View File

@ -340,12 +340,12 @@ static opj_bool pi_next_cprl(opj_pi_iterator_t * pi) {
pi->dx = 0;
pi->dy = 0;
for (resno = 0; resno < comp->numresolutions; resno++) {
int dx, dy;
int64 dx, dy;
res = &comp->resolutions[resno];
dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
dx = comp->dx * (((int64) 1) << (res->pdx + comp->numresolutions - 1 - resno));
dy = comp->dy * (((int64) 1) << (res->pdy + comp->numresolutions - 1 - resno));
pi->dx = !pi->dx ? dx : pi->dx < dx ? pi->dx : dx;
pi->dy = !pi->dy ? dy : pi->dy < dy ? pi->dy : dy;
}
if (!pi->tp_on){
pi->poc.ty0 = pi->ty0;

View File

@ -93,8 +93,8 @@ typedef struct opj_pi_iterator {
int numcomps;
/** Components*/
opj_pi_comp_t *comps;
int tx0, ty0, tx1, ty1;
int x, y, dx, dy;
int tx0, ty0, tx1, ty1;
int64 x, y, dx, dy;
} opj_pi_iterator_t;
/** @name Exported functions */