Fixed an historical bug in t1.c that leaded to the inclusion of useless 0xFF in the codestream. Thanks to Sylvain, Pascal and Parvatha !

This commit is contained in:
Francois-Olivier Devaux 2007-03-28 08:44:21 +00:00
parent 144e1ff4e6
commit 5a3c1ffe7d
2 changed files with 15 additions and 1 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
March 28, 2007
* [FOD] Fixed an historical bug in t1.c that leaded to the inclusion of useless 0xFF in the codestream. Thanks to Sylvain, Pascal and Parvatha !
March 27, 2007
+ [GB] Improved parsing in OPJViewer, as well some minor aesthetic modifications; support for image rendering with bit depths lower than 8 bits; can display an arbitrary frame of an MJ2 file (only in B/W, though); can reload a file; better resizing capabilities
* [GB] Following to Hervé's suggestions, all the exit() calls, added by JPWL strict checking in t2.c and j2k.c, have been substituted with (object free'ing + opj_evt_message(EVT_ERROR) + return)

View File

@ -626,7 +626,6 @@ static void t1_encode_cblk(opj_t1_t *t1, opj_tcd_cblk_t * cblk, int orient, int
pass->distortiondec = cumwmsedec;
pass->rate = mqc_numbytes(mqc) + correction; /* FIXME */
pass->len = pass->rate - (passno == 0 ? 0 : cblk->passes[passno - 1].rate);
/* Code-switch "RESET" */
if (cblksty & J2K_CCP_CBLKSTY_RESET)
@ -640,6 +639,17 @@ static void t1_encode_cblk(opj_t1_t *t1, opj_tcd_cblk_t * cblk, int orient, int
mqc_flush(mqc);
cblk->totalpasses = passno;
for (passno = 0; passno<cblk->totalpasses; passno++) {
opj_tcd_pass_t *pass = &cblk->passes[passno];
if (pass->rate > mqc_numbytes(mqc))
pass->rate = mqc_numbytes(mqc);
/*Preventing generation of FF as last data byte of a pass*/
if((pass->rate>1) && (cblk->data[pass->rate - 1] == 0xFF)){
pass->rate--;
}
pass->len = pass->rate - (passno == 0 ? 0 : cblk->passes[passno - 1].rate);
}
}
static void t1_decode_cblk(opj_t1_t *t1, opj_tcd_cblk_t * cblk, int orient, int roishift, int cblksty) {
@ -1078,3 +1088,4 @@ void t1_decode_cblks(opj_t1_t *t1, opj_tcd_tile_t *tile, opj_tcp_t *tcp) {
} /* compno */
}