[trunk] Rework r2597, make sure test suite is passing now.
Update issue 256
This commit is contained in:
parent
61348b20b4
commit
581d2ba8b4
|
@ -573,8 +573,7 @@ OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
|
||||||
cblk = &prc->cblks.enc[cblkno];
|
cblk = &prc->cblks.enc[cblkno];
|
||||||
|
|
||||||
cblk->numpasses = 0;
|
cblk->numpasses = 0;
|
||||||
assert(band->numbps>=0);
|
opj_tgt_setvalue(prc->imsbtree, cblkno, band->numbps - cblk->numbps);
|
||||||
opj_tgt_setvalue(prc->imsbtree, cblkno, (OPJ_INT32)((OPJ_UINT32)band->numbps - cblk->numbps));
|
|
||||||
}
|
}
|
||||||
++band;
|
++band;
|
||||||
}
|
}
|
||||||
|
@ -596,7 +595,7 @@ OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
|
||||||
opj_tcd_layer_t *layer = &cblk->layers[layno];
|
opj_tcd_layer_t *layer = &cblk->layers[layno];
|
||||||
|
|
||||||
if (!cblk->numpasses && layer->numpasses) {
|
if (!cblk->numpasses && layer->numpasses) {
|
||||||
opj_tgt_setvalue(prc->incltree, cblkno, (OPJ_INT32)layno);
|
opj_tgt_setvalue(prc->incltree, cblkno, layno);
|
||||||
}
|
}
|
||||||
|
|
||||||
++cblk;
|
++cblk;
|
||||||
|
@ -612,7 +611,7 @@ OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
|
||||||
|
|
||||||
/* cblk inclusion bits */
|
/* cblk inclusion bits */
|
||||||
if (!cblk->numpasses) {
|
if (!cblk->numpasses) {
|
||||||
opj_tgt_encode(bio, prc->incltree, cblkno, (OPJ_INT32)(layno + 1));
|
opj_tgt_encode(bio, prc->incltree, cblkno, layno + 1);
|
||||||
} else {
|
} else {
|
||||||
opj_bio_write(bio, layer->numpasses != 0, 1);
|
opj_bio_write(bio, layer->numpasses != 0, 1);
|
||||||
}
|
}
|
||||||
|
@ -647,7 +646,7 @@ OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
|
||||||
|
|
||||||
++pass;
|
++pass;
|
||||||
}
|
}
|
||||||
opj_t2_putcommacode(bio, (OPJ_INT32)increment);
|
opj_t2_putcommacode(bio, increment);
|
||||||
|
|
||||||
/* computation of the new Length indicator */
|
/* computation of the new Length indicator */
|
||||||
cblk->numlenbits += increment;
|
cblk->numlenbits += increment;
|
||||||
|
@ -659,7 +658,7 @@ OPJ_BOOL opj_t2_encode_packet( OPJ_UINT32 tileno,
|
||||||
len += pass->len;
|
len += pass->len;
|
||||||
|
|
||||||
if (pass->term || passno == (cblk->numpasses + layer->numpasses) - 1) {
|
if (pass->term || passno == (cblk->numpasses + layer->numpasses) - 1) {
|
||||||
opj_bio_write(bio, len, cblk->numlenbits + (OPJ_UINT32)opj_int_floorlog2((OPJ_INT32)nump));
|
opj_bio_write(bio, len, cblk->numlenbits + opj_int_floorlog2(nump));
|
||||||
len = 0;
|
len = 0;
|
||||||
nump = 0;
|
nump = 0;
|
||||||
}
|
}
|
||||||
|
@ -936,7 +935,7 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||||
|
|
||||||
/* if cblk not yet included before --> inclusion tagtree */
|
/* if cblk not yet included before --> inclusion tagtree */
|
||||||
if (!l_cblk->numsegs) {
|
if (!l_cblk->numsegs) {
|
||||||
l_included = opj_tgt_decode(l_bio, l_prc->incltree, cblkno, (OPJ_INT32)(p_pi->layno + 1));
|
l_included = opj_tgt_decode(l_bio, l_prc->incltree, cblkno, p_pi->layno + 1);
|
||||||
/* else one bit */
|
/* else one bit */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -954,12 +953,11 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||||
if (!l_cblk->numsegs) {
|
if (!l_cblk->numsegs) {
|
||||||
OPJ_UINT32 i = 0;
|
OPJ_UINT32 i = 0;
|
||||||
|
|
||||||
while (!opj_tgt_decode(l_bio, l_prc->imsbtree, cblkno, (OPJ_INT32)i)) {
|
while (!opj_tgt_decode(l_bio, l_prc->imsbtree, cblkno, i)) {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(l_band->numbps >= 0);
|
l_cblk->numbps = l_band->numbps + 1 - i;
|
||||||
l_cblk->numbps = (OPJ_UINT32)l_band->numbps + 1 - i;
|
|
||||||
l_cblk->numlenbits = 3;
|
l_cblk->numlenbits = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,13 +985,13 @@ OPJ_BOOL opj_t2_read_packet_header( opj_t2_t* p_t2,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
n = (OPJ_INT32)l_cblk->numnewpasses;
|
n = l_cblk->numnewpasses;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
l_cblk->segs[l_segno].numnewpasses = (OPJ_UINT32)opj_int_min((OPJ_INT32)(l_cblk->segs[l_segno].maxpasses - l_cblk->segs[l_segno].numpasses), n);
|
l_cblk->segs[l_segno].numnewpasses = opj_int_min(l_cblk->segs[l_segno].maxpasses - l_cblk->segs[l_segno].numpasses, n);
|
||||||
l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, l_cblk->numlenbits + opj_uint_floorlog2(l_cblk->segs[l_segno].numnewpasses));
|
l_cblk->segs[l_segno].newlen = opj_bio_read(l_bio, l_cblk->numlenbits + opj_uint_floorlog2(l_cblk->segs[l_segno].numnewpasses));
|
||||||
|
|
||||||
n -= (OPJ_INT32)l_cblk->segs[l_segno].numnewpasses;
|
n -= l_cblk->segs[l_segno].numnewpasses;
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
++l_segno;
|
++l_segno;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue