opusenc: use float_dsp for non-transient windowing

Also fixes transient windowing

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
pull/265/head
Rostislav Pehlivanov 8 years ago
parent 390e028c66
commit 91b27b8393
  1. 24
      libavcodec/opusenc.c

@ -208,7 +208,7 @@ static void celt_apply_preemph_filter(OpusEncContext *s, CeltFrame *f)
static void celt_frame_mdct(OpusEncContext *s, CeltFrame *f)
{
int i, t, ch;
float *win = s->scratch;
float *win = s->scratch, *temp = s->scratch + 1920;
if (f->transient) {
for (ch = 0; ch < f->channels; ch++) {
@ -216,9 +216,9 @@ static void celt_frame_mdct(OpusEncContext *s, CeltFrame *f)
float *src1 = b->overlap;
for (t = 0; t < f->blocks; t++) {
float *src2 = &b->samples[CELT_OVERLAP*t];
s->dsp->vector_fmul(win, src1, ff_celt_window, CELT_OVERLAP);
s->dsp->vector_fmul(win, src1, ff_celt_window, 128);
s->dsp->vector_fmul_reverse(&win[CELT_OVERLAP], src2,
ff_celt_window - 8, CELT_OVERLAP + 8);
ff_celt_window - 8, 128);
src1 = src2;
s->mdct[0]->mdct(s->mdct[0], b->coeffs + t, win, f->blocks);
}
@ -226,21 +226,21 @@ static void celt_frame_mdct(OpusEncContext *s, CeltFrame *f)
} else {
int blk_len = OPUS_BLOCK_SIZE(f->size), wlen = OPUS_BLOCK_SIZE(f->size + 1);
int rwin = blk_len - CELT_OVERLAP, lap_dst = (wlen - blk_len - CELT_OVERLAP) >> 1;
memset(win, 0, wlen*sizeof(float));
for (ch = 0; ch < f->channels; ch++) {
CeltBlock *b = &f->block[ch];
memset(win, 0, wlen*sizeof(float));
/* Overlap */
s->dsp->vector_fmul(temp, b->overlap, ff_celt_window, 128);
memcpy(win + lap_dst, temp, CELT_OVERLAP*sizeof(float));
/* Samples, flat top window */
memcpy(&win[lap_dst + CELT_OVERLAP], b->samples, rwin*sizeof(float));
/* Alignment fucks me over */
//s->dsp->vector_fmul(&dst[lap_dst], b->overlap, ff_celt_window, CELT_OVERLAP);
//s->dsp->vector_fmul_reverse(&dst[lap_dst + blk_len - CELT_OVERLAP], b->samples, ff_celt_window, CELT_OVERLAP);
for (i = 0; i < CELT_OVERLAP; i++) {
win[lap_dst + i] = b->overlap[i] *ff_celt_window[i];
win[lap_dst + blk_len + i] = b->samples[rwin + i]*ff_celt_window[CELT_OVERLAP - i - 1];
}
/* Samples, windowed */
s->dsp->vector_fmul_reverse(temp, b->samples + rwin,
ff_celt_window - 8, 128);
memcpy(win + lap_dst + blk_len, temp, CELT_OVERLAP*sizeof(float));
s->mdct[f->size]->mdct(s->mdct[f->size], b->coeffs, win, 1);
}

Loading…
Cancel
Save