summaryrefslogtreecommitdiff
path: root/midi-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/filtering_tests/filtering_templates.h
blob: f3eb56406cbd2445d96f8788fbef4435612df42b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef _FILTERING_TEMPLATES_H_
#define _FILTERING_TEMPLATES_H_

/*--------------------------------------------------------------------------------*/
/* Includes */
/*--------------------------------------------------------------------------------*/
#include "test_templates.h"

/*--------------------------------------------------------------------------------*/
/* Group Specific Templates */
/*--------------------------------------------------------------------------------*/

/*
 * Comparison SNR thresholds for the data types used in statistics_tests.
 */
#define FILTERING_SNR_THRESHOLD_float64_t 120
#define FILTERING_SNR_THRESHOLD_float32_t 99
#define FILTERING_SNR_THRESHOLD_q31_t 90
#define FILTERING_SNR_THRESHOLD_q15_t 60
#define FILTERING_SNR_THRESHOLD_q7_t 30

/**
 *  Compare reference and fut outputs using SNR.
 *
 *  @note The outputs are converted to float32_t before comparison.
 */
#define FILTERING_SNR_COMPARE_INTERFACE(block_size,                     \
                                        output_type)                    \
    FILTERING_SNR_COMPARE_INTERFACE_OFFSET(0, block_size, output_type)

/**
 *  Compare reference and fut outputs starting at some offset using SNR.
 */
#define FILTERING_SNR_COMPARE_INTERFACE_OFFSET(offset,      \
                                               block_size,  \
                                               output_type) \
    do                                                      \
    {                                                       \
        TEST_CONVERT_AND_ASSERT_SNR(                        \
            filtering_output_f32_ref,                       \
            (output_type *) filtering_output_ref + offset,  \
            filtering_output_f32_fut,                       \
            (output_type *) filtering_output_fut + offset,  \
            block_size,                                     \
            output_type,                                    \
            FILTERING_SNR_THRESHOLD_##output_type           \
            );                                              \
    } while (0)                                              

/**
 *  Compare reference and fut outputs starting at some offset using SNR.
 *  Special case for float64_t
 */
#define FILTERING_DBL_SNR_COMPARE_INTERFACE(block_size,  				\
                                            output_type) 				\
    do                                                      		\
    {                                                       		\
        TEST_ASSERT_DBL_SNR(                        						\
            (float64_t*)filtering_output_ref,               \
            (float64_t*)filtering_output_fut,               \
            block_size,                                     		\
            FILTERING_SNR_THRESHOLD_##output_type           		\
            );                                              		\
    } while (0)                                              
		
/*--------------------------------------------------------------------------------*/
/* Input Interfaces */
/*--------------------------------------------------------------------------------*/
/*
 *  General:
 *  Input interfaces provide inputs to functions inside test templates.  They
 *  ONLY provide the inputs.  The output variables should be hard coded.
 *
 *  The input interfaces must have the following format:
 *
 *  ARM_xxx_INPUT_INTERFACE() or
 *  REF_xxx_INPUT_INTERFACE()
 *
 *  The xxx must be lowercase, and is intended to be the indentifying substring
 *  in the function's name.  Acceptable values are 'sub' or 'add' from the
 *  functions arm_add_q31.
 */


/*--------------------------------------------------------------------------------*/
/* Test Templates */
/*--------------------------------------------------------------------------------*/



#endif /* _FILTERING_TEMPLATES_H_ */