summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyler Jones <tdjones879@gmail.com>2017-05-30 09:14:36 -0600
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-06-05 16:35:03 +0100
commit79941602a317b45dcf3d1c4d700fe4678e02a0fe (patch)
treeaa63494865a091c00523b482226c46dc5e6adba1
parent610864dc36e2c485b4508b774b0199e67e9e8999 (diff)
downloadffmpeg-streaming-79941602a317b45dcf3d1c4d700fe4678e02a0fe.zip
ffmpeg-streaming-79941602a317b45dcf3d1c4d700fe4678e02a0fe.tar.gz
avcodec/vorbisenc: Use fdsp for applying windows
Using fdsp improves readability and allows using architecture-specific optimizations. Signed-off-by: Tyler Jones <tdjones879@gmail.com>
-rw-r--r--libavcodec/vorbisenc.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index 7c3cd51..1777a49 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -988,11 +988,11 @@ static int residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
static int apply_window_and_mdct(vorbis_enc_context *venc,
float **audio, int samples)
{
- int i, channel;
+ int channel;
const float * win = venc->win[0];
int window_len = 1 << (venc->log2_blocksize[0] - 1);
float n = (float)(1 << venc->log2_blocksize[0]) / 4.0;
- // FIXME use dsp
+ AVFloatDSPContext *fdsp = venc->fdsp;
if (!venc->have_saved && !samples)
return 0;
@@ -1009,9 +1009,10 @@ static int apply_window_and_mdct(vorbis_enc_context *venc,
if (samples) {
for (channel = 0; channel < venc->channels; channel++) {
- float * offset = venc->samples + channel*window_len*2 + window_len;
- for (i = 0; i < samples; i++)
- offset[i] = audio[channel][i] / n * win[window_len - i - 1];
+ float *offset = venc->samples + channel * window_len * 2 + window_len;
+
+ fdsp->vector_fmul_reverse(offset, audio[channel], win, samples);
+ fdsp->vector_fmul_scalar(offset, offset, 1/n, samples);
}
} else {
for (channel = 0; channel < venc->channels; channel++)
@@ -1026,8 +1027,9 @@ static int apply_window_and_mdct(vorbis_enc_context *venc,
if (samples) {
for (channel = 0; channel < venc->channels; channel++) {
float *offset = venc->saved + channel * window_len;
- for (i = 0; i < samples; i++)
- offset[i] = audio[channel][i] / n * win[i];
+
+ fdsp->vector_fmul(offset, audio[channel], win, samples);
+ fdsp->vector_fmul_scalar(offset, offset, 1/n, samples);
}
venc->have_saved = 1;
} else {
OpenPOWER on IntegriCloud