Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-10 03:27:04 +0400
committerMichael Niedermayer <michaelni@gmx.at>2013-01-10 03:27:04 +0400
commit0b60fc94aab63b80b3a898c744da50758215bc9c (patch)
treeb4d13a99cbede920f983452092ba3d00ccb8888b /libswresample/dither_template.c
parentead3a2a37e67de617cad33b7e9bdb8ade6ed220f (diff)
swr: reorder the operations in the noise shaping code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/dither_template.c')
-rw-r--r--libswresample/dither_template.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libswresample/dither_template.c b/libswresample/dither_template.c
index ffa5bdd664..3388aadc56 100644
--- a/libswresample/dither_template.c
+++ b/libswresample/dither_template.c
@@ -34,12 +34,13 @@ void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *srcs, AudioData *noise
DELEM *data = (DELEM*)srcs->ch[ch];
pos = s->dither.ns_pos;
for (i=0; i<count; i++) {
- double d1, d = data[i];
+ double d1, d = data[i]*S_1;
for(j=0; j<taps; j++)
d -= s->dither.ns_coeffs[j] * s->dither.ns_errors[ch][pos + j];
pos = pos ? pos - 1 : pos - 1 + taps;
- d1 = rint((d + noise[i]) * S_1)*S;
+ d1 = rint(d + noise[i]);
s->dither.ns_errors[ch][pos + taps] = s->dither.ns_errors[ch][pos] = d1 - d;
+ d1 *= S;
CLIP(d1);
data[i] = d1;
}