summaryrefslogtreecommitdiff
path: root/libswresample/dither_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-10 18:06:19 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-10 18:06:19 +0100
commit558aa6cab7ff7d5ca444a94f8d9637f4c9259418 (patch)
treece0670404af647d371b8f483ebcecc73fb462de4 /libswresample/dither_template.c
parentfca51256d4f4b432f551d24b20570cc79a34d1f8 (diff)
swr: add seperate in/out pointers to 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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libswresample/dither_template.c b/libswresample/dither_template.c
index b98391be89..4d0074b531 100644
--- a/libswresample/dither_template.c
+++ b/libswresample/dither_template.c
@@ -23,7 +23,7 @@
ERROR
#endif
-void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *srcs, AudioData *noises, int count){
+void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, AudioData *noises, int count){
int i, j, pos, ch;
int taps = s->dither.ns_taps;
float S = s->dither.ns_scale;
@@ -31,10 +31,11 @@ void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *srcs, AudioData *noise
for (ch=0; ch<srcs->ch_count; ch++) {
const float *noise = ((const float *)noises->ch[ch]) + s->dither.noise_pos;
- DELEM *data = (DELEM*)srcs->ch[ch];
+ const DELEM *src = (const DELEM*)srcs->ch[ch];
+ DELEM *dst = (DELEM*)dsts->ch[ch];
pos = s->dither.ns_pos;
for (i=0; i<count; i++) {
- double d1, d = data[i]*S_1;
+ double d1, d = src[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;
@@ -42,7 +43,7 @@ void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *srcs, AudioData *noise
s->dither.ns_errors[ch][pos + taps] = s->dither.ns_errors[ch][pos] = d1 - d;
d1 *= S;
CLIP(d1);
- data[i] = d1;
+ dst[i] = d1;
}
}