Commit d556ae21 authored by Martin Reinecke's avatar Martin Reinecke

cleanup DCT/DST, part 1

parent 656b2373
......@@ -2342,16 +2342,6 @@ template<typename T0> class T_dct2
{
constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L);
size_t N=length();
if (N==1)
c[0]*=2*fct;
else if (N==2)
{
T x1 = 2*fct*(c[0]+c[1]);
c[1] = sqrt2*fct*(c[0]-c[1]);
c[0] = x1;
}
else
{
size_t NS2 = (N+1)/2;
for (size_t i=2; i<N; i+=2)
{
......@@ -2375,7 +2365,6 @@ template<typename T0> class T_dct2
c[k] = tmp;
}
c[0] *= 2;
}
if (ortho) c[0]/=sqrt2;
}
......@@ -2402,16 +2391,6 @@ template<typename T0> class T_dct3
constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L);
size_t N=length();
if (ortho) c[0]*=sqrt2;
if (N==1)
c[0]*=fct;
else if (N==2)
{
T TSQX = sqrt2*c[1];
c[1] = fct*(c[0]-TSQX);
c[0] = fct*(c[0]+TSQX);
}
else
{
size_t NS2 = (N+1)/2;
for (size_t k=1, kc=N-1; k<NS2; ++k, --kc)
{
......@@ -2437,7 +2416,6 @@ template<typename T0> class T_dct3
c[i-1] = xim1;
}
}
}
size_t length() const { return fftplan.length(); }
};
......@@ -2577,16 +2555,11 @@ template<typename T0> class T_dst2
{
constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L);
size_t N=length();
if (N==1)
c[0]*=2*fct;
else
{
for (size_t k=1; k<N; k+=2)
c[k] = -c[k];
dct.exec(c, fct, false);
for (size_t k=0, kc=N-1; k<kc; ++k, --kc)
swap(c[k], c[kc]);
}
if (ortho) c[0]/=sqrt2;
}
......@@ -2607,10 +2580,6 @@ template<typename T0> class T_dst3
constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L);
size_t N=length();
if (ortho) c[0]*=sqrt2;
if (N==1)
c[0]*=fct;
else
{
size_t NS2 = N/2;
for (size_t k=0, kc=N-1; k<NS2; ++k, --kc)
swap(c[k], c[kc]);
......@@ -2618,7 +2587,6 @@ template<typename T0> class T_dst3
for (size_t k=1; k<N; k+=2)
c[k] = -c[k];
}
}
size_t length() const { return dct.length(); }
};
......@@ -2635,7 +2603,6 @@ template<typename T0> class T_dst4
template<typename T> POCKETFFT_NOINLINE void exec(T c[], T0 fct, bool /*ortho*/)
{
size_t N=length();
//if (N==1) { c[0]*=fct; return; }
size_t NS2 = N/2;
for (size_t k=0, kc=N-1; k<NS2; ++k, --kc)
swap(c[k], c[kc]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment