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

Peter Meerwald pmeerw at pmeerw.net
Mon Jan 9 04:51:27 PST 2012


From: Peter Meerwald <p.meerwald at bct-electronic.com>

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



More information about the pulseaudio-discuss mailing list