summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-03-12 15:47:40 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-03-12 15:49:17 +0100
commit944d6b1786f64b84947b7b71b858653c6acc0fd7 (patch)
tree3c7b2f62994778971a0a914b45139bdd7556949a
parentbaf2fc1c58a9e383d6de0311137ddd521d4ce1e4 (diff)
volume: Revert rounding behaviour changes when using controlled volume properties
Now the controlled and non-controlled code paths are all having exactly the same rounding behaviour and the unit tests pass again.
-rw-r--r--gst/volume/gstvolume.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c
index 5f442d4b2..2cf24274a 100644
--- a/gst/volume/gstvolume.c
+++ b/gst/volume/gstvolume.c
@@ -610,7 +610,7 @@ volume_process_controlled_int32_clamp (GstVolume * self, gpointer bytes,
for (i = 0; i < num_samples; i++) {
vol = *volume++;
for (j = 0; j < channels; j++) {
- val = *data * vol + 0.5;
+ val = *data * vol;
*data++ = (gint32) CLAMP (val, VOLUME_MIN_INT32, VOLUME_MAX_INT32);
}
}
@@ -694,7 +694,7 @@ volume_process_controlled_int24_clamp (GstVolume * self, gpointer bytes,
for (i = 0; i < num_samples; i++) {
vol = *volume++;
for (j = 0; j < channels; j++) {
- val = get_unaligned_i24 (data) * vol + 0.5;
+ val = get_unaligned_i24 (data) * vol;
val = CLAMP (val, VOLUME_MIN_INT24, VOLUME_MAX_INT24);
write_unaligned_u24 (data, (gint32) val);
}
@@ -753,7 +753,7 @@ volume_process_controlled_int16_clamp (GstVolume * self, gpointer bytes,
for (i = 0; i < num_samples; i++) {
vol = *volume++;
for (j = 0; j < channels; j++) {
- val = *data * vol + 0.5;
+ val = *data * vol;
*data++ = (gint16) CLAMP (val, VOLUME_MIN_INT16, VOLUME_MAX_INT16);
}
}
@@ -806,7 +806,7 @@ volume_process_controlled_int8_clamp (GstVolume * self, gpointer bytes,
for (i = 0; i < num_samples; i++) {
vol = *volume++;
for (j = 0; j < channels; j++) {
- val = *data * vol + 0.5;
+ val = *data * vol;
*data++ = (gint8) CLAMP (val, VOLUME_MIN_INT8, VOLUME_MAX_INT8);
}
}