diff options
| author | Antonin Descampe <antonin@gmail.com> | 2004-07-13 09:17:17 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2004-07-13 09:17:17 +0000 |
| commit | bc563fc5ba6e0369dc7da995e971b7077f4788a5 (patch) | |
| tree | be25510575befe169b98430087b80840d4a90cd8 /libopenjpeg/t1.c | |
| parent | f50f66c0c9b00426ad85cbdb444b47b31f89171d (diff) | |
* Quantization bug fixed when using 9x7 DWT (comment keyword : quantizbug1)
* Multiplication bug fixed when dividing by 8192 (comment keyword : multbug1)
Diffstat (limited to 'libopenjpeg/t1.c')
| -rw-r--r-- | libopenjpeg/t1.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/libopenjpeg/t1.c b/libopenjpeg/t1.c index deb6b98a..b1b22469 100644 --- a/libopenjpeg/t1.c +++ b/libopenjpeg/t1.c @@ -92,7 +92,7 @@ static int t1_lut_nmsedec_sig0[1 << T1_NMSEDEC_BITS]; static int t1_lut_nmsedec_ref[1 << T1_NMSEDEC_BITS]; static int t1_lut_nmsedec_ref0[1 << T1_NMSEDEC_BITS]; -static int t1_data[T1_MAXCBLKH][T1_MAXCBLKH]; +static int t1_data[T1_MAXCBLKH][T1_MAXCBLKW]; static int t1_flags[T1_MAXCBLKH + 2][T1_MAXCBLKH + 2]; int t1_getctxno_zc(int f, int orient) @@ -187,6 +187,7 @@ void t1_enc_sigpass_step(int *fp, int *dp, int orient, int bpno, int one, } } + void t1_dec_sigpass_step(int *fp, int *dp, int orient, int oneplushalf, char type, int vsc) { @@ -247,7 +248,9 @@ void t1_dec_sigpass(int w, int h, int bpno, int orient, char type, vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0; t1_dec_sigpass_step(&t1_flags[1 + j][1 + i], - &t1_data[j][i], orient, oneplushalf, + &t1_data[j][i], + orient, + oneplushalf, type, vsc); } } @@ -275,6 +278,7 @@ void t1_enc_refpass_step(int *fp, int *dp, int bpno, int one, int *nmsedec, } } + void t1_dec_refpass_step(int *fp, int *dp, int poshalf, int neghalf, char type, int vsc) { @@ -326,7 +330,10 @@ void t1_dec_refpass(int w, int h, int bpno, char type, int cblksty) vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0; t1_dec_refpass_step(&t1_flags[1 + j][1 + i], - &t1_data[j][i], poshalf, neghalf, type, vsc); + &t1_data[j][i], + poshalf, + neghalf, + type, vsc); } } } @@ -358,6 +365,7 @@ void t1_enc_clnpass_step(int *fp, int *dp, int orient, int bpno, int one, *fp &= ~T1_VISIT; } + void t1_dec_clnpass_step(int *fp, int *dp, int orient, int oneplushalf, int partial, int vsc) { @@ -495,7 +503,9 @@ void t1_dec_clnpass(int w, int h, int bpno, int orient, int cblksty) vsc = ((cblksty & J2K_CCP_CBLKSTY_VSC) && (j == k + 3 || j == h - 1)) ? 1 : 0; t1_dec_clnpass_step(&t1_flags[1 + j][1 + i], - &t1_data[j][i], orient, oneplushalf, + &t1_data[j][i], + orient, + oneplushalf, agg && (j == k + runlen), vsc); } } @@ -692,6 +702,8 @@ void t1_decode_cblk(tcd_cblk_t * cblk, int orient, int roishift, mqc_init_dec(seg->data, seg->len); /* dda */ + if (bpno==0) cblk->lastbp=1; // Add Antonin : quantizbug1 + for (passno = 0; passno < seg->numpasses; passno++) { switch (passtype) { case 0: @@ -865,13 +877,18 @@ void t1_decode_cblks(tcd_tile_t * tile, j2k_tcp_t * tcp) for (i = 0; i < cblk->x1 - cblk->x0; i++) { if (t1_data[j][i] == 0) { tilec->data[x + i + - (y + j) * (tilec->x1 - tilec->x0)] = 0; + (y + j) * (tilec->x1 - tilec->x0)] = 0; } else { + // Add antonin : quantizbug1 + t1_data[j][i]<<=1; + //if (cblk->lastbp) + t1_data[j][i]+=t1_data[j][i]>0?1:-1; + // ddA tilec->data[x + i + (y + j) * (tilec->x1 - tilec-> x0)] = - fix_mul(t1_data[j][i] << 13, band->stepsize); + fix_mul(t1_data[j][i] << 12, band->stepsize); //Mod Antonin : quantizbug1 (before : << 13) } } } |
