Kaynağa Gözat

上傳檔案到 'app/main/CTO20220622/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/filtering_tests'

rita 2 yıl önce
ebeveyn
işleme
e1ddac21ba

+ 91 - 0
app/main/CTO20220622/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/filtering_tests/filtering_templates.h

@@ -0,0 +1,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_ */

+ 81 - 0
app/main/CTO20220622/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/filtering_tests/filtering_test_data.h

@@ -0,0 +1,81 @@
+#ifndef FILTERING_TEST_DATA_H
+#define FILTERING_TEST_DATA_H
+
+/*--------------------------------------------------------------------------------*/
+/* Includes */
+/*--------------------------------------------------------------------------------*/
+
+#include "arr_desc.h"
+#include "arm_math.h"
+
+/*--------------------------------------------------------------------------------*/
+/* Macros and Defines */
+/*--------------------------------------------------------------------------------*/
+
+#define FILTERING_MAX_BLOCKSIZE  33
+#define LMS_MAX_BLOCKSIZE        512
+#define FILTERING_MAX_NUMTAPS		34
+#define FILTERING_MAX_NUMSTAGES  14
+#define FILTERING_MAX_POSTSHIFT  8
+#define FILTERING_MAX_TAP_DELAY	0xFF
+#define FILTERING_MAX_L				3
+#define FILTERING_MAX_M				33
+
+/*--------------------------------------------------------------------------------*/
+/* Declare Variables */
+/*--------------------------------------------------------------------------------*/
+
+/* Input/Output Buffers */
+extern float32_t filtering_output_fut[LMS_MAX_BLOCKSIZE*2];
+extern float32_t filtering_output_ref[LMS_MAX_BLOCKSIZE*2];
+extern float32_t filtering_output_f32_fut[LMS_MAX_BLOCKSIZE*2];
+extern float32_t filtering_output_f32_ref[LMS_MAX_BLOCKSIZE*2];
+extern float32_t filtering_input_lms[LMS_MAX_BLOCKSIZE*2];
+extern float32_t filtering_pState[LMS_MAX_BLOCKSIZE + FILTERING_MAX_NUMTAPS];
+extern float32_t filtering_scratch[FILTERING_MAX_BLOCKSIZE * 3];
+extern float32_t filtering_scratch2[FILTERING_MAX_BLOCKSIZE * 3];
+extern float32_t filtering_coeffs_lms[FILTERING_MAX_NUMTAPS];
+
+extern const float64_t filtering_f64_inputs[FILTERING_MAX_BLOCKSIZE * FILTERING_MAX_M + FILTERING_MAX_NUMTAPS];
+extern const float32_t filtering_f32_inputs[FILTERING_MAX_BLOCKSIZE * FILTERING_MAX_M + FILTERING_MAX_NUMTAPS];
+extern const q31_t filtering_q31_inputs[FILTERING_MAX_BLOCKSIZE * FILTERING_MAX_M + FILTERING_MAX_NUMTAPS];
+extern const q15_t * filtering_q15_inputs;
+extern const q7_t * filtering_q7_inputs;
+
+/* Block Sizes */
+ARR_DESC_DECLARE(filtering_blocksizes);
+ARR_DESC_DECLARE(lms_blocksizes);
+ARR_DESC_DECLARE(filtering_numtaps);
+ARR_DESC_DECLARE(filtering_numtaps2);
+ARR_DESC_DECLARE(filtering_postshifts);
+ARR_DESC_DECLARE(filtering_numstages);
+ARR_DESC_DECLARE(filtering_Ls);
+ARR_DESC_DECLARE(filtering_Ms);
+
+/* Coefficient Lists */
+extern const float64_t filtering_coeffs_f64[FILTERING_MAX_NUMSTAGES * 6 + 2];
+extern const float64_t filtering_coeffs_b_f64[FILTERING_MAX_NUMSTAGES * 6 + 2];
+extern const float32_t filtering_coeffs_f32[FILTERING_MAX_NUMSTAGES * 6 + 2];
+extern const float32_t filtering_coeffs_b_f32[FILTERING_MAX_NUMSTAGES * 6 + 2];
+extern const float32_t *filtering_coeffs_c_f32;
+extern float32_t filtering_coeffs_lms_f32[FILTERING_MAX_NUMTAPS];
+extern const q31_t filtering_coeffs_q31[FILTERING_MAX_NUMSTAGES * 6 + 2];
+extern const q31_t *filtering_coeffs_b_q31;
+extern const q31_t *filtering_coeffs_c_q31;
+extern q31_t filtering_coeffs_lms_q31[FILTERING_MAX_NUMTAPS];
+extern const q15_t filtering_coeffs_q15[FILTERING_MAX_NUMSTAGES * 6 + 4];
+extern const q15_t *filtering_coeffs_b_q15;
+extern const q15_t *filtering_coeffs_c_q15;
+extern q15_t filtering_coeffs_lms_q15[FILTERING_MAX_NUMTAPS];
+extern const q7_t filtering_coeffs_q7[FILTERING_MAX_NUMSTAGES * 6 + 8];
+extern const q7_t *filtering_coeffs_b_q7;
+extern const q7_t *filtering_coeffs_c_q7;
+
+/* Tap Delay Lists */
+extern const int32_t filtering_tap_delay[FILTERING_MAX_NUMTAPS];
+
+/* Numbers */
+
+/* Float Inputs */
+
+#endif

+ 9 - 0
app/main/CTO20220622/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/filtering_tests/filtering_test_group.h

@@ -0,0 +1,9 @@
+#ifndef _FILTERING_TEST_GROUP_H_
+#define _FILTERING_TEST_GROUP_H_
+
+/*--------------------------------------------------------------------------------*/
+/* Declare Test Groups */
+/*--------------------------------------------------------------------------------*/
+JTEST_DECLARE_GROUP(filtering_tests);
+
+#endif /* _FILTERING_TEST_GROUP_H_ */

+ 15 - 0
app/main/CTO20220622/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/filtering_tests/filtering_tests.h

@@ -0,0 +1,15 @@
+#ifndef _FILTERING_TESTS_H_
+#define _FILTERING_TESTS_H_
+
+/*--------------------------------------------------------------------------------*/
+/* Test/Group Declarations */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DECLARE_GROUP(biquad_tests);
+JTEST_DECLARE_GROUP(conv_tests);
+JTEST_DECLARE_GROUP(correlate_tests);
+JTEST_DECLARE_GROUP(fir_tests);
+JTEST_DECLARE_GROUP(iir_tests);
+JTEST_DECLARE_GROUP(lms_tests);
+
+#endif /* _FILTERING_TESTS_H_ */