diff options
author | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-07-14 04:50:07 +0100 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-07-14 04:54:32 +0100 |
commit | 91b27b83939a73b7313440f79512549b5b8ff7c1 (patch) | |
tree | 93e7ca2a6a81dc7d330f84fd14cf35487b200678 /libavcodec | |
parent | 390e028c663bbfddc140bcff5acc978d443ea5c4 (diff) | |
download | ffmpeg-91b27b83939a73b7313440f79512549b5b8ff7c1.tar.gz |
opusenc: use float_dsp for non-transient windowing
Also fixes transient windowing
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/opusenc.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/opusenc.c b/libavcodec/opusenc.c index 6cefd33884..547c62cf6b 100644 --- a/libavcodec/opusenc.c +++ b/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); } |