/* cos((M_PI * x / (2*n)) */
#define COS(s,n,x) (s->costab[x])
-static void ff_dct_calc_c(DCTContext *ctx, FFTSample *data)
+static void ff_dct_calc_III_c(DCTContext *ctx, FFTSample *data)
{
int n = 1 << ctx->nbits;
int i;
- if (ctx->inverse) {
float next = data[n - 1];
float inv_n = 1.0f / n;
data[i ] = tmp1 + csc;
data[n - i - 1] = tmp1 - csc;
}
- } else {
+}
+
+static void ff_dct_calc_II_c(DCTContext *ctx, FFTSample *data)
+{
+ int n = 1 << ctx->nbits;
+ int i;
float next;
for (i=0; i < n/2; i++) {
float tmp1 = data[i ];
next += s * inr - c * ini;
}
- }
}
void ff_dct_calc(DCTContext *s, FFTSample *data)
for (i = 0; i < n/2; i++)
s->csc2[i] = 0.5 / sin((M_PI / (2*n) * (2*i + 1)));
- s->dct_calc = ff_dct_calc_c;
+ if(inverse) {
+ s->dct_calc = ff_dct_calc_III_c;
+ } else
+ s->dct_calc = ff_dct_calc_II_c;
return 0;
}