#include<iostream>
#include<math.h>
using namespace std;
double* msxfabs(double * input,int length)
{
int count=0;
while(count<length)
{
input[count]=abs(input[count]);
count++;
}
return input;
}
double** msxfabs2(double ** input,int nf,int framelength)
{
for(int i =0;i<nf;i++)
for(int j=0;j<framelength;j++)
input[i][j]=abs(input[i][j]);
return input;
}
double* msxfshort2double(short * input1,double * input2,int length)
{
int count=0;
while(count<length)
{
input2[count]=input1[count];
count++;
}
return input2;
}
double msxfmax(double * input,int length)
{
int count=0;
double max=0;
while(count<length)
{
if(max<input[count])
max=input[count];
count++;
}
return max;
}
double * msxfnormalize(double * input ,int length)
{
double tempmax= msxfmax(input, length);
for(int i =0;i<length;i++)
{
input[i]/=tempmax;
}
return input;
}
double ** msxfpointmul1(double **input1 , double ** input2 , int framenumber,int framesize, double ** result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
/*for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
cout << endl<< input1[i][j]<<endl;
}*/
for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
result[i][j]=input1[i][j]*input2[i][j];
}
return result;
}
double ** msxfpointsub1(double **input1 , double ** input2 , int framenumber,int framesize, double ** result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
/*for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
cout << endl<< input1[i][j]<<endl;
}*/
for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
result[i][j]=input1[i][j]-input2[i][j];
}
return result;
}
double ** msxfpointmul2(double **input1 , double ** input2 , int framenumber,int framesize, double ** result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
/*for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
cout << endl<< input1[i][j]<<endl;
}*/
for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
result[i][j]=input1[i][j]*input2[i][j];
if(result[i][j]<0)
result[i][j]=1;
else
result[i][j]=0;
}
return result;
}
double ** msxfpointsub2(double **input1 , double ** input2 , int framenumber,int framesize, double ** result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
/*for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
cout << endl<< input1[i][j]<<endl;
}*/
for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
result[i][j]=input1[i][j]-input2[i][j];
if(result[i][j]>0.02)
result[i][j]=1;
else
result[i][j]=0;
}
return result;
}
double * msxfpointsum(double **input1 , int framenumber,int framesize, double * result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
for(int i =0;i<framenumber;i++)
{
result[i]=0;
}
for(int i =0;i<framenumber;i++)
{
result[i]=0;
for(int j=0;j<framesize;j++)
{
result[i]=result[i]+input1[i][j];
}
}
return result;
}
double** enframe(const double x[], int srclength, int framelength, int step, double **yenframe)
{
//int nf = floor((srclength - framelength + step) / step);
int nf = (srclength - framelength + step) / step; // count the frame number
//double** yenframe; // store result
//yenframe = new double *[nf];
// for (int i = 0; i < nf; i++)
//{
// yenframe[i] = new double[framelength];
//}
int count = 0;
int startNo = 0;
while (count < nf)
{
for (int i = 0; i < framelength; i++)
{
yenframe[count][i] = x[startNo + i];
}
count++;
startNo += step;
}
return yenframe;
}
int preemphasize(double *sample,int frame_len)
{
int i;
double emph = (double)0.97;//加权系数
for (i = frame_len-1; i > 0; i--)
{
sample[i] = sample[i] - emph * sample[i-1];
}
sample[0] = (double)(1.0 - emph) * sample[0];
return(1);
}
double * msxfamp(short *input1 , int length, int framelength, int step, double * amp) //energy
{
int nf = (length - framelength + step) / step;
for (int i = 0; i < nf; i++)
{
amp[i]=0;
}
for(int i=0;i<6;i++)
{
cout <<"in msxfamp " << input1[i]<<endl;
}
double *input2=new double[length];
msxfshort2double(input1 ,input2,length);
msxfnormalize( input2 ,length);
preemphasize(input2,length);
for(int i=0;i<6;i++)
{
cout <<"in msxfamp " <<input2[i]<<endl;
}
double ** inresult = new double *[nf];
for (int i = 0; i < nf; i++)
{
inresult[i] = new double[framelength];
}
enframe ( input2 , length , framelength , step ,inresult);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in msxfamp enframe " <<inresult[i][j] << endl;
}
cout << endl;
}
msxfabs2( inresult, nf, framelength); //取绝对值
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in msxfamp enframe abs " <<inresult[i][j] << endl;
}
cout << endl;
}
msxfpointsum(inresult , nf, framelength, amp); //energy
delete [] input2;
for(int j=0;j<nf;j++)
{
delete [] inresult[j];
}
delete [] inresult;
return amp;
}
double * msxfzcr(short *input1 , int length, int framelength, int step, double * inzcr) //zcr
{
int nf = (length - framelength + step) / step;
for (int i = 0; i < nf; i++)
{
inzcr[i]=0;
}
double *input2=new double[length];
msxfshort2double(input1 ,input2,length);
msxfnormalize( input2 ,length);
preemphasize(input2,length);
for(int i=0;i<6;i++)
{
cout <<"in msxfamp " <<input2[i]<<endl;
}
double ** tmp1 = new double *[nf];
for (int i = 0; i < nf; i++)
{
tmp1[i] = new double[framelength];
}
double ** tmp2 = new double *[nf];
for (int i = 0; i < nf; i++)
{
tmp2[i] = new double[framelength];
}
enframe ( input2 , length-1 , framelength , step ,tmp1);
enframe ( &input2[1] , length-1 , framelength , step ,tmp2);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function tmp1 is " <<tmp1[i][j] << " ";
}
cout << endl;
}
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function tmp2 is " <<tmp2[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
cout <<"address "<< input2 << " " << &input2[1]<<endl;
double **sign = new double *[nf];
for (int i = 0; i < nf; i++)
{
sign[i] = new double[framelength];
}
msxfpointmul2(tmp1 , tmp2 , nf, framelength, sign);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function sign is " <<sign[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double ** diffs = new double *[nf];
for (int i = 0; i < nf; i++)
{
diffs[i] = new double[framelength];
}
msxfpointsub2(tmp1 , tmp2 , nf, framelength, diffs);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function diff is " <<diffs[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double **zcrtmp = new double *[nf];
for (int i = 0; i < nf; i++)
{
zcrtmp[i] = new double[framelength];
}
msxfpointmul1(sign , diffs , nf, framelength, zcrtmp);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function zcrtmp is " <<zcrtmp[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
msxfpointsum(zcrtmp , nf, framelength, inzcr); //zero corss rate
for (int i = 0; i < nf; i++)
{
cout << "in function zcr is " <<inzcr[i] << endl;
}
for (int i = 0; i < nf; i++)
{
delete [] tmp1[i] ;
}
delete [] tmp1;
for (int i = 0; i < nf; i++)
{
delete [] tmp2[i] ;
}
delete [] tmp2;
for (int i = 0; i < nf; i++)
{
delete [] sign[i] ;
}
delete [] sign;
for (int i = 0; i < nf; i++)
{
delete [] diffs[i] ;
}
delete [] diffs;
for (int i = 0; i < nf; i++)
{
delete [] zcrtmp[i] ;
}
delete [] zcrtmp;
delete [] input2;
return inzcr;
}
int main()
{
//short test[6]={ 99,-88,77,-59,10,-87};
//short** array1;
//short** array2;
//short** result;// store result
short* result2;// store result
//double* result3;// store result
int nf=2;
int length=6;
int framelength=3;
int step = 2 ;
// array1 = new short *[nf];
result2=new short[length];
//result3=new double[nf];
double *test2=new double[length];
result2[0]=24;
result2[1]=-21;
result2[2]=18;
result2[3]=-29;
result2[4]=16;
result2[5]=-13;
msxfshort2double(result2 ,test2,length);
msxfnormalize( test2 ,length);
for(int i=0;i<length;i++)
{
cout <<"before "<<test2[i]<<endl;
}
preemphasize(test2,length);
for(int i=0;i<length;i++)
{
cout <<"after "<<test2[i]<<endl;
}
nf = (length - framelength + step) / step;
double ** result = new double *[nf];
for (int i = 0; i < nf; i++)
{
result[i] = new double[framelength];
}
enframe ( test2 , length , framelength , step,result );
cout <<"address "<< test2 << " " << &test2[1]<<endl;
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "perframe is " <<result[i][j] << endl;
}
cout << endl;
}
msxfabs2( result, nf, framelength); //取绝对值
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "perframe is " <<result[i][j] << endl;
}
cout << endl;
}
double *amp = new double [nf];
msxfpointsum(result , nf, framelength, amp); //energy
for (int i = 0; i < nf; i++)
{
cout << "amp is " <<amp[i] << endl;
}
msxfamp(result2 , length, framelength, step, amp);
for (int i = 0; i < nf; i++)
{
cout << "msxfamp is " <<amp[i] << endl;
}
double ** tmp1 = new double *[nf];
for (int i = 0; i < nf; i++)
{
tmp1[i] = new double[framelength];
}
double ** tmp2 = new double *[nf];
for (int i = 0; i < nf; i++)
{
tmp2[i] = new double[framelength];
}
enframe ( test2 , length-1 , framelength , step ,tmp1);
enframe ( &test2[1] , length-1 , framelength , step ,tmp2);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "tmp1 is " <<tmp1[i][j] << " ";
}
cout << endl;
}
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "tmp2 is " <<tmp2[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
cout <<"address "<< test2 << " " << &test2[1]<<endl;
double **sign = new double *[nf];
for (int i = 0; i < nf; i++)
{
sign[i] = new double[framelength];
}
msxfpointmul2(tmp1 , tmp2 , nf, framelength, sign);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "sign is " <<sign[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double ** diffs = new double *[nf];
for (int i = 0; i < nf; i++)
{
diffs[i] = new double[framelength];
}
msxfpointsub2(tmp1 , tmp2 , nf, framelength, diffs);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "diff is " <<diffs[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double **zcrtmp = new double *[nf];
for (int i = 0; i < nf; i++)
{
zcrtmp[i] = new double[framelength];
}
msxfpointmul1(sign , diffs , nf, framelength, zcrtmp);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "zcrtmp is " <<zcrtmp[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double *zcr = new double [nf];
msxfpointsum(zcrtmp , nf, framelength, zcr); //zero corss rate
for (int i = 0; i < nf; i++)
{
cout << "zcr is " <<zcr[i] << endl;
}
msxfzcr(result2 , length, framelength, step , zcr); //zero corss rate
for (int i = 0; i < nf; i++)
{
cout << "after function zcr is " <<zcr[i] << endl;
}
}
#include<math.h>
using namespace std;
double* msxfabs(double * input,int length)
{
int count=0;
while(count<length)
{
input[count]=abs(input[count]);
count++;
}
return input;
}
double** msxfabs2(double ** input,int nf,int framelength)
{
for(int i =0;i<nf;i++)
for(int j=0;j<framelength;j++)
input[i][j]=abs(input[i][j]);
return input;
}
double* msxfshort2double(short * input1,double * input2,int length)
{
int count=0;
while(count<length)
{
input2[count]=input1[count];
count++;
}
return input2;
}
double msxfmax(double * input,int length)
{
int count=0;
double max=0;
while(count<length)
{
if(max<input[count])
max=input[count];
count++;
}
return max;
}
double * msxfnormalize(double * input ,int length)
{
double tempmax= msxfmax(input, length);
for(int i =0;i<length;i++)
{
input[i]/=tempmax;
}
return input;
}
double ** msxfpointmul1(double **input1 , double ** input2 , int framenumber,int framesize, double ** result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
/*for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
cout << endl<< input1[i][j]<<endl;
}*/
for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
result[i][j]=input1[i][j]*input2[i][j];
}
return result;
}
double ** msxfpointsub1(double **input1 , double ** input2 , int framenumber,int framesize, double ** result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
/*for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
cout << endl<< input1[i][j]<<endl;
}*/
for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
result[i][j]=input1[i][j]-input2[i][j];
}
return result;
}
double ** msxfpointmul2(double **input1 , double ** input2 , int framenumber,int framesize, double ** result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
/*for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
cout << endl<< input1[i][j]<<endl;
}*/
for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
result[i][j]=input1[i][j]*input2[i][j];
if(result[i][j]<0)
result[i][j]=1;
else
result[i][j]=0;
}
return result;
}
double ** msxfpointsub2(double **input1 , double ** input2 , int framenumber,int framesize, double ** result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
/*for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
cout << endl<< input1[i][j]<<endl;
}*/
for(int i =0;i<framenumber;i++)
for(int j=0;j<framesize;j++)
{
result[i][j]=input1[i][j]-input2[i][j];
if(result[i][j]>0.02)
result[i][j]=1;
else
result[i][j]=0;
}
return result;
}
double * msxfpointsum(double **input1 , int framenumber,int framesize, double * result)
{
//cout << "inside mul"<< framenumber << framesize<<endl;
for(int i =0;i<framenumber;i++)
{
result[i]=0;
}
for(int i =0;i<framenumber;i++)
{
result[i]=0;
for(int j=0;j<framesize;j++)
{
result[i]=result[i]+input1[i][j];
}
}
return result;
}
double** enframe(const double x[], int srclength, int framelength, int step, double **yenframe)
{
//int nf = floor((srclength - framelength + step) / step);
int nf = (srclength - framelength + step) / step; // count the frame number
//double** yenframe; // store result
//yenframe = new double *[nf];
// for (int i = 0; i < nf; i++)
//{
// yenframe[i] = new double[framelength];
//}
int count = 0;
int startNo = 0;
while (count < nf)
{
for (int i = 0; i < framelength; i++)
{
yenframe[count][i] = x[startNo + i];
}
count++;
startNo += step;
}
return yenframe;
}
int preemphasize(double *sample,int frame_len)
{
int i;
double emph = (double)0.97;//加权系数
for (i = frame_len-1; i > 0; i--)
{
sample[i] = sample[i] - emph * sample[i-1];
}
sample[0] = (double)(1.0 - emph) * sample[0];
return(1);
}
double * msxfamp(short *input1 , int length, int framelength, int step, double * amp) //energy
{
int nf = (length - framelength + step) / step;
for (int i = 0; i < nf; i++)
{
amp[i]=0;
}
for(int i=0;i<6;i++)
{
cout <<"in msxfamp " << input1[i]<<endl;
}
double *input2=new double[length];
msxfshort2double(input1 ,input2,length);
msxfnormalize( input2 ,length);
preemphasize(input2,length);
for(int i=0;i<6;i++)
{
cout <<"in msxfamp " <<input2[i]<<endl;
}
double ** inresult = new double *[nf];
for (int i = 0; i < nf; i++)
{
inresult[i] = new double[framelength];
}
enframe ( input2 , length , framelength , step ,inresult);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in msxfamp enframe " <<inresult[i][j] << endl;
}
cout << endl;
}
msxfabs2( inresult, nf, framelength); //取绝对值
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in msxfamp enframe abs " <<inresult[i][j] << endl;
}
cout << endl;
}
msxfpointsum(inresult , nf, framelength, amp); //energy
delete [] input2;
for(int j=0;j<nf;j++)
{
delete [] inresult[j];
}
delete [] inresult;
return amp;
}
double * msxfzcr(short *input1 , int length, int framelength, int step, double * inzcr) //zcr
{
int nf = (length - framelength + step) / step;
for (int i = 0; i < nf; i++)
{
inzcr[i]=0;
}
double *input2=new double[length];
msxfshort2double(input1 ,input2,length);
msxfnormalize( input2 ,length);
preemphasize(input2,length);
for(int i=0;i<6;i++)
{
cout <<"in msxfamp " <<input2[i]<<endl;
}
double ** tmp1 = new double *[nf];
for (int i = 0; i < nf; i++)
{
tmp1[i] = new double[framelength];
}
double ** tmp2 = new double *[nf];
for (int i = 0; i < nf; i++)
{
tmp2[i] = new double[framelength];
}
enframe ( input2 , length-1 , framelength , step ,tmp1);
enframe ( &input2[1] , length-1 , framelength , step ,tmp2);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function tmp1 is " <<tmp1[i][j] << " ";
}
cout << endl;
}
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function tmp2 is " <<tmp2[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
cout <<"address "<< input2 << " " << &input2[1]<<endl;
double **sign = new double *[nf];
for (int i = 0; i < nf; i++)
{
sign[i] = new double[framelength];
}
msxfpointmul2(tmp1 , tmp2 , nf, framelength, sign);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function sign is " <<sign[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double ** diffs = new double *[nf];
for (int i = 0; i < nf; i++)
{
diffs[i] = new double[framelength];
}
msxfpointsub2(tmp1 , tmp2 , nf, framelength, diffs);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function diff is " <<diffs[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double **zcrtmp = new double *[nf];
for (int i = 0; i < nf; i++)
{
zcrtmp[i] = new double[framelength];
}
msxfpointmul1(sign , diffs , nf, framelength, zcrtmp);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "in function zcrtmp is " <<zcrtmp[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
msxfpointsum(zcrtmp , nf, framelength, inzcr); //zero corss rate
for (int i = 0; i < nf; i++)
{
cout << "in function zcr is " <<inzcr[i] << endl;
}
for (int i = 0; i < nf; i++)
{
delete [] tmp1[i] ;
}
delete [] tmp1;
for (int i = 0; i < nf; i++)
{
delete [] tmp2[i] ;
}
delete [] tmp2;
for (int i = 0; i < nf; i++)
{
delete [] sign[i] ;
}
delete [] sign;
for (int i = 0; i < nf; i++)
{
delete [] diffs[i] ;
}
delete [] diffs;
for (int i = 0; i < nf; i++)
{
delete [] zcrtmp[i] ;
}
delete [] zcrtmp;
delete [] input2;
return inzcr;
}
int main()
{
//short test[6]={ 99,-88,77,-59,10,-87};
//short** array1;
//short** array2;
//short** result;// store result
short* result2;// store result
//double* result3;// store result
int nf=2;
int length=6;
int framelength=3;
int step = 2 ;
// array1 = new short *[nf];
result2=new short[length];
//result3=new double[nf];
double *test2=new double[length];
result2[0]=24;
result2[1]=-21;
result2[2]=18;
result2[3]=-29;
result2[4]=16;
result2[5]=-13;
msxfshort2double(result2 ,test2,length);
msxfnormalize( test2 ,length);
for(int i=0;i<length;i++)
{
cout <<"before "<<test2[i]<<endl;
}
preemphasize(test2,length);
for(int i=0;i<length;i++)
{
cout <<"after "<<test2[i]<<endl;
}
nf = (length - framelength + step) / step;
double ** result = new double *[nf];
for (int i = 0; i < nf; i++)
{
result[i] = new double[framelength];
}
enframe ( test2 , length , framelength , step,result );
cout <<"address "<< test2 << " " << &test2[1]<<endl;
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "perframe is " <<result[i][j] << endl;
}
cout << endl;
}
msxfabs2( result, nf, framelength); //取绝对值
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "perframe is " <<result[i][j] << endl;
}
cout << endl;
}
double *amp = new double [nf];
msxfpointsum(result , nf, framelength, amp); //energy
for (int i = 0; i < nf; i++)
{
cout << "amp is " <<amp[i] << endl;
}
msxfamp(result2 , length, framelength, step, amp);
for (int i = 0; i < nf; i++)
{
cout << "msxfamp is " <<amp[i] << endl;
}
double ** tmp1 = new double *[nf];
for (int i = 0; i < nf; i++)
{
tmp1[i] = new double[framelength];
}
double ** tmp2 = new double *[nf];
for (int i = 0; i < nf; i++)
{
tmp2[i] = new double[framelength];
}
enframe ( test2 , length-1 , framelength , step ,tmp1);
enframe ( &test2[1] , length-1 , framelength , step ,tmp2);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "tmp1 is " <<tmp1[i][j] << " ";
}
cout << endl;
}
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "tmp2 is " <<tmp2[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
cout <<"address "<< test2 << " " << &test2[1]<<endl;
double **sign = new double *[nf];
for (int i = 0; i < nf; i++)
{
sign[i] = new double[framelength];
}
msxfpointmul2(tmp1 , tmp2 , nf, framelength, sign);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "sign is " <<sign[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double ** diffs = new double *[nf];
for (int i = 0; i < nf; i++)
{
diffs[i] = new double[framelength];
}
msxfpointsub2(tmp1 , tmp2 , nf, framelength, diffs);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "diff is " <<diffs[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double **zcrtmp = new double *[nf];
for (int i = 0; i < nf; i++)
{
zcrtmp[i] = new double[framelength];
}
msxfpointmul1(sign , diffs , nf, framelength, zcrtmp);
for (int i = 0; i < nf; i++)
{ for(int j=0;j<framelength;j++)
{
cout << "zcrtmp is " <<zcrtmp[i][j] << " " ;
}
cout << endl;
}
cout <<endl;
double *zcr = new double [nf];
msxfpointsum(zcrtmp , nf, framelength, zcr); //zero corss rate
for (int i = 0; i < nf; i++)
{
cout << "zcr is " <<zcr[i] << endl;
}
msxfzcr(result2 , length, framelength, step , zcr); //zero corss rate
for (int i = 0; i < nf; i++)
{
cout << "after function zcr is " <<zcr[i] << endl;
}
}