69 for (
int i = 0; i < (n / 2); i++)
70 _csc2[i] = 0.5 / sin((
M_PI / (2 * n) * (2 * i + 1)));
97 #define SIN(n,x) (_tCos[(n) - (x)]) 99 #define COS(n,x) (_tCos[x]) 104 float next = -0.5f * (data[0] - data[n]);
106 for (
int i = 0; i < (n / 2); i++) {
107 float tmp1 = data[i ];
108 float tmp2 = data[n - i];
110 float s =
SIN(n, 2 * i);
111 float c =
COS(n, 2 * i);
118 tmp1 = (tmp1 + tmp2) * 0.5f;
121 data[n - i] = tmp1 + s;
129 for (
int i = 3; i <= n; i += 2)
130 data[i] = data[i - 2] - data[i];
136 for (
int i = 0; i < (n / 2); i++) {
137 float tmp1 = data[i ];
138 float tmp2 = data[n - i - 1];
140 float s =
SIN(n, 2 * i + 1);
144 tmp1 = (tmp1 + tmp2) * 0.5f;
147 data[n-i-1] = tmp1 - s;
152 float next = data[1] * 0.5f;
156 for (
int i = n - 2; i >= 0; i -= 2) {
157 float inr = data[i ];
158 float ini = data[i + 1];
163 data[i ] = c * inr + s * ini;
166 next += s * inr - c * ini;
173 float next = data[n - 1];
174 float inv_n = 1.0f / n;
176 for (
int i = n - 2; i >= 2; i -= 2) {
177 float val1 = data[i ];
178 float val2 = data[i - 1] - data[i + 1];
183 data[i ] = c * val1 + s * val2;
184 data[i + 1] = s * val1 - c * val2;
191 for (
int i = 0; i < (n / 2); i++) {
192 float tmp1 = data[i ] * inv_n;
193 float tmp2 = data[n - i - 1] * inv_n;
195 float csc =
_csc2[i] * (tmp1 - tmp2);
199 data[i ] = tmp1 + csc;
200 data[n - i - 1] = tmp1 - csc;
209 for (
int i = 1; i < (n / 2); i++) {
210 float tmp1 = data[i ];
211 float tmp2 = data[n - i];
212 float s =
SIN(n, 2 * i);
215 tmp1 = (tmp1 - tmp2) * 0.5f;
218 data[n - i] = s - tmp1;
227 for (
int i = 1; i < (n - 2); i += 2) {
228 data[i + 1] += data[i - 1];
229 data[i ] = -data[i + 2];
void reset(PointerType o=0)
Resets the pointer with the new value.
ScopedArray< float > _csc2
void calcDSTI(float *data)
(Inverse) Discrete Cosine Transforms.
void calcDCTIII(float *data)
DCT(int bits, TransformType trans)
(Inverse) Real Discrete Fourier Transform.
const float * getCosineTable(int bits)
void calcDCTI(float *data)
(Inverse) Real Discrete Fourier Transform.
void calcDCTII(float *data)