[PATCH] core: svolume tests should generate realistic random volume data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx>

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];
 
-- 
1.7.4.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux