From d103f3a97a151682a1c4c1257e32d4affb4c162e Mon Sep 17 00:00:00 2001
From: Peter Meerwald
Date: Thu, 12 Jan 2012 17:20:05 +0100
Subject: [PATCH] core: svolume tests should generate realistic random volume
data
assuming RAND_MAX is around 1<<31, rand() >> 1 generates large numbers as
random volume data; these likely causes saturated sample values after
applying the volume function -- not a good test
---
src/pulsecore/svolume_arm.c | 2 +-
src/pulsecore/svolume_mmx.c | 2 +-
src/pulsecore/svolume_orc.c | 2 +-
src/pulsecore/svolume_sse.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pulsecore/svolume_arm.c b/src/pulsecore/svolume_arm.c
index 455d746..f938e57 100644
--- a/src/pulsecore/svolume_arm.c
+++ b/src/pulsecore/svolume_arm.c
@@ -151,7 +151,7 @@ static void run_test(void) {
memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++)
- volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
+ volumes[i] = PA_CLAMP_VOLUME(rand() >> 15);
for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding];
diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c
index 43c1058..f9fc175 100644
--- a/src/pulsecore/svolume_mmx.c
+++ b/src/pulsecore/svolume_mmx.c
@@ -272,7 +272,7 @@ static void run_test(void) {
memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++)
- volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
+ volumes[i] = PA_CLAMP_VOLUME(rand() >> 15);
/* volumes[i] = 0x0000ffff; */
for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding];
diff --git a/src/pulsecore/svolume_orc.c b/src/pulsecore/svolume_orc.c
index 86f843e..b178bbf 100644
--- a/src/pulsecore/svolume_orc.c
+++ b/src/pulsecore/svolume_orc.c
@@ -75,7 +75,7 @@ static void run_test(void) {
memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++)
- volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
+ volumes[i] = PA_CLAMP_VOLUME(rand() >> 15);
for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding];
diff --git a/src/pulsecore/svolume_sse.c b/src/pulsecore/svolume_sse.c
index 89414c6..fe08de4 100644
--- a/src/pulsecore/svolume_sse.c
+++ b/src/pulsecore/svolume_sse.c
@@ -282,7 +282,7 @@ static void run_test(void) {
memcpy(samples_orig, samples, sizeof(samples));
for (i = 0; i < CHANNELS; i++)
- volumes[i] = PA_CLAMP_VOLUME(rand() >> 1);
+ volumes[i] = PA_CLAMP_VOLUME(rand() >> 15);
for (padding = 0; padding < PADDING; padding++, i++)
volumes[i] = volumes[padding];
--
2.7.4