Minor changes for RESET mode

This commit is contained in:
Antonin Descampe 2004-07-16 09:08:27 +00:00
parent e28d3d63ea
commit 8d2121606d
2 changed files with 19 additions and 18 deletions

View File

@ -670,9 +670,7 @@ void t1_decode_cblk(tcd_cblk_t * cblk, int orient, int roishift,
int w, h; int w, h;
int bpno, passtype; int bpno, passtype;
int segno, passno; int segno, passno;
/* add TONY */ char type = T1_TYPE_MQ; //BYPASS mode
char type = T1_TYPE_MQ;
/* dda */
for (i = 0; i < sizeof(t1_data) / sizeof(int); i++) for (i = 0; i < sizeof(t1_data) / sizeof(int); i++)
((int *) t1_data)[i] = 0; ((int *) t1_data)[i] = 0;
@ -691,19 +689,19 @@ void t1_decode_cblk(tcd_cblk_t * cblk, int orient, int roishift,
for (segno = 0; segno < cblk->numsegs; segno++) { for (segno = 0; segno < cblk->numsegs; segno++) {
tcd_seg_t *seg = &cblk->segs[segno]; tcd_seg_t *seg = &cblk->segs[segno];
/* add TONY */ // Add BYPASS mode
type = ((bpno <= (cblk->numbps - 1) - 4) && (passtype < 2) type = ((bpno <= (cblk->numbps - 1) - 4) && (passtype < 2)
&& (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW : && (cblksty & J2K_CCP_CBLKSTY_LAZY)) ? T1_TYPE_RAW :
T1_TYPE_MQ; T1_TYPE_MQ;
if (type == T1_TYPE_RAW) if (type == T1_TYPE_RAW)
raw_init_dec(seg->data, seg->len); raw_init_dec(seg->data, seg->len);
else else
mqc_init_dec(seg->data, seg->len); mqc_init_dec(seg->data, seg->len);
/* dda */ // ddA
if (bpno==0) cblk->lastbp=1; // Add Antonin : quantizbug1 if (bpno==0) cblk->lastbp=1; // Add Antonin : quantizbug1
for (passno = 0; passno < seg->numpasses; passno++) { for (passno = 0; passno < seg->numpasses; passno++) {
switch (passtype) { switch (passtype) {
case 0: case 0:
@ -716,10 +714,14 @@ void t1_decode_cblk(tcd_cblk_t * cblk, int orient, int roishift,
t1_dec_clnpass(w, h, bpno, orient, cblksty); t1_dec_clnpass(w, h, bpno, orient, cblksty);
break; break;
} }
if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) if ((cblksty & J2K_CCP_CBLKSTY_RESET) && type == T1_TYPE_MQ) {
mqc_reset_enc(); mqc_resetstates();
mqc_setstate(T1_CTXNO_UNI, 0, 46);
mqc_setstate(T1_CTXNO_AGG, 0, 3);
mqc_setstate(T1_CTXNO_ZC, 0, 4);
}
if (++passtype == 3) { if (++passtype == 3) {
passtype = 0; passtype = 0;
bpno--; bpno--;

View File

@ -463,8 +463,6 @@ int t2_decode_packet(unsigned char *src, int len, tcd_tile_t * tile,
c=hd; c=hd;
} }
//bio_init_dec(c, src + len - c);
for (bandno = 0; bandno < res->numbands; bandno++) { for (bandno = 0; bandno < res->numbands; bandno++) {
tcd_band_t *band = &res->bands[bandno]; tcd_band_t *band = &res->bands[bandno];
tcd_precinct_t *prc = &band->precincts[precno]; tcd_precinct_t *prc = &band->precincts[precno];
@ -479,7 +477,8 @@ int t2_decode_packet(unsigned char *src, int len, tcd_tile_t * tile,
if (!cblk->numnewpasses) if (!cblk->numnewpasses)
continue; continue;
if (!cblk->numsegs) { if (!cblk->numsegs) {
seg = &cblk->segs[cblk->numsegs++]; seg = &cblk->segs[0];
cblk->numsegs++;
cblk->len = 0; cblk->len = 0;
} else { } else {
seg = &cblk->segs[cblk->numsegs - 1]; seg = &cblk->segs[cblk->numsegs - 1];