audioamplify: Fix off-by-one in wrap-positive mode

This commit is contained in:
Sebastian Dröge 2009-06-19 22:37:27 +02:00
parent afccf53ace
commit ffe64fb934

View file

@ -176,10 +176,10 @@ gst_audio_amplify_transform_##type##_wrap_negative (GstAudioAmplify * filter, \
while (num_samples--) { \ while (num_samples--) { \
glong val = *d * filter->amplification; \ glong val = *d * filter->amplification; \
if (val > MAX_##type) \ if (val > MAX_##type) \
val = MIN_##type + (val - MIN_##type) % ((glong) MAX_##type - \ val = MIN_##type + (val - MIN_##type) % ((glong) MAX_##type + 1 - \
MIN_##type); \ MIN_##type); \
else if (val < MIN_##type) \ else if (val < MIN_##type) \
val = MAX_##type - (MAX_##type - val) % ((glong) MAX_##type - \ val = MAX_##type - (MAX_##type - val) % ((glong) MAX_##type + 1 - \
MIN_##type); \ MIN_##type); \
*d++ = val; \ *d++ = val; \
} \ } \