static void mdct512(AC3MDCTContext *mdct, CoefType *out, SampleType *in);
-static void apply_window(SampleType *output, const SampleType *input,
+static void apply_window(DSPContext *dsp, SampleType *output, const SampleType *input,
const SampleType *window, int n);
static int normalize_samples(AC3EncodeContext *s);
AC3Block *block = &s->blocks[blk];
const SampleType *input_samples = &s->planar_samples[ch][blk * AC3_BLOCK_SIZE];
- apply_window(s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE);
+ apply_window(&s->dsp, s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE);
block->exp_shift[ch] = normalize_samples(s);
/**
* Apply KBD window to input samples prior to MDCT.
*/
-static void apply_window(int16_t *output, const int16_t *input,
+static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input,
const int16_t *window, int n)
{
int i;
int nbits)
{
float *window;
- int n, n2;
+ int i, n, n2;
n = 1 << nbits;
n2 = n >> 1;
- window = av_malloc(n2 * sizeof(*window));
+ window = av_malloc(n * sizeof(*window));
if (!window) {
av_log(avctx, AV_LOG_ERROR, "Cannot allocate memory.\n");
return AVERROR(ENOMEM);
}
ff_kbd_window_init(window, 5.0, n2);
+ for (i = 0; i < n2; i++)
+ window[n-1-i] = window[i];
mdct->window = window;
return ff_mdct_init(&mdct->fft, nbits, 0, -2.0 / n);
/**
* Apply KBD window to input samples prior to MDCT.
*/
-static void apply_window(float *output, const float *input,
+static void apply_window(DSPContext *dsp, float *output, const float *input,
const float *window, int n)
{
- int i;
- int n2 = n >> 1;
-
- for (i = 0; i < n2; i++) {
- output[i] = input[i] * window[i];
- output[n-i-1] = input[n-i-1] * window[i];
- }
+ dsp->vector_fmul(output, input, window, n);
}