remove deprecated v1 style function dwt_encode; rename dwt_encode_v2 to opj_dwt_encode
remove deprecated v1 style function dwt_decode; rename dwt_decode_v2 to opj_dwt_decode remove deprecated v1 style function dwt_getgain; rename dwt_getgain_v2 to opj_dwt_getgain add opj_dwt_getnorm, opj_dwt_getnorm_real functions remove deprecated v1 style function dwt_encode_real; rename dwt_encode_real_v2 to opj_dwt_encode_real remove deprecated v1 style function dwt_getgain_real; rename dwt_getgain_real_v2 to opj_dwt_getgain_real rename dwt_calc_explicit_stepsizes to opj_dwt_calc_explicit_stepsizes
This commit is contained in:
parent
062ed99894
commit
3dab3be859
|
@ -360,60 +360,6 @@ static void dwt_encode_stepsize(OPJ_INT32 stepsize, OPJ_INT32 numbps, opj_stepsi
|
|||
==========================================================
|
||||
*/
|
||||
|
||||
/* <summary> */
|
||||
/* Forward 5-3 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
void dwt_encode(opj_tcd_tilecomp_t * tilec) {
|
||||
int i, j, k;
|
||||
int *a = NULL;
|
||||
int *aj = NULL;
|
||||
int *bj = NULL;
|
||||
int w, l;
|
||||
|
||||
w = tilec->x1-tilec->x0;
|
||||
l = tilec->numresolutions-1;
|
||||
a = tilec->data;
|
||||
|
||||
for (i = 0; i < l; i++) {
|
||||
int rw; /* width of the resolution level computed */
|
||||
int rh; /* height of the resolution level computed */
|
||||
int rw1; /* width of the resolution level once lower than computed one */
|
||||
int rh1; /* height of the resolution level once lower than computed one */
|
||||
int cas_col; /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
|
||||
int cas_row; /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering */
|
||||
int dn, sn;
|
||||
|
||||
rw = tilec->resolutions[l - i].x1 - tilec->resolutions[l - i].x0;
|
||||
rh = tilec->resolutions[l - i].y1 - tilec->resolutions[l - i].y0;
|
||||
rw1= tilec->resolutions[l - i - 1].x1 - tilec->resolutions[l - i - 1].x0;
|
||||
rh1= tilec->resolutions[l - i - 1].y1 - tilec->resolutions[l - i - 1].y0;
|
||||
|
||||
cas_row = tilec->resolutions[l - i].x0 % 2;
|
||||
cas_col = tilec->resolutions[l - i].y0 % 2;
|
||||
|
||||
sn = rh1;
|
||||
dn = rh - rh1;
|
||||
bj = (int*)opj_malloc(rh * sizeof(int));
|
||||
for (j = 0; j < rw; j++) {
|
||||
aj = a + j;
|
||||
for (k = 0; k < rh; k++) bj[k] = aj[k*w];
|
||||
dwt_encode_1(bj, dn, sn, cas_col);
|
||||
dwt_deinterleave_v(bj, aj, dn, sn, w, cas_col);
|
||||
}
|
||||
opj_free(bj);
|
||||
|
||||
sn = rw1;
|
||||
dn = rw - rw1;
|
||||
bj = (int*)opj_malloc(rw * sizeof(int));
|
||||
for (j = 0; j < rh; j++) {
|
||||
aj = a + j * w;
|
||||
for (k = 0; k < rw; k++) bj[k] = aj[k];
|
||||
dwt_encode_1(bj, dn, sn, cas_row);
|
||||
opj_dwt_deinterleave_h(bj, aj, dn, sn, cas_row);
|
||||
}
|
||||
opj_free(bj);
|
||||
}
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Forward 5-3 wavelet transform in 2-D. */
|
||||
|
@ -499,31 +445,15 @@ INLINE opj_bool dwt_encode_procedure(opj_tcd_tilecomp_v2_t * tilec,void (*p_func
|
|||
|
||||
/* Forward 5-3 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
opj_bool dwt_encode_v2(opj_tcd_tilecomp_v2_t * tilec)
|
||||
opj_bool opj_dwt_encode(opj_tcd_tilecomp_v2_t * tilec)
|
||||
{
|
||||
return dwt_encode_procedure(tilec,dwt_encode_1);
|
||||
}
|
||||
|
||||
#ifdef OPJ_V1
|
||||
/* <summary> */
|
||||
/* Inverse 5-3 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
void dwt_decode(opj_tcd_tilecomp_t* tilec, int numres) {
|
||||
dwt_decode_tile(tilec, numres, &dwt_decode_1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse 5-3 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
opj_bool dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres) {
|
||||
return dwt_decode_tile(tilec, numres, &dwt_decode_1);
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Inverse 5-3 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
opj_bool dwt_decode_v2(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres) {
|
||||
opj_bool opj_dwt_decode(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres) {
|
||||
return dwt_decode_tile_v2(tilec, numres, &dwt_decode_1);
|
||||
}
|
||||
|
||||
|
@ -531,18 +461,7 @@ opj_bool dwt_decode_v2(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres) {
|
|||
/* <summary> */
|
||||
/* Get gain of 5-3 wavelet transform. */
|
||||
/* </summary> */
|
||||
int dwt_getgain(int orient) {
|
||||
if (orient == 0)
|
||||
return 0;
|
||||
if (orient == 1 || orient == 2)
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get gain of 5-3 wavelet transform. */
|
||||
/* </summary> */
|
||||
OPJ_UINT32 dwt_getgain_v2(OPJ_UINT32 orient) {
|
||||
OPJ_UINT32 opj_dwt_getgain(OPJ_UINT32 orient) {
|
||||
if (orient == 0)
|
||||
return 0;
|
||||
if (orient == 1 || orient == 2)
|
||||
|
@ -557,66 +476,17 @@ double dwt_getnorm(int level, int orient) {
|
|||
return dwt_norms[orient][level];
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Forward 9-7 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
|
||||
void dwt_encode_real(opj_tcd_tilecomp_t * tilec) {
|
||||
int i, j, k;
|
||||
int *a = NULL;
|
||||
int *aj = NULL;
|
||||
int *bj = NULL;
|
||||
int w, l;
|
||||
|
||||
w = tilec->x1-tilec->x0;
|
||||
l = tilec->numresolutions-1;
|
||||
a = tilec->data;
|
||||
|
||||
for (i = 0; i < l; i++) {
|
||||
int rw; /* width of the resolution level computed */
|
||||
int rh; /* height of the resolution level computed */
|
||||
int rw1; /* width of the resolution level once lower than computed one */
|
||||
int rh1; /* height of the resolution level once lower than computed one */
|
||||
int cas_col; /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
|
||||
int cas_row; /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering */
|
||||
int dn, sn;
|
||||
|
||||
rw = tilec->resolutions[l - i].x1 - tilec->resolutions[l - i].x0;
|
||||
rh = tilec->resolutions[l - i].y1 - tilec->resolutions[l - i].y0;
|
||||
rw1= tilec->resolutions[l - i - 1].x1 - tilec->resolutions[l - i - 1].x0;
|
||||
rh1= tilec->resolutions[l - i - 1].y1 - tilec->resolutions[l - i - 1].y0;
|
||||
|
||||
cas_row = tilec->resolutions[l - i].x0 % 2;
|
||||
cas_col = tilec->resolutions[l - i].y0 % 2;
|
||||
|
||||
sn = rh1;
|
||||
dn = rh - rh1;
|
||||
bj = (int*)opj_malloc(rh * sizeof(int));
|
||||
for (j = 0; j < rw; j++) {
|
||||
aj = a + j;
|
||||
for (k = 0; k < rh; k++) bj[k] = aj[k*w];
|
||||
dwt_encode_1_real(bj, dn, sn, cas_col);
|
||||
dwt_deinterleave_v(bj, aj, dn, sn, w, cas_col);
|
||||
}
|
||||
opj_free(bj);
|
||||
|
||||
sn = rw1;
|
||||
dn = rw - rw1;
|
||||
bj = (int*)opj_malloc(rw * sizeof(int));
|
||||
for (j = 0; j < rh; j++) {
|
||||
aj = a + j * w;
|
||||
for (k = 0; k < rw; k++) bj[k] = aj[k];
|
||||
dwt_encode_1_real(bj, dn, sn, cas_row);
|
||||
opj_dwt_deinterleave_h(bj, aj, dn, sn, cas_row);
|
||||
}
|
||||
opj_free(bj);
|
||||
}
|
||||
/* <summary> */
|
||||
/* Get norm of 5-3 wavelet. */
|
||||
/* </summary> */
|
||||
OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient) {
|
||||
return dwt_norms[orient][level];
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Forward 9-7 wavelet transform in 2-D. */
|
||||
/* </summary> */
|
||||
opj_bool dwt_encode_real_v2(opj_tcd_tilecomp_v2_t * tilec)
|
||||
opj_bool opj_dwt_encode_real(opj_tcd_tilecomp_v2_t * tilec)
|
||||
{
|
||||
return dwt_encode_procedure(tilec,dwt_encode_1_real);
|
||||
}
|
||||
|
@ -624,15 +494,7 @@ opj_bool dwt_encode_real_v2(opj_tcd_tilecomp_v2_t * tilec)
|
|||
/* <summary> */
|
||||
/* Get gain of 9-7 wavelet transform. */
|
||||
/* </summary> */
|
||||
int dwt_getgain_real(int orient) {
|
||||
(void)orient;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* <summary> */
|
||||
/* Get gain of 9-7 wavelet transform. */
|
||||
/* </summary> */
|
||||
OPJ_UINT32 dwt_getgain_real_v2(OPJ_UINT32 orient) {
|
||||
OPJ_UINT32 opj_dwt_getgain_real(OPJ_UINT32 orient) {
|
||||
(void)orient;
|
||||
return 0;
|
||||
}
|
||||
|
@ -644,12 +506,19 @@ double dwt_getnorm_real(int level, int orient) {
|
|||
return dwt_norms_real[orient][level];
|
||||
}
|
||||
|
||||
void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec) {
|
||||
int numbands, bandno;
|
||||
/* <summary> */
|
||||
/* Get norm of 9-7 wavelet. */
|
||||
/* </summary> */
|
||||
OPJ_FLOAT64 opj_dwt_getnorm_real(OPJ_UINT32 level, OPJ_UINT32 orient) {
|
||||
return dwt_norms_real[orient][level];
|
||||
}
|
||||
|
||||
void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec) {
|
||||
OPJ_UINT32 numbands, bandno;
|
||||
numbands = 3 * tccp->numresolutions - 2;
|
||||
for (bandno = 0; bandno < numbands; bandno++) {
|
||||
double stepsize;
|
||||
int resno, level, orient, gain;
|
||||
OPJ_FLOAT64 stepsize;
|
||||
OPJ_UINT32 resno, level, orient, gain;
|
||||
|
||||
resno = (bandno == 0) ? 0 : ((bandno - 1) / 3 + 1);
|
||||
orient = (bandno == 0) ? 0 : ((bandno - 1) % 3 + 1);
|
||||
|
@ -658,10 +527,10 @@ void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec) {
|
|||
if (tccp->qntsty == J2K_CCP_QNTSTY_NOQNT) {
|
||||
stepsize = 1.0;
|
||||
} else {
|
||||
double norm = dwt_norms_real[orient][level];
|
||||
OPJ_FLOAT64 norm = dwt_norms_real[orient][level];
|
||||
stepsize = (1 << (gain)) / norm;
|
||||
}
|
||||
dwt_encode_stepsize((int) floor(stepsize * 8192.0), prec + gain, &tccp->stepsizes[bandno]);
|
||||
dwt_encode_stepsize((OPJ_INT32) floor(stepsize * 8192.0), prec + gain, &tccp->stepsizes[bandno]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,49 +52,36 @@ Forward 5-3 wavelet tranform in 2-D.
|
|||
Apply a reversible DWT transform to a component of an image.
|
||||
@param tilec Tile component information (current tile)
|
||||
*/
|
||||
opj_bool dwt_encode_v2(struct opj_tcd_tilecomp_v2 * tilec);
|
||||
opj_bool opj_dwt_encode(opj_tcd_tilecomp_v2_t * tilec);
|
||||
|
||||
/**
|
||||
Forward 5-3 wavelet tranform in 2-D.
|
||||
Apply a reversible DWT transform to a component of an image.
|
||||
@param tilec Tile component information (current tile)
|
||||
*/
|
||||
void dwt_encode(opj_tcd_tilecomp_t * tilec);
|
||||
/**
|
||||
Inverse 5-3 wavelet tranform in 2-D.
|
||||
Apply a reversible inverse DWT transform to a component of an image.
|
||||
@param tilec Tile component information (current tile)
|
||||
@param numres Number of resolution levels to decode
|
||||
*/
|
||||
#ifdef OPJ_V1
|
||||
void dwt_decode(opj_tcd_tilecomp_t* tilec, int numres);
|
||||
#endif
|
||||
opj_bool dwt_decode(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres);
|
||||
|
||||
opj_bool dwt_decode_v2(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres);
|
||||
opj_bool opj_dwt_decode(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 numres);
|
||||
|
||||
/**
|
||||
Get the gain of a subband for the reversible 5-3 DWT.
|
||||
@param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
|
||||
@return Returns 0 if orient = 0, returns 1 if orient = 1 or 2, returns 2 otherwise
|
||||
*/
|
||||
int dwt_getgain(int orient);
|
||||
|
||||
OPJ_UINT32 dwt_getgain_v2(OPJ_UINT32 orient) ;
|
||||
OPJ_UINT32 opj_dwt_getgain(OPJ_UINT32 orient) ;
|
||||
/**
|
||||
Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT.
|
||||
@param level Level of the wavelet function
|
||||
@param orient Band of the wavelet function
|
||||
@return Returns the norm of the wavelet function
|
||||
*/
|
||||
double dwt_getnorm(int level, int orient);
|
||||
double dwt_getnorm(int level, int orient); /* TODO REMOVE IT*/
|
||||
OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient);
|
||||
/**
|
||||
Forward 9-7 wavelet transform in 2-D.
|
||||
Apply an irreversible DWT transform to a component of an image.
|
||||
@param tilec Tile component information (current tile)
|
||||
*/
|
||||
void dwt_encode_real(opj_tcd_tilecomp_t * tilec);
|
||||
opj_bool dwt_encode_real_v2(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.
|
||||
|
@ -112,8 +99,7 @@ Get the gain of a subband for the irreversible 9-7 DWT.
|
|||
@param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
|
||||
@return Returns the gain of the 9-7 wavelet transform
|
||||
*/
|
||||
int dwt_getgain_real(int orient);
|
||||
OPJ_UINT32 dwt_getgain_real_v2(OPJ_UINT32 orient);
|
||||
OPJ_UINT32 opj_dwt_getgain_real(OPJ_UINT32 orient);
|
||||
/**
|
||||
Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT
|
||||
@param level Level of the wavelet function
|
||||
|
@ -121,12 +107,13 @@ Get the norm of a wavelet function of a subband at a specified level for the irr
|
|||
@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);
|
||||
/**
|
||||
Explicit calculation of the Quantization Stepsizes
|
||||
@param tccp Tile-component coding parameters
|
||||
@param prec Precint analyzed
|
||||
*/
|
||||
void dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, int prec);
|
||||
void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
|
|
|
@ -37,11 +37,9 @@
|
|||
/** @defgroup validation validation procedure*/
|
||||
/*@{*/
|
||||
|
||||
/*#include "openjpeg.h" */
|
||||
/**************************************************************************************************
|
||||
***************************************** FORWARD DECLARATION ************************************
|
||||
**************************************************************************************************/
|
||||
struct opj_jp2;
|
||||
|
||||
/**
|
||||
* declare a function pointer
|
||||
|
|
|
@ -6261,7 +6261,7 @@ void opj_j2k_setup_encoder( opj_j2k_v2_t *p_j2k,
|
|||
}
|
||||
}
|
||||
|
||||
dwt_calc_explicit_stepsizes(tccp, image->comps[i].prec);
|
||||
opj_dwt_calc_explicit_stepsizes(tccp, image->comps[i].prec);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1209,9 +1209,9 @@ static OPJ_FLOAT64 t1_getwmsedec_v2(
|
|||
}
|
||||
|
||||
if (qmfbid == 1) {
|
||||
w2 = dwt_getnorm(level, orient);
|
||||
w2 = opj_dwt_getnorm(level, orient);
|
||||
} else { /* if (qmfbid == 0) */
|
||||
w2 = dwt_getnorm_real(level, orient);
|
||||
w2 = opj_dwt_getnorm_real(level, orient);
|
||||
}
|
||||
|
||||
wmsedec = w1 * w2 * stepsize * (1 << bpno);
|
||||
|
|
|
@ -735,10 +735,10 @@ opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \
|
|||
l_res = l_tilec->resolutions; \
|
||||
l_step_size = l_tccp->stepsizes; \
|
||||
if (l_tccp->qmfbid == 0) { \
|
||||
l_gain_ptr = &dwt_getgain_real_v2; \
|
||||
l_gain_ptr = &opj_dwt_getgain_real; \
|
||||
} \
|
||||
else { \
|
||||
l_gain_ptr = &dwt_getgain_v2; \
|
||||
l_gain_ptr = &opj_dwt_getgain; \
|
||||
} \
|
||||
/*fprintf(stderr, "\tlevel_no=%d\n",l_level_no);*/ \
|
||||
\
|
||||
|
@ -1521,7 +1521,7 @@ opj_bool opj_tcd_dwt_decode ( opj_tcd_v2_t *p_tcd )
|
|||
*/
|
||||
|
||||
if (l_tccp->qmfbid == 1) {
|
||||
if (! dwt_decode_v2(l_tile_comp, l_img_comp->resno_decoded+1)) {
|
||||
if (! opj_dwt_decode(l_tile_comp, l_img_comp->resno_decoded+1)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -1884,12 +1884,12 @@ opj_bool opj_tcd_dwt_encode ( opj_tcd_v2_t *p_tcd )
|
|||
|
||||
for (compno = 0; compno < l_tile->numcomps; ++compno) {
|
||||
if (l_tccp->qmfbid == 1) {
|
||||
if (! dwt_encode_v2(l_tile_comp)) {
|
||||
if (! opj_dwt_encode(l_tile_comp)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
else if (l_tccp->qmfbid == 0) {
|
||||
if (! dwt_encode_real_v2(l_tile_comp)) {
|
||||
if (! opj_dwt_encode_real(l_tile_comp)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue