annotate fft/native/bqfft/test/Compares.h @ 40:223f770b5341 kissfft-double tip

Try a double-precision kissfft
author Chris Cannam
date Wed, 07 Sep 2016 10:40:32 +0100
parents cf59817a5983
children
rev   line source
Chris@29 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@29 2
Chris@29 3 /*
Chris@29 4 bqfft
Chris@29 5
Chris@29 6 A small library wrapping various FFT implementations for some
Chris@29 7 common audio processing use cases.
Chris@29 8
Chris@29 9 Copyright 2007-2015 Particular Programs Ltd.
Chris@29 10
Chris@29 11 Permission is hereby granted, free of charge, to any person
Chris@29 12 obtaining a copy of this software and associated documentation
Chris@29 13 files (the "Software"), to deal in the Software without
Chris@29 14 restriction, including without limitation the rights to use, copy,
Chris@29 15 modify, merge, publish, distribute, sublicense, and/or sell copies
Chris@29 16 of the Software, and to permit persons to whom the Software is
Chris@29 17 furnished to do so, subject to the following conditions:
Chris@29 18
Chris@29 19 The above copyright notice and this permission notice shall be
Chris@29 20 included in all copies or substantial portions of the Software.
Chris@29 21
Chris@29 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@29 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@29 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Chris@29 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
Chris@29 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@29 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@29 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@29 29
Chris@29 30 Except as contained in this notice, the names of Chris Cannam and
Chris@29 31 Particular Programs Ltd shall not be used in advertising or
Chris@29 32 otherwise to promote the sale, use or other dealings in this
Chris@29 33 Software without prior written authorization.
Chris@29 34 */
Chris@29 35
Chris@29 36 #ifndef TEST_COMPARES_H
Chris@29 37 #define TEST_COMPARES_H
Chris@29 38
Chris@29 39 // These macros are used for comparing generated results, and they
Chris@29 40 // aren't always going to be exact. Adding 0.1 to each value gives
Chris@29 41 // us a little more fuzz in qFuzzyCompare (which ultimately does
Chris@29 42 // the comparison).
Chris@29 43
Chris@29 44 #define COMPARE_ZERO(a) \
Chris@29 45 QCOMPARE(a + 0.1, 0.1)
Chris@29 46
Chris@29 47 #define COMPARE_ZERO_F(a) \
Chris@29 48 QCOMPARE(a + 0.1f, 0.1f)
Chris@29 49
Chris@29 50 #define COMPARE_FUZZIER(a, b) \
Chris@29 51 QCOMPARE(a + 0.1, b + 0.1)
Chris@29 52
Chris@29 53 #define COMPARE_FUZZIER_F(a, b) \
Chris@29 54 QCOMPARE(a + 0.1f, b + 0.1f)
Chris@29 55
Chris@29 56 #define COMPARE_ALL(a, n) \
Chris@29 57 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@29 58 COMPARE_FUZZIER(a[cmp_i], n); \
Chris@29 59 }
Chris@29 60
Chris@29 61 #define COMPARE_SCALED(a, b, s) \
Chris@29 62 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@29 63 COMPARE_FUZZIER(a[cmp_i] / s, b[cmp_i]); \
Chris@29 64 }
Chris@29 65
Chris@29 66 #define COMPARE_ALL_F(a, n) \
Chris@29 67 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@29 68 COMPARE_FUZZIER_F(a[cmp_i], n); \
Chris@29 69 }
Chris@29 70
Chris@29 71 #define COMPARE_SCALED_F(a, b, s) \
Chris@29 72 for (int cmp_i = 0; cmp_i < (int)(sizeof(a)/sizeof(a[0])); ++cmp_i) { \
Chris@29 73 COMPARE_FUZZIER_F(a[cmp_i] / s, b[cmp_i]); \
Chris@29 74 }
Chris@29 75
Chris@29 76 #endif
Chris@29 77