diff --git a/auxiliary/waux.c b/auxiliary/waux.c index 285761e..b45454c 100644 --- a/auxiliary/waux.c +++ b/auxiliary/waux.c @@ -135,8 +135,10 @@ void getDWTRecCoeff(double *coeff,int *length,char *ctype,char *ext, int level, } //idwt_per(wt,out, det_len, wt->output + iter, det_len, X_lp); + m = -2; + n = -1; - for (i = 0; i < lf + l2 - 1; ++i) { + for (i = 0; i < det_len + l2 - 1; ++i) { m += 2; n += 2; X_lp[m] = 0.0; @@ -181,7 +183,6 @@ void getDWTRecCoeff(double *coeff,int *length,char *ctype,char *ext, int level, X_lp = (double*)malloc(sizeof(double)* (N + 2 * lf - 1)); - for (i = 0; i < det_len; ++i) { out[i] = coeff[i]; } @@ -195,6 +196,7 @@ void getDWTRecCoeff(double *coeff,int *length,char *ctype,char *ext, int level, } else { filt = lpr; } + //idwt_sym(wt, out, det_len, wt->output + iter, det_len, X_lp); m = -2; @@ -210,7 +212,7 @@ void getDWTRecCoeff(double *coeff,int *length,char *ctype,char *ext, int level, t = 2 * l; if ((i - l) >= 0 && (i - l) < det_len) { X_lp[m] += filt[t] * out[i - l]; - X_lp[n] += filt[t + 1] * out[i - l] + filt[t + 1] * out[i - l]; + X_lp[n] += filt[t + 1] * out[i - l]; } } } diff --git a/auxiliary/waux.h b/auxiliary/waux.h index b6fd83e..093b040 100644 --- a/auxiliary/waux.h +++ b/auxiliary/waux.h @@ -32,6 +32,9 @@ void getDWTAppx(wt_object wt, double *appx,int N); void getDWTDetail(wt_object wt, double *detail, int N, int level); +void getDWTRecCoeff(double *coeff,int *length,char *ctype,char *ext, int level, int J,double *lpr, + double *hpr,int lf,int siglength,double *reccoeff); + #ifdef __cplusplus } diff --git a/header/denoise.h b/header/denoise.h index 7d32fec..113c7e0 100644 --- a/header/denoise.h +++ b/header/denoise.h @@ -16,6 +16,9 @@ void visushrink(double *signal,int N,int J,char *wname,char *method,char *ext,ch void sureshrink(double *signal,int N,int J,char *wname,char *method,char *ext,char *thresh,double *denoised); +void getDWTRecCoeff(double *coeff,int *length,char *ctype,char *ext, int level, int J,double *lpr, + double *hpr,int lf,int siglength,double *reccoeff); + double mad(double *x, int N);