[pulseaudio-discuss] [PATCH 08/10] tests: Fix sconv sample correctness in cpu-test

Peter Meerwald pmeerw at pmeerw.net
Wed Jan 30 02:04:03 PST 2013


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

do allow up to one sample difference
cleanup output of signed shorts (use 0xhx)

Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
---
 src/tests/cpu-test.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tests/cpu-test.c b/src/tests/cpu-test.c
index ff3947f..52555a1 100644
--- a/src/tests/cpu-test.c
+++ b/src/tests/cpu-test.c
@@ -104,7 +104,7 @@ static void run_volume_test(pa_do_volume_func_t func, pa_do_volume_func_t orig_f
         for (i = 0; i < nsamples; i++) {
             if (samples[i] != samples_ref[i]) {
                 pa_log_debug("Correctness test failed: align=%d, channels=%d", align, channels);
-                pa_log_debug("%d: %04x != %04x (%04x * %08x)\n", i, samples[i], samples_ref[i],
+                pa_log_debug("%d: %04hx != %04hx (%04hx * %08x)\n", i, samples[i], samples_ref[i],
                         samples_orig[i], volumes[i % channels]);
                 fail();
             }
@@ -280,7 +280,7 @@ static void run_conv_test_float_to_s16(pa_convert_func_t func, pa_convert_func_t
         for (i = 0; i < nsamples; i++) {
             if (abs(samples[i] - samples_ref[i]) > 1) {
                 pa_log_debug("Correctness test failed: align=%d", align);
-                pa_log_debug("%d: %04x != %04x (%.24f)\n", i, samples[i], samples_ref[i], floats[i]);
+                pa_log_debug("%d: %04hx != %04hx (%.24f)\n", i, samples[i], samples_ref[i], floats[i]);
                 fail();
             }
         }
@@ -324,7 +324,7 @@ static void run_conv_test_s16_to_float(pa_convert_func_t func, pa_convert_func_t
         func(nsamples, samples, floats);
 
         for (i = 0; i < nsamples; i++) {
-            if (abs(floats[i] - floats_ref[i]) > 1) {
+            if (fabsf(floats[i] - floats_ref[i]) > 0.0001) {
                 pa_log_debug("Correctness test failed: align=%d", align);
                 pa_log_debug("%d: %.24f != %.24f (%d)\n", i, floats[i], floats_ref[i], samples[i]);
                 fail();
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list