[PATCH] sconv_sse: fix generation of floats in test code

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

 



From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx>

the random floats x should be zero-mean with -(1+eps)<x<(1+eps) for some
small epsilon; previously only negative x were generated
---
 src/pulsecore/sconv_sse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/pulsecore/sconv_sse.c b/src/pulsecore/sconv_sse.c
index 22aaf6c..3c9a809 100644
--- a/src/pulsecore/sconv_sse.c
+++ b/src/pulsecore/sconv_sse.c
@@ -182,7 +182,7 @@ static void run_test(void) {
     memset(samples, 0, sizeof(samples));
 
     for (i = 0; i < SAMPLES; i++) {
-        floats[i] = (rand()/(RAND_MAX+2.2)) - 1.1;
+        floats[i] = 2.1f * (rand()/(float) RAND_MAX - 0.5f);
     }
 
     func = pa_get_convert_from_float32ne_function(PA_SAMPLE_S16LE);
-- 
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