[trunk] Finalize dwt.v/.h with the v2 style : remove last functions already optimized, add opj_ prefix, use new name of the functions
This commit is contained in:
parent
12c4e68058
commit
216791c3fb
|
@ -484,13 +484,6 @@ OPJ_UINT32 opj_dwt_getgain(OPJ_UINT32 orient) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <summary> */
|
|
||||||
/* Get norm of 5-3 wavelet. */
|
|
||||||
/* </summary> */
|
|
||||||
double dwt_getnorm(int level, int orient) {
|
|
||||||
return opj_dwt_norms[orient][level];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* <summary> */
|
/* <summary> */
|
||||||
/* Get norm of 5-3 wavelet. */
|
/* Get norm of 5-3 wavelet. */
|
||||||
/* </summary> */
|
/* </summary> */
|
||||||
|
@ -514,13 +507,6 @@ OPJ_UINT32 opj_dwt_getgain_real(OPJ_UINT32 orient) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <summary> */
|
|
||||||
/* Get norm of 9-7 wavelet. */
|
|
||||||
/* </summary> */
|
|
||||||
double dwt_getnorm_real(int level, int orient) {
|
|
||||||
return opj_dwt_norms_real[orient][level];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* <summary> */
|
/* <summary> */
|
||||||
/* Get norm of 9-7 wavelet. */
|
/* Get norm of 9-7 wavelet. */
|
||||||
/* </summary> */
|
/* </summary> */
|
||||||
|
@ -549,39 +535,6 @@ void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OPJ_V1
|
|
||||||
/* <summary> */
|
|
||||||
/* Determine maximum computed resolution level for inverse wavelet transform */
|
|
||||||
/* </summary> */
|
|
||||||
static int dwt_decode_max_resolution(opj_tcd_resolution_t* restrict r, int i) {
|
|
||||||
int mr = 1;
|
|
||||||
int w;
|
|
||||||
while( --i ) {
|
|
||||||
r++;
|
|
||||||
if( mr < ( w = r->x1 - r->x0 ) )
|
|
||||||
mr = w ;
|
|
||||||
if( mr < ( w = r->y1 - r->y0 ) )
|
|
||||||
mr = w ;
|
|
||||||
}
|
|
||||||
return mr ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* <summary> */
|
|
||||||
/* Determine maximum computed resolution level for inverse wavelet transform */
|
|
||||||
/* </summary> */
|
|
||||||
static OPJ_UINT32 dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i) {
|
|
||||||
OPJ_UINT32 mr = 0;
|
|
||||||
OPJ_UINT32 w;
|
|
||||||
while( --i ) {
|
|
||||||
++r;
|
|
||||||
if( mr < ( w = r->x1 - r->x0 ) )
|
|
||||||
mr = w ;
|
|
||||||
if( mr < ( w = r->y1 - r->y0 ) )
|
|
||||||
mr = w ;
|
|
||||||
}
|
|
||||||
return mr ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* <summary> */
|
/* <summary> */
|
||||||
/* Determine maximum computed resolution level for inverse wavelet transform */
|
/* Determine maximum computed resolution level for inverse wavelet transform */
|
||||||
/* </summary> */
|
/* </summary> */
|
||||||
|
@ -614,9 +567,7 @@ opj_bool opj_dwt_decode_tile(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres, DW
|
||||||
|
|
||||||
h.mem = (OPJ_INT32*)
|
h.mem = (OPJ_INT32*)
|
||||||
opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
|
opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
|
||||||
if
|
if (! h.mem){
|
||||||
(! h.mem)
|
|
||||||
{
|
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -872,102 +823,10 @@ void opj_v4dwt_decode(v4dwt_t* restrict dwt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* KEEP TRUNK VERSION + return type of v2 because rev557 */
|
|
||||||
/* <summary> */
|
/* <summary> */
|
||||||
/* Inverse 9-7 wavelet transform in 2-D. */
|
/* Inverse 9-7 wavelet transform in 2-D. */
|
||||||
/* </summary> */
|
/* </summary> */
|
||||||
/* V1 void dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, int numres){ */
|
opj_bool opj_dwt_decode_real(opj_tcd_tilecomp_v2_t* restrict tilec, OPJ_UINT32 numres)
|
||||||
opj_bool dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, int numres)
|
|
||||||
{
|
|
||||||
v4dwt_t h;
|
|
||||||
v4dwt_t v;
|
|
||||||
|
|
||||||
opj_tcd_resolution_t* res = tilec->resolutions;
|
|
||||||
|
|
||||||
int rw = res->x1 - res->x0; /* width of the resolution level computed */
|
|
||||||
int rh = res->y1 - res->y0; /* height of the resolution level computed */
|
|
||||||
|
|
||||||
int w = tilec->x1 - tilec->x0;
|
|
||||||
|
|
||||||
h.wavelet = (v4*) opj_aligned_malloc((dwt_max_resolution(res, numres)+5) * sizeof(v4));
|
|
||||||
v.wavelet = h.wavelet;
|
|
||||||
|
|
||||||
while( --numres) {
|
|
||||||
float * restrict aj = (float*) tilec->data;
|
|
||||||
int bufsize = (tilec->x1 - tilec->x0) * (tilec->y1 - tilec->y0);
|
|
||||||
int j;
|
|
||||||
|
|
||||||
h.sn = rw;
|
|
||||||
v.sn = rh;
|
|
||||||
|
|
||||||
++res;
|
|
||||||
|
|
||||||
rw = res->x1 - res->x0; /* width of the resolution level computed */
|
|
||||||
rh = res->y1 - res->y0; /* height of the resolution level computed */
|
|
||||||
|
|
||||||
h.dn = rw - h.sn;
|
|
||||||
h.cas = res->x0 % 2;
|
|
||||||
|
|
||||||
for(j = rh; j > 3; j -= 4){
|
|
||||||
int k;
|
|
||||||
opj_v4dwt_interleave_h(&h, aj, w, bufsize);
|
|
||||||
opj_v4dwt_decode(&h);
|
|
||||||
for(k = rw; --k >= 0;){
|
|
||||||
aj[k ] = h.wavelet[k].f[0];
|
|
||||||
aj[k+w ] = h.wavelet[k].f[1];
|
|
||||||
aj[k+w*2] = h.wavelet[k].f[2];
|
|
||||||
aj[k+w*3] = h.wavelet[k].f[3];
|
|
||||||
}
|
|
||||||
aj += w*4;
|
|
||||||
bufsize -= w*4;
|
|
||||||
}
|
|
||||||
if (rh & 0x03) {
|
|
||||||
int k;
|
|
||||||
j = rh & 0x03;
|
|
||||||
opj_v4dwt_interleave_h(&h, aj, w, bufsize);
|
|
||||||
opj_v4dwt_decode(&h);
|
|
||||||
for(k = rw; --k >= 0;){
|
|
||||||
switch(j) {
|
|
||||||
case 3: aj[k+w*2] = h.wavelet[k].f[2];
|
|
||||||
case 2: aj[k+w ] = h.wavelet[k].f[1];
|
|
||||||
case 1: aj[k ] = h.wavelet[k].f[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
v.dn = rh - v.sn;
|
|
||||||
v.cas = res->y0 % 2;
|
|
||||||
|
|
||||||
aj = (float*) tilec->data;
|
|
||||||
for(j = rw; j > 3; j -= 4){
|
|
||||||
int k;
|
|
||||||
opj_v4dwt_interleave_v(&v, aj, w, 4);
|
|
||||||
opj_v4dwt_decode(&v);
|
|
||||||
for(k = 0; k < rh; ++k){
|
|
||||||
memcpy(&aj[k*w], &v.wavelet[k], 4 * sizeof(float));
|
|
||||||
}
|
|
||||||
aj += 4;
|
|
||||||
}
|
|
||||||
if (rw & 0x03){
|
|
||||||
int k;
|
|
||||||
j = rw & 0x03;
|
|
||||||
opj_v4dwt_interleave_v(&v, aj, w, j);
|
|
||||||
opj_v4dwt_decode(&v);
|
|
||||||
for(k = 0; k < rh; ++k){
|
|
||||||
memcpy(&aj[k*w], &v.wavelet[k], j * sizeof(float));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
opj_aligned_free(h.wavelet);
|
|
||||||
return OPJ_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* <summary> */
|
|
||||||
/* Inverse 9-7 wavelet transform in 2-D. */
|
|
||||||
/* </summary> */
|
|
||||||
opj_bool dwt_decode_real_v2(opj_tcd_tilecomp_v2_t* restrict tilec, OPJ_UINT32 numres)
|
|
||||||
{
|
{
|
||||||
v4dwt_t h;
|
v4dwt_t h;
|
||||||
v4dwt_t v;
|
v4dwt_t v;
|
||||||
|
|
|
@ -74,7 +74,6 @@ Get the norm of a wavelet function of a subband at a specified level for the rev
|
||||||
@param orient Band of the wavelet function
|
@param orient Band of the wavelet function
|
||||||
@return Returns the norm of the wavelet function
|
@return Returns the norm of the wavelet function
|
||||||
*/
|
*/
|
||||||
double dwt_getnorm(int level, int orient); /* TODO REMOVE IT*/
|
|
||||||
OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient);
|
OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient);
|
||||||
/**
|
/**
|
||||||
Forward 9-7 wavelet transform in 2-D.
|
Forward 9-7 wavelet transform in 2-D.
|
||||||
|
@ -83,16 +82,12 @@ Apply an irreversible DWT transform to a component of an image.
|
||||||
*/
|
*/
|
||||||
opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_v2_t * tilec);
|
opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_v2_t * tilec);
|
||||||
/**
|
/**
|
||||||
KEEP TRUNK VERSION + return type of v2 because rev557
|
|
||||||
Inverse 9-7 wavelet transform in 2-D.
|
Inverse 9-7 wavelet transform in 2-D.
|
||||||
Apply an irreversible inverse DWT transform to a component of an image.
|
Apply an irreversible inverse DWT transform to a component of an image.
|
||||||
@param tilec Tile component information (current tile)
|
@param tilec Tile component information (current tile)
|
||||||
@param numres Number of resolution levels to decode
|
@param numres Number of resolution levels to decode
|
||||||
*/
|
*/
|
||||||
/* V1 void dwt_decode_real(opj_tcd_tilecomp_t* tilec, int numres); */
|
opj_bool opj_dwt_decode_real(opj_tcd_tilecomp_v2_t* restrict tilec, OPJ_UINT32 numres);
|
||||||
opj_bool dwt_decode_real(opj_tcd_tilecomp_t* tilec, int numres);
|
|
||||||
|
|
||||||
opj_bool dwt_decode_real_v2(opj_tcd_tilecomp_v2_t* restrict tilec, OPJ_UINT32 numres);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the gain of a subband for the irreversible 9-7 DWT.
|
Get the gain of a subband for the irreversible 9-7 DWT.
|
||||||
|
@ -106,7 +101,6 @@ Get the norm of a wavelet function of a subband at a specified level for the irr
|
||||||
@param orient Band of the wavelet function
|
@param orient Band of the wavelet function
|
||||||
@return Returns the norm of the 9-7 wavelet
|
@return Returns the norm of the 9-7 wavelet
|
||||||
*/
|
*/
|
||||||
double dwt_getnorm_real(int level, int orient);
|
|
||||||
OPJ_FLOAT64 opj_dwt_getnorm_real(OPJ_UINT32 level, OPJ_UINT32 orient);
|
OPJ_FLOAT64 opj_dwt_getnorm_real(OPJ_UINT32 level, OPJ_UINT32 orient);
|
||||||
/**
|
/**
|
||||||
Explicit calculation of the Quantization Stepsizes
|
Explicit calculation of the Quantization Stepsizes
|
||||||
|
|
|
@ -748,10 +748,10 @@ static double t1_getwmsedec(
|
||||||
double w1, w2, wmsedec;
|
double w1, w2, wmsedec;
|
||||||
if (qmfbid == 1) {
|
if (qmfbid == 1) {
|
||||||
w1 = (mct && numcomps==3) ? opj_mct_getnorm(compno) : 1.0;
|
w1 = (mct && numcomps==3) ? opj_mct_getnorm(compno) : 1.0;
|
||||||
w2 = dwt_getnorm(level, orient);
|
w2 = opj_dwt_getnorm(level, orient);
|
||||||
} else { /* if (qmfbid == 0) */
|
} else { /* if (qmfbid == 0) */
|
||||||
w1 = (mct && numcomps==3) ? opj_mct_getnorm_real(compno) : 1.0;
|
w1 = (mct && numcomps==3) ? opj_mct_getnorm_real(compno) : 1.0;
|
||||||
w2 = dwt_getnorm_real(level, orient);
|
w2 = opj_dwt_getnorm_real(level, orient);
|
||||||
}
|
}
|
||||||
wmsedec = w1 * w2 * stepsize * (1 << bpno);
|
wmsedec = w1 * w2 * stepsize * (1 << bpno);
|
||||||
wmsedec *= wmsedec * nmsedec / 8192.0;
|
wmsedec *= wmsedec * nmsedec / 8192.0;
|
||||||
|
|
|
@ -1543,7 +1543,7 @@ opj_bool opj_tcd_dwt_decode ( opj_tcd_v2_t *p_tcd )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (! dwt_decode_real_v2(l_tile_comp, l_img_comp->resno_decoded+1)) {
|
if (! opj_dwt_decode_real(l_tile_comp, l_img_comp->resno_decoded+1)) {
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue