diff options
Diffstat (limited to '2.3-1/src/c/signalProcessing/transforms')
-rw-r--r-- | 2.3-1/src/c/signalProcessing/transforms/dct/cdcta.c | 230 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/transforms/dct/ddcta.c | 160 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/transforms/dct/sdcta.c | 160 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/transforms/dct/zdcta.c | 230 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/transforms/idct/cidcta.c | 118 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/transforms/idct/didcta.c | 83 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/transforms/idct/sidcta.c | 83 | ||||
-rw-r--r-- | 2.3-1/src/c/signalProcessing/transforms/idct/zidcta.c | 118 |
8 files changed, 0 insertions, 1182 deletions
diff --git a/2.3-1/src/c/signalProcessing/transforms/dct/cdcta.c b/2.3-1/src/c/signalProcessing/transforms/dct/cdcta.c deleted file mode 100644 index 7ff83645..00000000 --- a/2.3-1/src/c/signalProcessing/transforms/dct/cdcta.c +++ /dev/null @@ -1,230 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Ukasha Noor - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - - -#include "dct.h" -#include "addition.h" -#include "types.h" -#include "floatComplex.h" -#include "multiplication.h" -/*#include "matrixMultiplication"*/ -/*#include <fftw3.h>*/ -#include <math.h> - -void cdcta(floatComplex *in,int row,int col,int sign,floatComplex *out) -{ - int i,j,k,u,v; - int n; - int x,y; - float res,ress,vv,ff; - float re,z,q,m; - floatComplex accu = FloatComplex(0, 0); - floatComplex temp,mm,aa,bb,cc; - if(sign==-1) - { - if(row==1) - { - n=col; - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=FloatComplex(0,0); - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - vv = cos(((M_PI)*(y+1-1./2.)*(x))/n); - aa = FloatComplex(vv,0); - temp=cmuls(in[y],aa); - out[x]=cadds(out[x],temp); - } - } - if(x==0) - { - vv = 1./(sqrt(n)); - aa = FloatComplex(vv,0); - out[x]=cmuls(out[x],aa); - } - else - { - float res=2./n; - res = sqrt(res); - aa = FloatComplex(res,0); - out[x]=cmuls(out[x],aa); - } - } - } - } - else - { - n=col*row; - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=FloatComplex(0,0); - for(i=0;i<row;i++) - { - temp=FloatComplex(0,0); - mm=FloatComplex(0,0); - for(j=0;j<col;j++) - { - y=j*row+i; - z=(float)(((float)j+1.0/2.0)*(float)v); - q=(float)(M_PI/(float)col); - vv = cos(q*z); - aa = FloatComplex(vv,0); - mm=cmuls(in[y],aa); - temp=cadds(temp,mm); - } - z=(float)(((float)i+1.0/2.0)*(float)u); - q=(float)(M_PI/(float)row); - ff = cos(q*z); - bb = FloatComplex(ff,0); - temp=cmuls(temp,bb); - out[x]=cadds(out[x],temp); - } - if(u==0) - { - vv = 1./sqrt((float)row); - aa = FloatComplex(vv,0); - out[x]=cmuls(out[x],aa); - if(v==0) - { - vv = 1./sqrt((float)col); - aa = FloatComplex(vv,0); - out[x]=cmuls(out[x],aa); - } - else - { - vv = sqrt(2./col); - aa = FloatComplex(vv,0); - out[x]=cmuls(out[x],aa); - } - } - else - { - vv = sqrt(2./row); - aa = FloatComplex(vv,0); - out[x]=cmuls(out[x],aa); - if(v==0) - { - vv = 1./sqrt((float)col); - aa = FloatComplex(vv,0); - out[x]=cmuls(out[x],aa); - } - else - { - vv = sqrt(2./col); - aa = FloatComplex(vv,0); - out[x]=cmuls(out[x],aa); - } - } - } - } - } - } - else if(sign==1) - { - n=col; - if(row==1) - { - res=1./sqrt(n); - ress=sqrt(2./n); - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=FloatComplex(0,0); - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - if(y==0) - { - q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); - aa = FloatComplex(q,0); - out[x]=cadds(out[x],cmuls(in[y],aa)); - } - else - { - q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); - aa = FloatComplex(q,0); - out[x]=cadds(out[x],cmuls(in[y],aa)); - } - } - } - } - - } - } - else - { - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=FloatComplex(0,0); - for(i=0;i<row;i++) - { - re=0; - mm=FloatComplex(0,0); - temp=FloatComplex(0,0); - for(j=0;j<col;j++) - { - y=row*j+i; - mm=in[j*row+i]; - z=(float)(((float)v+1.0/2.0)*(float)j); - q=(float)(M_PI/(float)col); - vv = cos(q*z); - aa = FloatComplex(vv,0); - mm=cmuls(mm,aa); - if(j==0) - { - vv = 1./sqrt((float)col); - aa = FloatComplex(vv,0); - temp=cadds(temp,cmuls(mm,aa)); - } - else - { - vv = sqrt(2./col); - aa = FloatComplex(vv,0); - temp=cadds(temp,cmuls(mm,aa)); - } - } - z=(float)(((float)u+1.0/2.0)*(float)i); - q=(float)(M_PI/(float)row); - if(i==0) - { - vv = (cos(z*q))*(1./sqrt(row)); - aa = FloatComplex(vv,0); - out[x]=cadds(out[x],cmuls(temp,aa)); - } - else - { - vv = (cos(z*q))*sqrt(2./row); - aa = FloatComplex(vv,0); - out[x]=cadds(out[x],cmuls(temp,aa)); - } - } - } - } - } - } -} diff --git a/2.3-1/src/c/signalProcessing/transforms/dct/ddcta.c b/2.3-1/src/c/signalProcessing/transforms/dct/ddcta.c deleted file mode 100644 index 3802c816..00000000 --- a/2.3-1/src/c/signalProcessing/transforms/dct/ddcta.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Ukasha Noor - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - - -#include "dct.h" -/*#include <fftw3.h>*/ -#include <math.h> - -void ddcta(double *in,int row,int col,int sign,double *out) -{ - int i,j,k,u,v; - int n; - int x,y; - double res,ress; - double re,z,q,m; - if(sign==-1) - { - if(row==1) - { - n=col; - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - out[x]+=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); - } - } - if(x==0) - out[x]*=1./(sqrt(n)); - else - { - double res=2./n; - out[x]*=sqrt(res); - } - } - } - } - else - { - n=col*row; - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - re=0; - for(j=0;j<col;j++) - { - m=(double)in[j*row+i]; - z=(double)(((double)j+1.0/2.0)*(double)v); - q=(double)(M_PI/(double)col); - re+=m*(cos(q*z)); - } - z=(double)(((double)i+1.0/2.0)*(double)u); - q=(double)(M_PI/(double)row); - out[x]+=re*(cos(q*z)); - } - if(u==0) - { - out[x]/=sqrt((double)row); - if(v==0) - out[x]/=sqrt((double)col); - else - out[x]*=sqrt(2./col); - } - else - { - out[x]*=sqrt(2./row); - if(v==0) - out[x]/=sqrt((double)col); - else - out[x]*=sqrt(2./col); - } - } - } - - } - } - else if(sign==1) - { - n=col; - if(row==1) - { - res=1./sqrt(n); - ress=sqrt(2./n); - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - if(y==0) - out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); - else - out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); - } - } - } - - } - } - else - { - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - re=0; - for(j=0;j<col;j++) - { - y=row*j+i; - m=(double)in[j*row+i]; - z=(double)(((double)v+1.0/2.0)*(double)j); - q=(double)(M_PI/(double)col); - m=m*(cos(q*z)); - if(j==0) - re+=m/sqrt((double)col); - else - re+=m*sqrt(2./col); - } - z=(double)(((double)u+1.0/2.0)*(double)i); - q=(double)(M_PI/(double)row); - if(i==0) - out[x]+=(re*(cos(z*q)))/sqrt((double)row); - else - out[x]+=(re*(cos(z*q))*sqrt(2./row)); - } - } - } - } - } -} diff --git a/2.3-1/src/c/signalProcessing/transforms/dct/sdcta.c b/2.3-1/src/c/signalProcessing/transforms/dct/sdcta.c deleted file mode 100644 index 9f380e8b..00000000 --- a/2.3-1/src/c/signalProcessing/transforms/dct/sdcta.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Ukasha Noor - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - - -#include "dct.h" -/*#include <fftw3.h>*/ -#include <math.h> - -void sdcta(float *in,int row,int col,int sign,float *out) -{ - int i,j,k,u,v; - int n; - int x,y; - float res,ress; - float re,z,q,m; - if(sign==-1) - { - if(row==1) - { - n=col; - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - out[x]+=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); - } - } - if(x==0) - out[x]*=1./(sqrt(n)); - else - { - float res=2./n; - out[x]*=sqrt(res); - } - } - } - } - else - { - n=col*row; - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - re=0; - for(j=0;j<col;j++) - { - m=(float)in[j*row+i]; - z=(float)(((float)j+1.0/2.0)*(float)v); - q=(float)(M_PI/(float)col); - re+=m*(cos(q*z)); - } - z=(float)(((float)i+1.0/2.0)*(float)u); - q=(float)(M_PI/(float)row); - out[x]+=re*(cos(q*z)); - } - if(u==0) - { - out[x]/=sqrt((float)row); - if(v==0) - out[x]/=sqrt((float)col); - else - out[x]*=sqrt(2./col); - } - else - { - out[x]*=sqrt(2./row); - if(v==0) - out[x]/=sqrt((float)col); - else - out[x]*=sqrt(2./col); - } - } - } - - } - } - else if(sign==1) - { - n=col; - if(row==1) - { - res=1./sqrt(n); - ress=sqrt(2./n); - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - if(y==0) - out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); - else - out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); - } - } - } - - } - } - else - { - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - re=0; - for(j=0;j<col;j++) - { - y=row*j+i; - m=(float)in[j*row+i]; - z=(float)(((float)v+1.0/2.0)*(float)j); - q=(float)(M_PI/(float)col); - m=m*(cos(q*z)); - if(j==0) - re+=m/sqrt((float)col); - else - re+=m*sqrt(2./col); - } - z=(float)(((float)u+1.0/2.0)*(float)i); - q=(float)(M_PI/(float)row); - if(i==0) - out[x]+=(re*(cos(z*q)))/sqrt((float)row); - else - out[x]+=(re*(cos(z*q))*sqrt(2./row)); - } - } - } - } - } -} diff --git a/2.3-1/src/c/signalProcessing/transforms/dct/zdcta.c b/2.3-1/src/c/signalProcessing/transforms/dct/zdcta.c deleted file mode 100644 index 3ae2e333..00000000 --- a/2.3-1/src/c/signalProcessing/transforms/dct/zdcta.c +++ /dev/null @@ -1,230 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Ukasha Noor - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - - -#include "dct.h" -#include "addition.h" -#include "types.h" -#include "doubleComplex.h" -#include "multiplication.h" -/*#include "matrixMultiplication"*/ -/*#include <fftw3.h>*/ -#include <math.h> - -void zdcta(doubleComplex *in,int row,int col,int sign,doubleComplex *out) -{ - int i,j,k,u,v; - int n; - int x,y; - double res,ress,vv,ff; - double re,z,q,m; - doubleComplex accu = DoubleComplex(0, 0); - doubleComplex temp,mm,aa,bb,cc; - if(sign==-1) - { - if(row==1) - { - n=col; - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=DoubleComplex(0,0); - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - vv = cos(((M_PI)*(y+1-1./2.)*(x))/n); - aa = DoubleComplex(vv,0); - temp=zmuls(in[y],aa); - out[x]=zadds(out[x],temp); - } - } - if(x==0) - { - vv = 1./(sqrt(n)); - aa = DoubleComplex(vv,0); - out[x]=zmuls(out[x],aa); - } - else - { - double res=2./n; - res = sqrt(res); - aa = DoubleComplex(res,0); - out[x]=zmuls(out[x],aa); - } - } - } - } - else - { - n=col*row; - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=DoubleComplex(0,0); - for(i=0;i<row;i++) - { - temp=DoubleComplex(0,0); - mm=DoubleComplex(0,0); - for(j=0;j<col;j++) - { - y=j*row+i; - z=(double )(((double )j+1.0/2.0)*(double )v); - q=(double )(M_PI/(double )col); - vv = cos(q*z); - aa = DoubleComplex(vv,0); - mm=zmuls(in[y],aa); - temp=zadds(temp,mm); - } - z=(double )(((double )i+1.0/2.0)*(double )u); - q=(double )(M_PI/(double )row); - ff = cos(q*z); - bb = DoubleComplex(ff,0); - temp=zmuls(temp,bb); - out[x]=zadds(out[x],temp); - } - if(u==0) - { - vv = 1./sqrt((double )row); - aa = DoubleComplex(vv,0); - out[x]=zmuls(out[x],aa); - if(v==0) - { - vv = 1./sqrt((double )col); - aa = DoubleComplex(vv,0); - out[x]=zmuls(out[x],aa); - } - else - { - vv = sqrt(2./col); - aa = DoubleComplex(vv,0); - out[x]=zmuls(out[x],aa); - } - } - else - { - vv = sqrt(2./row); - aa = DoubleComplex(vv,0); - out[x]=zmuls(out[x],aa); - if(v==0) - { - vv = 1./sqrt((double )col); - aa = DoubleComplex(vv,0); - out[x]=zmuls(out[x],aa); - } - else - { - vv = sqrt(2./col); - aa = DoubleComplex(vv,0); - out[x]=zmuls(out[x],aa); - } - } - } - } - } - } - else if(sign==1) - { - n=col; - if(row==1) - { - res=1./sqrt(n); - ress=sqrt(2./n); - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=DoubleComplex(0,0); - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - if(y==0) - { - q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); - aa = DoubleComplex(q,0); - out[x]=zadds(out[x],zmuls(in[y],aa)); - } - else - { - q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); - aa = DoubleComplex(q,0); - out[x]=zadds(out[x],zmuls(in[y],aa)); - } - } - } - } - - } - } - else - { - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=DoubleComplex(0,0); - for(i=0;i<row;i++) - { - re=0; - mm=DoubleComplex(0,0); - temp=DoubleComplex(0,0); - for(j=0;j<col;j++) - { - y=row*j+i; - mm=in[j*row+i]; - z=(double )(((double )v+1.0/2.0)*(double )j); - q=(double )(M_PI/(double )col); - vv = cos(q*z); - aa = DoubleComplex(vv,0); - mm=zmuls(mm,aa); - if(j==0) - { - vv = 1./sqrt((double )col); - aa = DoubleComplex(vv,0); - temp=zadds(temp,zmuls(mm,aa)); - } - else - { - vv = sqrt(2./col); - aa = DoubleComplex(vv,0); - temp=zadds(temp,zmuls(mm,aa)); - } - } - z=(double )(((double )u+1.0/2.0)*(double )i); - q=(double )(M_PI/(double )row); - if(i==0) - { - vv = (cos(z*q))*(1./sqrt(row)); - aa = DoubleComplex(vv,0); - out[x]=zadds(out[x],zmuls(temp,aa)); - } - else - { - vv = (cos(z*q))*sqrt(2./row); - aa = DoubleComplex(vv,0); - out[x]=zadds(out[x],zmuls(temp,aa)); - } - } - } - } - } - } -} diff --git a/2.3-1/src/c/signalProcessing/transforms/idct/cidcta.c b/2.3-1/src/c/signalProcessing/transforms/idct/cidcta.c deleted file mode 100644 index ae98ba19..00000000 --- a/2.3-1/src/c/signalProcessing/transforms/idct/cidcta.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Ukasha Noor - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - - -#include "idct.h" -#include "addition.h" -#include "types.h" -#include "floatComplex.h" -#include "multiplication.h" -/*#include "matrixMultiplication"*/ -/*#include <fftw3.h>*/ -#include <math.h> - -void cidcta(floatComplex *in,int row,int col,floatComplex *out) -{ - int i,j,k,u,v; - int n=col; - int x,y; - float res,ress,vv,ff; - float re,z,q,m; - floatComplex accu = FloatComplex(0, 0); - floatComplex temp,mm,aa,bb; - if(row==1) - { - res=1./sqrt(n); - ress=sqrt(2./n); - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=FloatComplex(0,0); - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - if(y==0) - { - q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); - aa=FloatComplex(q,0); - out[x]=cadds(out[x],cmuls(in[y],aa)); - } - else - { - q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); - aa=FloatComplex(q,0); - out[x]=cadds(out[x],cmuls(in[y],aa)); - } - } - } - } - - } - } - else - { - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=FloatComplex(0,0); - for(i=0;i<row;i++) - { - re=0; - mm=FloatComplex(0,0); - temp=FloatComplex(0,0); - for(j=0;j<col;j++) - { - y=row*j+i; - mm=in[j*row+i]; - z=(float)(((float)v+1.0/2.0)*(float)j); - q=(float)(M_PI/(float)col); - vv=cos(q*z); - aa=FloatComplex(vv,0); - mm=cmuls(mm,aa); - if(j==0) - { - vv=1./sqrt((float)col); - aa=FloatComplex(vv,0); - temp=cadds(temp,cmuls(mm,aa)); - } - else - { - vv=sqrt(2./col); - aa=FloatComplex(vv,0); - temp=cadds(temp,cmuls(mm,aa)); - } - } - z=(float)(((float)u+1.0/2.0)*(float)i); - q=(float)(M_PI/(float)row); - if(i==0) - { - vv=(cos(z*q))*(1./sqrt(row)); - aa=FloatComplex(vv,0); - out[x]=cadds(out[x],cmuls(temp,aa)); - } - else - { - vv=(cos(z*q))*sqrt(2./row); - aa=FloatComplex(vv,0); - out[x]=cadds(out[x],cmuls(temp,aa)); - } - } - } - } - } -} diff --git a/2.3-1/src/c/signalProcessing/transforms/idct/didcta.c b/2.3-1/src/c/signalProcessing/transforms/idct/didcta.c deleted file mode 100644 index 5f475160..00000000 --- a/2.3-1/src/c/signalProcessing/transforms/idct/didcta.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Ukasha Noor - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - - -#include "idct.h" -/*#include <fftw3.h>*/ -#include <math.h> - -void didcta(double *in,int row,int col,double *out) -{ - int i,j,k,u,v; - int n=col; - int x,y; - double res,ress; - double re,z,q,m; - if(row==1) - { - res=1./sqrt(n); - ress=sqrt(2./n); - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - if(y==0) - out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); - else - out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); - } - } - } - - } - } - else - { - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - re=0; - for(j=0;j<col;j++) - { - y=row*j+i; - m=(double)in[j*row+i]; - z=(double)(((double)v+1.0/2.0)*(double)j); - q=(double)(M_PI/(double)col); - m=m*(cos(q*z)); - if(j==0) - re+=m/sqrt((double)col); - else - re+=m*sqrt(2./col); - } - z=(double)(((double)u+1.0/2.0)*(double)i); - q=(double)(M_PI/(double)row); - if(i==0) - out[x]+=(re*(cos(z*q)))/sqrt((double)row); - else - out[x]+=(re*(cos(z*q))*sqrt(2./row)); - } - } - } - } -} diff --git a/2.3-1/src/c/signalProcessing/transforms/idct/sidcta.c b/2.3-1/src/c/signalProcessing/transforms/idct/sidcta.c deleted file mode 100644 index 62f85da0..00000000 --- a/2.3-1/src/c/signalProcessing/transforms/idct/sidcta.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Ukasha Noor - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - - -#include "idct.h" -/*#include <fftw3.h>*/ -#include <math.h> - -void sidcta(float *in,int row,int col,float *out) -{ - int i,j,k,u,v; - int n=col; - int x,y; - float res,ress; - float re,z,q,m; - if(row==1) - { - res=1./sqrt(n); - ress=sqrt(2./n); - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - if(y==0) - out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); - else - out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); - } - } - } - - } - } - else - { - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=0; - for(i=0;i<row;i++) - { - re=0; - for(j=0;j<col;j++) - { - y=row*j+i; - m=(float)in[j*row+i]; - z=(float)(((float)v+1.0/2.0)*(float)j); - q=(float)(M_PI/(float)col); - m=m*(cos(q*z)); - if(j==0) - re+=m/sqrt((float)col); - else - re+=m*sqrt(2./col); - } - z=(float)(((float)u+1.0/2.0)*(float)i); - q=(float)(M_PI/(float)row); - if(i==0) - out[x]+=(re*(cos(z*q)))/sqrt((float)row); - else - out[x]+=(re*(cos(z*q))*sqrt(2./row)); - } - } - } - } -} diff --git a/2.3-1/src/c/signalProcessing/transforms/idct/zidcta.c b/2.3-1/src/c/signalProcessing/transforms/idct/zidcta.c deleted file mode 100644 index cc01c966..00000000 --- a/2.3-1/src/c/signalProcessing/transforms/idct/zidcta.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright (C) 2016 - IIT Bombay - FOSSEE - - This file must be used under the terms of the CeCILL. - This source file is licensed as described in the file COPYING, which - you should have received as part of this distribution. The terms - are also available at - http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - Author: Ukasha Noor - Organization: FOSSEE, IIT Bombay - Email: toolbox@scilab.in -*/ - - -#include "idct.h" -#include "addition.h" -#include "types.h" -#include "doubleComplex.h" -#include "multiplication.h" -/*#include "matrixMultiplication"*/ -/*#include <fftw3.h>*/ -#include <math.h> - -void zidcta(doubleComplex *in,int row,int col,doubleComplex *out) -{ - int i,j,k,u,v; - int n=col; - int x,y; - double res,ress,vv,ff; - double re,z,q,m; - doubleComplex accu = DoubleComplex(0, 0); - doubleComplex temp,mm,aa,bb; - if(row==1) - { - res=1./sqrt(n); - ress=sqrt(2./n); - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=DoubleComplex(0,0); - for(i=0;i<row;i++) - { - for(j=0;j<col;j++) - { - y=row*j+i; - if(y==0) - { - q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); - aa=DoubleComplex(q,0); - out[x]=zadds(out[x],zmuls(in[y],aa)); - } - else - { - q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); - aa=DoubleComplex(q,0); - out[x]=zadds(out[x],zmuls(in[y],aa)); - } - } - } - } - - } - } - else - { - for(u=0;u<row;u++) - { - for(v=0;v<col;v++) - { - x=v*row+u; - out[x]=DoubleComplex(0,0); - for(i=0;i<row;i++) - { - re=0; - mm=DoubleComplex(0,0); - temp=DoubleComplex(0,0); - for(j=0;j<col;j++) - { - y=row*j+i; - mm=in[j*row+i]; - z=(double)(((double)v+1.0/2.0)*(double)j); - q=(double)(M_PI/(double)col); - vv=cos(q*z); - aa=DoubleComplex(vv,0); - mm=zmuls(mm,aa); - if(j==0) - { - vv=1./sqrt((double)col); - aa=DoubleComplex(vv,0); - temp=zadds(temp,zmuls(mm,aa)); - } - else - { - vv=sqrt(2./col); - aa=DoubleComplex(vv,0); - temp=zadds(temp,zmuls(mm,aa)); - } - } - z=(double)(((double)u+1.0/2.0)*(double)i); - q=(double)(M_PI/(double)row); - if(i==0) - { - vv=(cos(z*q))*(1./sqrt(row)); - aa=DoubleComplex(vv,0); - out[x]=zadds(out[x],zmuls(temp,aa)); - } - else - { - vv=(cos(z*q))*sqrt(2./row); - aa=DoubleComplex(vv,0); - out[x]=zadds(out[x],zmuls(temp,aa)); - } - } - } - } - } -} |