diff options
| author | Antonin Descampe <antonin@gmail.com> | 2004-07-09 14:04:06 +0000 |
|---|---|---|
| committer | Antonin Descampe <antonin@gmail.com> | 2004-07-09 14:04:06 +0000 |
| commit | 651f98ad066ebb978d60c960bdf0f390ea035a14 (patch) | |
| tree | 7ec13c8d03ece141bff7800cb8579e0dd517f8ef | |
| parent | 132d89472631b37503dbfc2f9fd8713ef1a2a87e (diff) | |
Bug fixed for scalar_derived quantization type
| -rw-r--r-- | libopenjpeg/j2k.c | 13 | ||||
| -rw-r--r-- | libopenjpeg/j2k.h | 4 |
2 files changed, 14 insertions, 3 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 3d0fd86e..a0ba1401 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -483,7 +483,7 @@ void j2k_read_qcx(int compno, int len) len - 1 : (len - 1) / 2); for (bandno = 0; bandno < numbands; bandno++) { int expn, mant; - if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) { /* WHY STEPSIZES WHEN NOQNT ? */ + if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) { expn = cio_read(1) >> 3; /* SPqcx_i */ mant = 0; } else { @@ -494,6 +494,17 @@ void j2k_read_qcx(int compno, int len) tccp->stepsizes[bandno].expn = expn; tccp->stepsizes[bandno].mant = mant; } + + /* Add Antonin : if scalar_derived -> compute other stepsizes */ + + if (tccp->qntsty==J2K_CCP_QNTSTY_SIQNT) { + for (bandno=1 ; bandno<J2K_MAXBANDS ; bandno++) { + tccp->stepsizes[bandno].expn = ((tccp->stepsizes[0].expn)-((bandno-1)/3+1)>0)?(tccp->stepsizes[0].expn)-((bandno-1)/3+1):0; + tccp->stepsizes[bandno].mant = tccp->stepsizes[0].mant; + } + } + + /* ddA */ } void j2k_write_qcd() diff --git a/libopenjpeg/j2k.h b/libopenjpeg/j2k.h index 637b12b0..a4c4a52f 100644 --- a/libopenjpeg/j2k.h +++ b/libopenjpeg/j2k.h @@ -42,7 +42,7 @@ #define __J2K_H #define J2K_MAXRLVLS 33 /* Number of maximum resolution level authorized */ -#define J2K_MAXBANDS (3*J2K_MAXRLVLS+1) /* Number of maximum sub-band linked to number of resolution level */ +#define J2K_MAXBANDS (3*J2K_MAXRLVLS-2) /* Number of maximum sub-band linked to number of resolution level */ #define J2K_CP_CSTY_PRT 0x01 #define J2K_CP_CSTY_SOP 0x02 @@ -97,7 +97,7 @@ typedef struct { int cblksty; /* code-block coding style */ int qmfbid; /* discrete wavelet transform identifier */ int qntsty; /* quantisation style */ - j2k_stepsize_t stepsizes[J2K_MAXBANDS]; /* stepsizes used for quantisation */ + j2k_stepsize_t stepsizes[J2K_MAXBANDS]; /* stepsizes used for quantization */ int numgbits; /* number of guard bits */ int roishift; /* Region Of Interest shift */ int prcw[J2K_MAXRLVLS]; /* Precinct width */ |
