summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2013-01-12 18:11:08 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2013-01-12 18:17:08 (GMT)
commitc8737d348be526d6403856f424a73ad1c81b157f (patch)
treec870b7cbcb80791bb29c3283c5cc579b8e08a642
parent93bc0f0180391dd05a5ee35d5b776ab13ac81ab9 (diff)
downloadffmpeg-c8737d348be526d6403856f424a73ad1c81b157f.zip
ffmpeg-c8737d348be526d6403856f424a73ad1c81b157f.tar.gz
ffmpeg-c8737d348be526d6403856f424a73ad1c81b157f.tar.bz2
swr: work with 4 noise shaping coeffs at a time
63->38 kcycles Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--libswresample/dither_template.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libswresample/dither_template.c b/libswresample/dither_template.c
index 8cf0c57..ecbe55c 100644
--- a/libswresample/dither_template.c
+++ b/libswresample/dither_template.c
@@ -29,6 +29,9 @@ void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData
float S = s->dither.ns_scale;
float S_1 = s->dither.ns_scale_1;
+ av_assert2((taps&3) != 2);
+ av_assert2((taps&3) != 3 || s->dither.ns_coeffs[taps] == 0);
+
for (ch=0; ch<srcs->ch_count; ch++) {
const float *noise = ((const float *)noises->ch[ch]) + s->dither.noise_pos;
const DELEM *src = (const DELEM*)srcs->ch[ch];
@@ -38,7 +41,13 @@ void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData
pos = s->dither.ns_pos;
for (i=0; i<count; i++) {
double d1, d = src[i]*S_1;
- for(j=0; j<taps; j++)
+ for(j=0; j<taps-2; j+=4) {
+ d -= ns_coeffs[j ] * ns_errors[pos + j ]
+ +ns_coeffs[j + 1] * ns_errors[pos + j + 1]
+ +ns_coeffs[j + 2] * ns_errors[pos + j + 2]
+ +ns_coeffs[j + 3] * ns_errors[pos + j + 3];
+ }
+ if(j < taps)
d -= ns_coeffs[j] * ns_errors[pos + j];
pos = pos ? pos - 1 : taps - 1;
d1 = rint(d + noise[i]);