From ccd448d626dcc8dde01053d7a98b4a28f76dd0c1 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Thu, 3 Jan 2013 14:26:38 +0000 Subject: [PATCH] [trunk] JP3D: Fix issue with Z handling in packet iterator --- src/lib/openjp3d/pi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/openjp3d/pi.c b/src/lib/openjp3d/pi.c index 185d2620..44c7c529 100644 --- a/src/lib/openjp3d/pi.c +++ b/src/lib/openjp3d/pi.c @@ -358,13 +358,16 @@ static bool pi_next_cprl(opj_pi_iterator_t * pi) { comp = &pi->comps[pi->compno]; pi->dx = 0; pi->dy = 0; + pi->dz = 0; for (resno = 0; resno < comp->numresolution[0]; resno++) { - int dx, dy; + int dx, dy, dz; res = &comp->resolutions[resno]; dx = comp->dx * (1 << (res->pdx + comp->numresolution[0] - 1 - resno)); - dy = comp->dy * (1 << (res->pdy + comp->numresolution[0] - 1 - resno)); + dy = comp->dy * (1 << (res->pdy + comp->numresolution[1] - 1 - resno)); + dz = comp->dz * (1 << (res->pdz + comp->numresolution[2] - 1 - resno)); pi->dx = !pi->dx ? dx : int_min(pi->dx, dx); pi->dy = !pi->dy ? dy : int_min(pi->dy, dy); + pi->dz = !pi->dz ? dz : int_min(pi->dz, dz); } for (pi->z = pi->tz0; pi->z < pi->tz1; pi->z += pi->dz - (pi->z % pi->dz)) { for (pi->y = pi->ty0; pi->y < pi->ty1; pi->y += pi->dy - (pi->y % pi->dy)) { @@ -522,7 +525,7 @@ opj_pi_iterator_t *pi_create(opj_volume_t *volume, opj_cp_t *cp, int tileno) { } levelnox = comp->numresolution[0] - 1 - resno; levelnoy = comp->numresolution[1] - 1 - resno; - levelnoz = comp->numresolution[2] - 1 - resno; + levelnoz = comp->numresolution[2] - 1 - resno; if (levelnoz < 0) levelnoz = 0; diff = comp->numresolution[0] - comp->numresolution[2];