const-correct header/wavelib.h; drop duplicate src/wavelib.h; break everything
This commit is contained in:
534
src/wavelib.c
534
src/wavelib.c
@@ -2,9 +2,17 @@
|
||||
Copyright (c) 2014, Rafat Hussain
|
||||
*/
|
||||
|
||||
#include "wavelib.h"
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
wave_object wave_init(char* wname) {
|
||||
#include "cwt.h"
|
||||
#include "wavelib.h"
|
||||
#include "wtmath.h"
|
||||
|
||||
|
||||
wave_object wave_init(const char* wname) {
|
||||
wave_object obj = NULL;
|
||||
int retval;
|
||||
retval = 0;
|
||||
@@ -30,7 +38,7 @@ wave_object wave_init(char* wname) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
wt_object wt_init(wave_object wave,char* method, int siglength,int J) {
|
||||
wt_object wt_init(wave_object wave,const char* method, int siglength,int J) {
|
||||
int size,i,MaxIter;
|
||||
wt_object obj = NULL;
|
||||
|
||||
@@ -258,13 +266,13 @@ wpt_object wpt_init(wave_object wave, int siglength, int J) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
cwt_object cwt_init(char* wave, double param,int siglength, double dt, int J) {
|
||||
cwt_object cwt_init(const char* wave, double param,int siglength, double dt, int J) {
|
||||
cwt_object obj = NULL;
|
||||
int N, i,nj2,ibase2,mother;
|
||||
double s0, dj;
|
||||
double t1;
|
||||
int m, odd;
|
||||
char *pdefault = "pow";
|
||||
const char *pdefault = "pow";
|
||||
|
||||
m = (int)param;
|
||||
odd = 1;
|
||||
@@ -700,7 +708,7 @@ static void dwt1(wt_object wt,double *sig,int len_sig, double *cA, int len_cA, d
|
||||
free(cA_undec);
|
||||
}
|
||||
|
||||
void dwt(wt_object wt,double *inp) {
|
||||
void dwt(wt_object wt,const double *inp) {
|
||||
int i,J,temp_len,iter,N,lp;
|
||||
int len_cA;
|
||||
double *orig,*orig2;
|
||||
@@ -817,7 +825,7 @@ void dwt(wt_object wt,double *inp) {
|
||||
free(orig2);
|
||||
}
|
||||
|
||||
void wtree(wtree_object wt,double *inp) {
|
||||
void wtree(wtree_object wt,const double *inp) {
|
||||
int i,J,temp_len,iter,N,lp,p2,k,N2,Np;
|
||||
int len_cA,t,t2,it1;
|
||||
double *orig;
|
||||
@@ -959,7 +967,7 @@ static int ipow2(int n) {
|
||||
return p;
|
||||
}
|
||||
|
||||
void dwpt(wpt_object wt, double *inp) {
|
||||
void dwpt(wpt_object wt, const double *inp) {
|
||||
int i, J, temp_len, iter, N, lp, p2, k, N2, Np;
|
||||
int temp, elength, temp2,size,nodes,llb,n1,j;
|
||||
double eparam,v1,v2;
|
||||
@@ -1327,7 +1335,7 @@ int getCWTScaleLength(int N) {
|
||||
return J;
|
||||
}
|
||||
|
||||
void setCWTScales(cwt_object wt, double s0, double dj,char *type,int power) {
|
||||
void setCWTScales(cwt_object wt, double s0, double dj,const char *type,int power) {
|
||||
int i;
|
||||
strcpy(wt->type,type);
|
||||
//s0*pow(2.0, (double)(j - 1)*dj);
|
||||
@@ -1353,7 +1361,7 @@ void setCWTScales(cwt_object wt, double s0, double dj,char *type,int power) {
|
||||
wt->dj = dj;
|
||||
}
|
||||
|
||||
void setCWTScaleVector(cwt_object wt, double *scale, int J,double s0,double dj) {
|
||||
void setCWTScaleVector(cwt_object wt, const double *scale, int J,double s0,double dj) {
|
||||
int i;
|
||||
|
||||
if (J != wt->J) {
|
||||
@@ -1378,7 +1386,7 @@ void setCWTPadding(cwt_object wt, int pad) {
|
||||
}
|
||||
}
|
||||
|
||||
void cwt(cwt_object wt, double *inp) {
|
||||
void cwt(cwt_object wt, const double *inp) {
|
||||
int i, N, npad,nj2,j,j2;
|
||||
N = wt->siglength;
|
||||
if (wt->sflag == 0) {
|
||||
@@ -1772,251 +1780,251 @@ void idwpt(wpt_object wt, double *dwtop) {
|
||||
llb = 1;
|
||||
index2 = xlen / p;
|
||||
indexp = 0;
|
||||
if (wt->basisvector[0] == 1) {
|
||||
for (i = 0; i < wt->siglength; ++i) {
|
||||
dwtop[i] = wt->output[i];
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < J; ++i) {
|
||||
llb *= 2;
|
||||
n1 += llb;
|
||||
}
|
||||
|
||||
for (i = 0; i < xlen; ++i) {
|
||||
X[i] = 0.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < llb; ++i) {
|
||||
prep[i] = (int)wt->basisvector[n1 - llb + i];
|
||||
ptemp[i] = 0;
|
||||
}
|
||||
|
||||
if (!strcmp(wt->ext, "per")) {
|
||||
app_len = wt->length[0];
|
||||
det_len = wt->length[1];
|
||||
index = 0;
|
||||
|
||||
|
||||
for (i = 0; i < J; ++i) {
|
||||
p = ipow2(J - i - 1);
|
||||
det_len = wt->length[i + 1];
|
||||
index2 *= 2;
|
||||
index3 = 0;
|
||||
index4 = 0;
|
||||
//idwt1(wt, temp, cA_up, out, det_len, wt->output + iter, det_len, X_lp, X_hp, out);
|
||||
n1 -= llb;
|
||||
for (l = 0; l < llb; ++l) {
|
||||
if (ptemp[l] != 2) {
|
||||
prep[l] = (int)wt->basisvector[n1 + l];
|
||||
}
|
||||
else {
|
||||
prep[l] = ptemp[l];
|
||||
}
|
||||
ptemp[l] = 0;
|
||||
}
|
||||
|
||||
|
||||
for (l = 0; l < p; ++l) {
|
||||
if (prep[2 * l] == 1 && prep[2 * l + 1] == 1) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = wt->output[index + k];
|
||||
out2[k] = wt->output[index + det_len + k];
|
||||
}
|
||||
idwpt_per(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
X[index3 + k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
index += 2 * det_len;
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 1 && prep[2 * l + 1] == 2) {
|
||||
index4 += indexp;
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = wt->output[index + k];
|
||||
out2[k] = X[index4 + k];
|
||||
}
|
||||
idwpt_per(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
X[index3 + k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
index += det_len;
|
||||
index3 += index2;
|
||||
index4 += indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 2 && prep[2 * l + 1] == 1) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = X[index4 + k];
|
||||
out2[k] = wt->output[index + k];
|
||||
}
|
||||
idwpt_per(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
X[index3 + k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
index += det_len;
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 2 && prep[2 * l + 1] == 2) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = X[index4 + k];
|
||||
out2[k] = X[index4 + indexp + k];
|
||||
}
|
||||
idwpt_per(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
X[index3 + k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
index4 += 2 * indexp;
|
||||
index3 += index2;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else {
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
idwt_per(wt, out, det_len, wt->output + iter, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
out[k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
|
||||
iter += det_len;
|
||||
det_len = wt->length[i + 2];
|
||||
*/
|
||||
llb /= 2;
|
||||
indexp = index2;
|
||||
}
|
||||
|
||||
//free(X_lp);
|
||||
|
||||
}
|
||||
else if (!strcmp(wt->ext, "sym")) {
|
||||
app_len = wt->length[0];
|
||||
det_len = wt->length[1];
|
||||
N = 2 * wt->length[J] - 1;
|
||||
|
||||
//X_lp = (double*)malloc(sizeof(double)* (N + 2 * lf - 1));
|
||||
index = 0;
|
||||
|
||||
for (i = 0; i < J; ++i) {
|
||||
p = ipow2(J - i - 1);
|
||||
det_len = wt->length[i + 1];
|
||||
index2 *= 2;
|
||||
index3 = 0;
|
||||
index4 = 0;
|
||||
//idwt1(wt, temp, cA_up, out, det_len, wt->output + iter, det_len, X_lp, X_hp, out);
|
||||
n1 -= llb;
|
||||
for (l = 0; l < llb; ++l) {
|
||||
if (ptemp[l] != 2) {
|
||||
prep[l] = (int)wt->basisvector[n1 + l];
|
||||
}
|
||||
else {
|
||||
prep[l] = ptemp[l];
|
||||
}
|
||||
ptemp[l] = 0;
|
||||
}
|
||||
|
||||
|
||||
for (l = 0; l < p; ++l) {
|
||||
if (prep[2 * l] == 1 && prep[2 * l + 1] == 1) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = wt->output[index + k];
|
||||
out2[k] = wt->output[index + det_len + k];
|
||||
}
|
||||
idwpt_sym(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
X[index3 + k - lf + 2] = X_lp[k];
|
||||
}
|
||||
index += 2 * det_len;
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 1 && prep[2 * l + 1] == 2) {
|
||||
index4 += indexp;
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = wt->output[index + k];
|
||||
out2[k] = X[index4 + k];
|
||||
}
|
||||
idwpt_sym(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
X[index3 + k - lf + 2] = X_lp[k];
|
||||
}
|
||||
index += det_len;
|
||||
index3 += index2;
|
||||
index4 += indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 2 && prep[2 * l + 1] == 1) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = X[index4 + k];
|
||||
out2[k] = wt->output[index + k];
|
||||
}
|
||||
idwpt_sym(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
X[index3 + k - lf + 2] = X_lp[k];
|
||||
}
|
||||
index += det_len;
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 2 && prep[2 * l + 1] == 2) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = X[index4 + k];
|
||||
out2[k] = X[index4 + indexp + k];
|
||||
}
|
||||
idwpt_sym(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
X[index3 + k - lf + 2] = X_lp[k];
|
||||
}
|
||||
index4 += 2 * indexp;
|
||||
index3 += index2;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else {
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//idwt1(wt, temp, cA_up, out, det_len, wt->output + iter, det_len, X_lp, X_hp, out);
|
||||
/*
|
||||
idwpt_sym(wt, out, det_len, wt->output + iter, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
out[k - lf + 2] = X_lp[k];
|
||||
}
|
||||
|
||||
iter += det_len;
|
||||
det_len = wt->length[i + 2];
|
||||
*/
|
||||
llb /= 2;
|
||||
indexp = index2;
|
||||
}
|
||||
|
||||
//free(X_lp);
|
||||
|
||||
}
|
||||
else {
|
||||
printf("Signal extension can be either per or sym");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for (i = 0; i < wt->siglength; ++i) {
|
||||
//printf("%g ", X[i]);
|
||||
dwtop[i] = X[i];
|
||||
}
|
||||
|
||||
if (wt->basisvector[0] == 1) {
|
||||
for (i = 0; i < wt->siglength; ++i) {
|
||||
dwtop[i] = wt->output[i];
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < J; ++i) {
|
||||
llb *= 2;
|
||||
n1 += llb;
|
||||
}
|
||||
|
||||
for (i = 0; i < xlen; ++i) {
|
||||
X[i] = 0.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < llb; ++i) {
|
||||
prep[i] = (int)wt->basisvector[n1 - llb + i];
|
||||
ptemp[i] = 0;
|
||||
}
|
||||
|
||||
if (!strcmp(wt->ext, "per")) {
|
||||
app_len = wt->length[0];
|
||||
det_len = wt->length[1];
|
||||
index = 0;
|
||||
|
||||
|
||||
for (i = 0; i < J; ++i) {
|
||||
p = ipow2(J - i - 1);
|
||||
det_len = wt->length[i + 1];
|
||||
index2 *= 2;
|
||||
index3 = 0;
|
||||
index4 = 0;
|
||||
//idwt1(wt, temp, cA_up, out, det_len, wt->output + iter, det_len, X_lp, X_hp, out);
|
||||
n1 -= llb;
|
||||
for (l = 0; l < llb; ++l) {
|
||||
if (ptemp[l] != 2) {
|
||||
prep[l] = (int)wt->basisvector[n1 + l];
|
||||
}
|
||||
else {
|
||||
prep[l] = ptemp[l];
|
||||
}
|
||||
ptemp[l] = 0;
|
||||
}
|
||||
|
||||
|
||||
for (l = 0; l < p; ++l) {
|
||||
if (prep[2 * l] == 1 && prep[2 * l + 1] == 1) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = wt->output[index + k];
|
||||
out2[k] = wt->output[index + det_len + k];
|
||||
}
|
||||
idwpt_per(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
X[index3 + k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
index += 2 * det_len;
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 1 && prep[2 * l + 1] == 2) {
|
||||
index4 += indexp;
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = wt->output[index + k];
|
||||
out2[k] = X[index4 + k];
|
||||
}
|
||||
idwpt_per(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
X[index3 + k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
index += det_len;
|
||||
index3 += index2;
|
||||
index4 += indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 2 && prep[2 * l + 1] == 1) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = X[index4 + k];
|
||||
out2[k] = wt->output[index + k];
|
||||
}
|
||||
idwpt_per(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
X[index3 + k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
index += det_len;
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 2 && prep[2 * l + 1] == 2) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = X[index4 + k];
|
||||
out2[k] = X[index4 + indexp + k];
|
||||
}
|
||||
idwpt_per(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
X[index3 + k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
index4 += 2 * indexp;
|
||||
index3 += index2;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else {
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
idwt_per(wt, out, det_len, wt->output + iter, det_len, X_lp);
|
||||
for (k = lf / 2 - 1; k < 2 * det_len + lf / 2 - 1; ++k) {
|
||||
out[k - lf / 2 + 1] = X_lp[k];
|
||||
}
|
||||
|
||||
iter += det_len;
|
||||
det_len = wt->length[i + 2];
|
||||
*/
|
||||
llb /= 2;
|
||||
indexp = index2;
|
||||
}
|
||||
|
||||
//free(X_lp);
|
||||
|
||||
}
|
||||
else if (!strcmp(wt->ext, "sym")) {
|
||||
app_len = wt->length[0];
|
||||
det_len = wt->length[1];
|
||||
N = 2 * wt->length[J] - 1;
|
||||
|
||||
//X_lp = (double*)malloc(sizeof(double)* (N + 2 * lf - 1));
|
||||
index = 0;
|
||||
|
||||
for (i = 0; i < J; ++i) {
|
||||
p = ipow2(J - i - 1);
|
||||
det_len = wt->length[i + 1];
|
||||
index2 *= 2;
|
||||
index3 = 0;
|
||||
index4 = 0;
|
||||
//idwt1(wt, temp, cA_up, out, det_len, wt->output + iter, det_len, X_lp, X_hp, out);
|
||||
n1 -= llb;
|
||||
for (l = 0; l < llb; ++l) {
|
||||
if (ptemp[l] != 2) {
|
||||
prep[l] = (int)wt->basisvector[n1 + l];
|
||||
}
|
||||
else {
|
||||
prep[l] = ptemp[l];
|
||||
}
|
||||
ptemp[l] = 0;
|
||||
}
|
||||
|
||||
|
||||
for (l = 0; l < p; ++l) {
|
||||
if (prep[2 * l] == 1 && prep[2 * l + 1] == 1) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = wt->output[index + k];
|
||||
out2[k] = wt->output[index + det_len + k];
|
||||
}
|
||||
idwpt_sym(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
X[index3 + k - lf + 2] = X_lp[k];
|
||||
}
|
||||
index += 2 * det_len;
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 1 && prep[2 * l + 1] == 2) {
|
||||
index4 += indexp;
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = wt->output[index + k];
|
||||
out2[k] = X[index4 + k];
|
||||
}
|
||||
idwpt_sym(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
X[index3 + k - lf + 2] = X_lp[k];
|
||||
}
|
||||
index += det_len;
|
||||
index3 += index2;
|
||||
index4 += indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 2 && prep[2 * l + 1] == 1) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = X[index4 + k];
|
||||
out2[k] = wt->output[index + k];
|
||||
}
|
||||
idwpt_sym(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
X[index3 + k - lf + 2] = X_lp[k];
|
||||
}
|
||||
index += det_len;
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else if (prep[2 * l] == 2 && prep[2 * l + 1] == 2) {
|
||||
for (k = 0; k < det_len; ++k) {
|
||||
out[k] = X[index4 + k];
|
||||
out2[k] = X[index4 + indexp + k];
|
||||
}
|
||||
idwpt_sym(wt, out, det_len, out2, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
X[index3 + k - lf + 2] = X_lp[k];
|
||||
}
|
||||
index4 += 2 * indexp;
|
||||
index3 += index2;
|
||||
ptemp[l] = 2;
|
||||
}
|
||||
else {
|
||||
index3 += index2;
|
||||
index4 += 2 * indexp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//idwt1(wt, temp, cA_up, out, det_len, wt->output + iter, det_len, X_lp, X_hp, out);
|
||||
/*
|
||||
idwpt_sym(wt, out, det_len, wt->output + iter, det_len, X_lp);
|
||||
for (k = lf - 2; k < 2 * det_len; ++k) {
|
||||
out[k - lf + 2] = X_lp[k];
|
||||
}
|
||||
|
||||
iter += det_len;
|
||||
det_len = wt->length[i + 2];
|
||||
*/
|
||||
llb /= 2;
|
||||
indexp = index2;
|
||||
}
|
||||
|
||||
//free(X_lp);
|
||||
|
||||
}
|
||||
else {
|
||||
printf("Signal extension can be either per or sym");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for (i = 0; i < wt->siglength; ++i) {
|
||||
//printf("%g ", X[i]);
|
||||
dwtop[i] = X[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2218,7 +2226,7 @@ static void swt_direct(wt_object wt, double *inp) {
|
||||
}
|
||||
|
||||
|
||||
void swt(wt_object wt, double *inp) {
|
||||
void swt(wt_object wt, const double *inp) {
|
||||
if (!strcmp(wt->method, "swt") && !strcmp(wt->cmethod, "direct") ) {
|
||||
swt_direct(wt,inp);
|
||||
}
|
||||
@@ -2410,7 +2418,7 @@ static void modwt_per(wt_object wt, int M, double *inp, int N, double *cA, int l
|
||||
free(filt);
|
||||
}
|
||||
|
||||
void modwt(wt_object wt, double *inp) {
|
||||
void modwt(wt_object wt, const double *inp) {
|
||||
int i, J, temp_len, iter, M, N;
|
||||
int lenacc, len_filt;
|
||||
double *cA, *cD;
|
||||
@@ -2536,7 +2544,7 @@ void imodwt(wt_object wt, double *dwtop) {
|
||||
free(X);
|
||||
}
|
||||
|
||||
void setDWTExtension(wt_object wt, char *extension) {
|
||||
void setDWTExtension(wt_object wt, const char *extension) {
|
||||
if (!strcmp(extension, "sym")) {
|
||||
strcpy(wt->ext, "sym");
|
||||
}
|
||||
@@ -2549,7 +2557,7 @@ void setDWTExtension(wt_object wt, char *extension) {
|
||||
}
|
||||
}
|
||||
|
||||
void setWTREEExtension(wtree_object wt, char *extension) {
|
||||
void setWTREEExtension(wtree_object wt, const char *extension) {
|
||||
if (!strcmp(extension, "sym")) {
|
||||
strcpy(wt->ext, "sym");
|
||||
}
|
||||
@@ -2562,7 +2570,7 @@ void setWTREEExtension(wtree_object wt, char *extension) {
|
||||
}
|
||||
}
|
||||
|
||||
void setDWPTExtension(wpt_object wt, char *extension) {
|
||||
void setDWPTExtension(wpt_object wt, const char *extension) {
|
||||
if (!strcmp(extension, "sym")) {
|
||||
strcpy(wt->ext, "sym");
|
||||
}
|
||||
@@ -2575,7 +2583,7 @@ void setDWPTExtension(wpt_object wt, char *extension) {
|
||||
}
|
||||
}
|
||||
|
||||
void setDWPTEntropy(wpt_object wt, char *entropy, double eparam) {
|
||||
void setDWPTEntropy(wpt_object wt, const char *entropy, double eparam) {
|
||||
if (!strcmp(entropy, "shannon")) {
|
||||
strcpy(wt->entropy, "shannon");
|
||||
}
|
||||
@@ -2596,7 +2604,7 @@ void setDWPTEntropy(wpt_object wt, char *entropy, double eparam) {
|
||||
}
|
||||
}
|
||||
|
||||
void setWTConv(wt_object wt, char *cmethod) {
|
||||
void setWTConv(wt_object wt, const char *cmethod) {
|
||||
if (!strcmp(cmethod, "fft") || !strcmp(cmethod, "FFT")) {
|
||||
strcpy(wt->cmethod, "fft");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user