int cas ;
} v4dwt_t ;
-static const float dwt_alpha = 1.586134342f; // 12994
-static const float dwt_beta = 0.052980118f; // 434
-static const float dwt_gamma = -0.882911075f; // -7233
-static const float dwt_delta = -0.443506852f; // -3633
+static const float dwt_alpha = 1.586134342f; /* 12994 */
+static const float dwt_beta = 0.052980118f; /* 434 */
+static const float dwt_gamma = -0.882911075f; /* -7233 */
+static const float dwt_delta = -0.443506852f; /* -3633 */
-static const float K = 1.230174105f; // 10078
+static const float K = 1.230174105f; /* 10078 */
/* FIXME: What is this constant? */
static const float c13318 = 1.625732422f;
*/
static opj_bool dwt_decode_tile_v2(opj_tcd_tilecomp_v2_t* tilec, OPJ_UINT32 i, DWT1DFN fn);
+static opj_bool dwt_encode_procedure( opj_tcd_tilecomp_v2_t * tilec,
+ void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) );
+
+static OPJ_UINT32 dwt_max_resolution_v2(opj_tcd_resolution_v2_t* restrict r, OPJ_UINT32 i);
+
+
/*@}*/
/*@}*/
}
}
+/* <summary> */
+/* Forward 5-3 wavelet transform in 2-D. */
+/* </summary> */
+INLINE opj_bool dwt_encode_procedure(opj_tcd_tilecomp_v2_t * tilec,void (*p_function)(OPJ_INT32 *, OPJ_INT32,OPJ_INT32,OPJ_INT32) )
+{
+ OPJ_INT32 i, j, k;
+ OPJ_INT32 *a = 00;
+ OPJ_INT32 *aj = 00;
+ OPJ_INT32 *bj = 00;
+ OPJ_INT32 w, l;
+
+ OPJ_INT32 rw; /* width of the resolution level computed */
+ OPJ_INT32 rh; /* height of the resolution level computed */
+ OPJ_INT32 l_data_size;
+
+ opj_tcd_resolution_v2_t * l_cur_res = 0;
+ opj_tcd_resolution_v2_t * l_last_res = 0;
+
+ w = tilec->x1-tilec->x0;
+ l = tilec->numresolutions-1;
+ a = tilec->data;
+
+ l_cur_res = tilec->resolutions + l;
+ l_last_res = l_cur_res - 1;
+
+ rw = l_cur_res->x1 - l_cur_res->x0;
+ rh = l_cur_res->y1 - l_cur_res->y0;
+
+ l_data_size = dwt_max_resolution_v2( tilec->resolutions,tilec->numresolutions) * sizeof(OPJ_INT32);
+ bj = (OPJ_INT32*)opj_malloc(l_data_size);
+ if (! bj) {
+ return OPJ_FALSE;
+ }
+ i = l;
+
+ while (i--) {
+ OPJ_INT32 rw1; /* width of the resolution level once lower than computed one */
+ OPJ_INT32 rh1; /* height of the resolution level once lower than computed one */
+ OPJ_INT32 cas_col; /* 0 = non inversion on horizontal filtering 1 = inversion between low-pass and high-pass filtering */
+ OPJ_INT32 cas_row; /* 0 = non inversion on vertical filtering 1 = inversion between low-pass and high-pass filtering */
+ OPJ_INT32 dn, sn;
+
+ rw = l_cur_res->x1 - l_cur_res->x0;
+ rh = l_cur_res->y1 - l_cur_res->y0;
+ rw1 = l_last_res->x1 - l_last_res->x0;
+ rh1 = l_last_res->y1 - l_last_res->y0;
+
+ cas_row = l_cur_res->x0 & 1;
+ cas_col = l_cur_res->y0 & 1;
+
+ sn = rh1;
+ dn = rh - rh1;
+ for (j = 0; j < rw; ++j) {
+ aj = a + j;
+ for (k = 0; k < rh; ++k) {
+ bj[k] = aj[k*w];
+ }
+
+ (*p_function) (bj, dn, sn, cas_col);
+
+ dwt_deinterleave_v(bj, aj, dn, sn, w, cas_col);
+ }
+
+ sn = rw1;
+ dn = rw - rw1;
+
+ for (j = 0; j < rh; j++) {
+ aj = a + j * w;
+ for (k = 0; k < rw; k++) bj[k] = aj[k];
+ (*p_function) (bj, dn, sn, cas_row);
+ dwt_deinterleave_h(bj, aj, dn, sn, cas_row);
+ }
+
+ l_cur_res = l_last_res;
+
+ --l_last_res;
+ }
+
+ opj_free(bj);
+ return OPJ_TRUE;
+}
+
+/* Forward 5-3 wavelet transform in 2-D. */
+/* </summary> */
+opj_bool dwt_encode_v2(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> */
+/* Forward 9-7 wavelet transform in 2-D. */
+/* </summary> */
+opj_bool dwt_encode_real_v2(opj_tcd_tilecomp_v2_t * tilec)
+{
+ return dwt_encode_procedure(tilec,dwt_encode_1_real);
+}
/* <summary> */
/* Get gain of 9-7 wavelet transform. */
}
-// KEEP TRUNK VERSION + return type of v2 because rev557
+/* KEEP TRUNK VERSION + return type of v2 because rev557 */
/* <summary> */
/* Inverse 9-7 wavelet transform in 2-D. */
/* </summary> */
-// V1 void dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, int numres){
+/* V1 void dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, int numres){ */
opj_bool dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, int numres){
v4dwt_t h;
v4dwt_t v;