From 55f0beddc694bbd95f572aeb5d6942efd59f2107 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Sat, 12 Sep 2015 20:49:14 +1000 Subject: [PATCH] tests: Improvements to floating point tests Two basic changes: * Increase DFT_DATA_LENGTH to 8192. * Fill the data to 5/6ths of the length instead of 1/2. The first is designed to catch errors in CAF/alac encoding when passed more than 4096 samples at a time. The second makes it easier to catch this kind os problem. --- tests/dft_cmp.h | 4 ++-- tests/utils.tpl | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/dft_cmp.h b/tests/dft_cmp.h index 3cbdd118..faa5fe0a 100644 --- a/tests/dft_cmp.h +++ b/tests/dft_cmp.h @@ -1,5 +1,5 @@ /* -** Copyright (C) 2002-2011 Erik de Castro Lopo +** Copyright (C) 2002-2015 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ */ -#define DFT_DATA_LENGTH (2048) +#define DFT_DATA_LENGTH (8192) double dft_cmp_float (int linenum, const float *orig, const float *test, int len, double tolerance, int allow_exit) ; diff --git a/tests/utils.tpl b/tests/utils.tpl index 6743f1e3..0612f8cd 100644 --- a/tests/utils.tpl +++ b/tests/utils.tpl @@ -1,6 +1,6 @@ [+ AutoGen5 template h c +] /* -** Copyright (C) 2002-2014 Erik de Castro Lopo +** Copyright (C) 2002-2015 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -214,13 +214,8 @@ gen_windowed_sine_[+ (get "name") +] ([+ (get "name") +] *data, int len, double { int k ; memset (data, 0, len * sizeof ([+ (get "name") +])) ; - /* - ** Choose a frequency of 1/32 so that it aligns perfectly with a DFT - ** bucket to minimise spreading of energy over more than one bucket. - ** Also do not want to make the frequency too high as some of the - ** codecs (ie gsm610) have a quite severe high frequency roll off. - */ - len /= 2 ; + + len = (5 * len) / 6 ; for (k = 0 ; k < len ; k++) { data [k] = sin (2.0 * k * M_PI * 1.0 / 32.0 + 0.4) ;