struct fft_context {
int nbits;
- int inverse;
uint16_t *revtab;
struct fft_complex *exptab;
};
ff_cos_16384, ff_cos_32768, ff_cos_65536,
};
-static int split_radix_permutation(int i, int n, int inverse)
+static int split_radix_permutation(int i, int n)
{
int m;
if (n <= 2)
return i & 1;
m = n >> 1;
- if (!(i & m))
- return split_radix_permutation(i, m, inverse) * 2;
+ if ((i & m) == 0)
+ return split_radix_permutation(i, m) * 2;
m >>= 1;
- if (inverse == !(i & m))
- return split_radix_permutation(i, m, inverse) * 4 + 1;
+ if ((i & m) == 0)
+ return split_radix_permutation(i, m) * 4 + 1;
else
- return split_radix_permutation(i, m, inverse) * 4 - 1;
+ return split_radix_permutation(i, m) * 4 - 1;
}
#define SQRTHALF (float)0.70710678118654752440 /* 1/sqrt(2) */
}
}
-static int fft_init(struct fft_context *s, int nbits, int inverse)
+static int fft_init(struct fft_context *s, int nbits)
{
int i, j, n;
s->exptab = para_malloc((n / 2) * sizeof(struct fft_complex));
s->revtab = para_malloc(n * sizeof(uint16_t));
- s->inverse = inverse;
for (j = 4; j <= nbits; j++) {
int k = 1 << j;
double freq = 2 * M_PI / k;
tab[k / 2 - i] = tab[i];
}
for (i = 0; i < n; i++)
- s->revtab[-split_radix_permutation(
- i, n, s->inverse) & (n - 1)] = i;
+ s->revtab[-split_radix_permutation(i, n) & (n - 1)] = i;
return 0;
}
}
/**
- * Init MDCT or IMDCT computation.
+ * Initialize the inverse modified cosine transform.
*/
-int imdct_init(int nbits, int inverse, struct mdct_context **result)
+int imdct_init(int nbits, struct mdct_context **result)
{
int ret, n, n4, i;
double alpha;
s->tcos[i] = -cos(alpha);
s->tsin[i] = -sin(alpha);
}
- ret = fft_init(&s->fft, s->nbits - 2, inverse);
+ ret = fft_init(&s->fft, s->nbits - 2);
if (ret < 0)
goto fail;
*result = s;