tests: lib: cmsis_dsp: filtering: Update MISC Q31 tests for 1.9.0
This commit updates the filtering MISC Q31 test patterns and implementations for the CMSIS-DSP 1.9.0. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
parent
53f148de84
commit
267780dc2b
2 changed files with 264 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Stephanos Ioannidis <root@stephanos.io>
|
||||
* Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021 Stephanos Ioannidis <root@stephanos.io>
|
||||
* Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -13,8 +13,10 @@
|
|||
|
||||
#include "misc_q31.pat"
|
||||
|
||||
#define SNR_ERROR_THRESH ((float32_t)100)
|
||||
#define ABS_ERROR_THRESH_Q31 ((q31_t)2)
|
||||
#define SNR_ERROR_THRESH ((float32_t)100)
|
||||
#define ABS_ERROR_THRESH_Q31 ((q31_t)2)
|
||||
#define ABS_ERROR_THRESH_FAST_Q31 ((q31_t)11)
|
||||
#define ABS_ERROR_THRESH_LD_Q31 ((q31_t)30)
|
||||
|
||||
static void test_arm_correlate_q31(
|
||||
size_t in1_length, size_t in2_length, const q31_t *ref,
|
||||
|
@ -160,6 +162,137 @@ DEFINE_CONV_TEST(13, 3);
|
|||
DEFINE_CONV_TEST(13, 8);
|
||||
DEFINE_CONV_TEST(13, 11);
|
||||
|
||||
static void test_arm_conv_partial_q31(
|
||||
size_t first, size_t in1_length, size_t in2_length, const q31_t *ref,
|
||||
size_t ref_length)
|
||||
{
|
||||
q31_t *output;
|
||||
q31_t *temp;
|
||||
arm_status status;
|
||||
|
||||
/* Allocate output buffer */
|
||||
output = calloc(first + ref_length, sizeof(q31_t));
|
||||
temp = calloc(ref_length, sizeof(q31_t));
|
||||
|
||||
/* Run test function */
|
||||
status = arm_conv_partial_q31(
|
||||
in_partial1, in1_length, in_partial2, in2_length,
|
||||
output, first, ref_length);
|
||||
|
||||
zassert_equal(status, ARM_MATH_SUCCESS,
|
||||
ASSERT_MSG_INCORRECT_COMP_RESULT);
|
||||
|
||||
memcpy(temp, &output[first], ref_length * sizeof(q31_t));
|
||||
|
||||
/* Validate output */
|
||||
zassert_true(
|
||||
test_snr_error_q31(ref_length, ref, temp, SNR_ERROR_THRESH),
|
||||
ASSERT_MSG_SNR_LIMIT_EXCEED);
|
||||
|
||||
zassert_true(
|
||||
test_near_equal_q31(ref_length, ref, temp,
|
||||
ABS_ERROR_THRESH_Q31),
|
||||
ASSERT_MSG_ABS_ERROR_LIMIT_EXCEED);
|
||||
|
||||
/* Free output buffer */
|
||||
free(output);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
static void test_arm_conv_partial_fast_q31(
|
||||
size_t first, size_t in1_length, size_t in2_length, const q31_t *ref,
|
||||
size_t ref_length)
|
||||
{
|
||||
q31_t *output;
|
||||
q31_t *temp;
|
||||
arm_status status;
|
||||
|
||||
/* Allocate output buffer */
|
||||
output = calloc(first + ref_length, sizeof(q31_t));
|
||||
temp = calloc(ref_length, sizeof(q31_t));
|
||||
|
||||
/* Run test function */
|
||||
status = arm_conv_partial_fast_q31(
|
||||
in_partial1, in1_length, in_partial2, in2_length,
|
||||
output, first, ref_length);
|
||||
|
||||
zassert_equal(status, ARM_MATH_SUCCESS,
|
||||
ASSERT_MSG_INCORRECT_COMP_RESULT);
|
||||
|
||||
memcpy(temp, &output[first], ref_length * sizeof(q31_t));
|
||||
|
||||
/* Validate output */
|
||||
zassert_true(
|
||||
test_snr_error_q31(ref_length, ref, temp, SNR_ERROR_THRESH),
|
||||
ASSERT_MSG_SNR_LIMIT_EXCEED);
|
||||
|
||||
zassert_true(
|
||||
test_near_equal_q31(ref_length, ref, temp,
|
||||
ABS_ERROR_THRESH_FAST_Q31),
|
||||
ASSERT_MSG_ABS_ERROR_LIMIT_EXCEED);
|
||||
|
||||
/* Free output buffer */
|
||||
free(output);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
#define DEFINE_CONV_PARTIAL_TEST(a, b, c) \
|
||||
DEFINE_TEST_VARIANT5( \
|
||||
arm_conv_partial_q31, a##_##b##_##c, a, b, c, \
|
||||
ref_conv_partial_##a##_##b##_##c, \
|
||||
ARRAY_SIZE(ref_conv_partial_##a##_##b##_##c)) \
|
||||
DEFINE_TEST_VARIANT5( \
|
||||
arm_conv_partial_fast_q31, a##_##b##_##c, a, b, c, \
|
||||
ref_conv_partial_##a##_##b##_##c, \
|
||||
ARRAY_SIZE(ref_conv_partial_##a##_##b##_##c))
|
||||
|
||||
DEFINE_CONV_PARTIAL_TEST(3, 6, 8);
|
||||
DEFINE_CONV_PARTIAL_TEST(9, 6, 8);
|
||||
DEFINE_CONV_PARTIAL_TEST(7, 6, 8);
|
||||
|
||||
static void test_arm_levinson_durbin_q31(
|
||||
size_t in_length, size_t err_index, const q31_t *in, const q31_t *ref,
|
||||
size_t ref_length)
|
||||
{
|
||||
q31_t *output;
|
||||
q31_t err;
|
||||
|
||||
/* Allocate output buffer */
|
||||
output = calloc(ref_length, sizeof(q31_t));
|
||||
|
||||
/* Run test function */
|
||||
arm_levinson_durbin_q31(in, output, &err, in_length);
|
||||
|
||||
/* Validate output */
|
||||
zassert_true(
|
||||
test_snr_error_q31(ref_length, ref, output, SNR_ERROR_THRESH),
|
||||
ASSERT_MSG_SNR_LIMIT_EXCEED);
|
||||
|
||||
zassert_true(
|
||||
test_near_equal_q31(ref_length, ref, output,
|
||||
ABS_ERROR_THRESH_LD_Q31),
|
||||
ASSERT_MSG_ABS_ERROR_LIMIT_EXCEED);
|
||||
|
||||
zassert_true(
|
||||
test_near_equal_q31(1, &in_levinson_durbin_err[err_index],
|
||||
&err, ABS_ERROR_THRESH_LD_Q31),
|
||||
ASSERT_MSG_ABS_ERROR_LIMIT_EXCEED);
|
||||
|
||||
/* Free output buffer */
|
||||
free(output);
|
||||
}
|
||||
|
||||
#define DEFINE_LEVINSON_DURBIN_TEST(a, b) \
|
||||
DEFINE_TEST_VARIANT5( \
|
||||
arm_levinson_durbin_q31, a##_##b, a, b, \
|
||||
in_levinson_durbin_##a##_##b, \
|
||||
ref_levinson_durbin_##a##_##b, \
|
||||
ARRAY_SIZE(ref_levinson_durbin_##a##_##b))
|
||||
|
||||
DEFINE_LEVINSON_DURBIN_TEST(3, 0);
|
||||
DEFINE_LEVINSON_DURBIN_TEST(8, 1);
|
||||
DEFINE_LEVINSON_DURBIN_TEST(11, 2);
|
||||
|
||||
void test_filtering_misc_q31(void)
|
||||
{
|
||||
ztest_test_suite(filtering_misc_q31,
|
||||
|
@ -242,7 +375,16 @@ void test_filtering_misc_q31(void)
|
|||
ztest_unit_test(test_arm_conv_q31_13_2),
|
||||
ztest_unit_test(test_arm_conv_q31_13_3),
|
||||
ztest_unit_test(test_arm_conv_q31_13_8),
|
||||
ztest_unit_test(test_arm_conv_q31_13_11)
|
||||
ztest_unit_test(test_arm_conv_q31_13_11),
|
||||
ztest_unit_test(test_arm_conv_partial_q31_3_6_8),
|
||||
ztest_unit_test(test_arm_conv_partial_q31_9_6_8),
|
||||
ztest_unit_test(test_arm_conv_partial_q31_7_6_8),
|
||||
ztest_unit_test(test_arm_conv_partial_fast_q31_3_6_8),
|
||||
ztest_unit_test(test_arm_conv_partial_fast_q31_9_6_8),
|
||||
ztest_unit_test(test_arm_conv_partial_fast_q31_7_6_8),
|
||||
ztest_unit_test(test_arm_levinson_durbin_q31_3_0),
|
||||
ztest_unit_test(test_arm_levinson_durbin_q31_8_1),
|
||||
ztest_unit_test(test_arm_levinson_durbin_q31_11_2)
|
||||
);
|
||||
|
||||
ztest_run_test_suite(filtering_misc_q31);
|
||||
|
|
117
tests/lib/cmsis_dsp/filtering/src/misc_q31.pat
generated
117
tests/lib/cmsis_dsp/filtering/src/misc_q31.pat
generated
|
@ -68,6 +68,96 @@ static const q31_t in_com2[128] = {
|
|||
0xFF608155, 0xF974890E, 0xFE33259C, 0xFB101099
|
||||
};
|
||||
|
||||
static const q31_t in_partial1[128] = {
|
||||
0xEC15936E, 0x0E2D25D4, 0x2033133D, 0x176CA3E9,
|
||||
0xFAFD4BB9, 0x66EA5713, 0xFCEDC5C9, 0x44A8D7D7,
|
||||
0x2F7E5E8E, 0xC267AB10, 0xE1B7DA3E, 0xE599AF70,
|
||||
0x2EB2FFCF, 0xA85BDBB4, 0xFC2F7688, 0x3A0641AB,
|
||||
0x2CC84AE3, 0xC9BE6C16, 0x24AB9FBF, 0xC07E97FF,
|
||||
0xFA475E27, 0xECBF7EBF, 0xBA857709, 0x95F130E4,
|
||||
0x17245A48, 0xEFE3296C, 0xE283D7CA, 0xEC2D9591,
|
||||
0xCC2246ED, 0xEC2AF6FC, 0x29D99E4F, 0x1664A876,
|
||||
0x32B5A932, 0x0B6053BD, 0xF2487FD0, 0x0A29459A,
|
||||
0xE07EC40E, 0xE4655069, 0x0A252ECE, 0xD9995012,
|
||||
0x1C70BB00, 0xF509D7D3, 0xDEAF07E6, 0xF573AC93,
|
||||
0xF04A3419, 0xD7B30B14, 0x1A78FD3A, 0xDB76704E,
|
||||
0x2025DB4B, 0xD027A766, 0x24325C2B, 0x2B0FD6BF,
|
||||
0x16ED88DE, 0x044FDF73, 0x260692F7, 0xF616E067,
|
||||
0xD536EFBE, 0xBEDB0F5F, 0x0C0AC094, 0x62CF0863,
|
||||
0x32B82C70, 0x58BBC019, 0x035037E7, 0x0A745370,
|
||||
0x7FFFFFFF, 0x9D2AEEFE, 0x0D324DB4, 0x10BDFAD2,
|
||||
0xE575B856, 0x19855FDD, 0xEA94A3E6, 0xBA561EEE,
|
||||
0x1AE3A2B2, 0x00C2204D, 0xC50DFE53, 0xC9B575CC,
|
||||
0x1AE734CD, 0xB640F797, 0x47EAE1B9, 0xB9BF25B0,
|
||||
0xF1534B69, 0xEB6B0636, 0xF8F774CF, 0x729C0823,
|
||||
0x2715E6E9, 0xDCC26BCE, 0xDD3F9116, 0xF179E77D,
|
||||
0x08FB84AE, 0x4C32E7EE, 0x0B68DF53, 0xC35BEFBB,
|
||||
0xFC7D0F73, 0x8BCF2123, 0xE90A476A, 0x002FDD30,
|
||||
0xB461AF4F, 0x432BB98E, 0xE231CEBA, 0xF4B60E7F,
|
||||
0xEB3B194C, 0x27ECDC5B, 0xED0B092F, 0x0E524943,
|
||||
0x28221F36, 0x57B08E8D, 0x18F2BBDB, 0x30241FBB,
|
||||
0xB95F584F, 0x0E67EB1F, 0xF33CDF61, 0x4D01F533,
|
||||
0xFC9AFF70, 0x17E9B556, 0x025E8710, 0xE17D7693,
|
||||
0xEB5A5B55, 0x14E7F85E, 0x06106BDA, 0xDD71CF43,
|
||||
0x1B4DB96A, 0xDA305736, 0xF08F6550, 0x1C46B07F,
|
||||
0xC151C959, 0x26FCAF39, 0xCD53991C, 0xAEB28ACD
|
||||
};
|
||||
|
||||
static const q31_t in_partial2[128] = {
|
||||
0xDFEC6B14, 0xD2ECF769, 0xF1BB039F, 0xEFA18D56,
|
||||
0x9FAE215C, 0xFCC1522B, 0xEC50C539, 0x26619638,
|
||||
0x060C6D28, 0xBC1DD9A9, 0xE411BC67, 0x9986108D,
|
||||
0xB45DD13D, 0x019283EA, 0x48317BB6, 0x25C8209C,
|
||||
0x039734FC, 0x320498C4, 0xB50F0846, 0xC7D54E0B,
|
||||
0xEAB6EF40, 0x2352F2C5, 0x20C6606B, 0xEDD5B674,
|
||||
0xE19FF848, 0x185048B2, 0xE88F5BDC, 0xBFFECD65,
|
||||
0x08AC8CA5, 0x06AED084, 0x2E370EEE, 0xD51B4ABC,
|
||||
0xC8629150, 0xC8D604FF, 0x6AB36D11, 0xDD299583,
|
||||
0xEF429B2B, 0x6E53AAFC, 0x3506EED5, 0x135BC064,
|
||||
0xED9FD2F6, 0xE35AEFB9, 0x49E96A33, 0x30E4BA1F,
|
||||
0xE6919D5B, 0x105D4683, 0x4B59DC93, 0xEDBB6EC8,
|
||||
0x5E7DF679, 0x16EA833F, 0xC0F21C4D, 0x62BEFF64,
|
||||
0x1926163E, 0xC6D29366, 0x2E0F6EE8, 0x4A6BABCB,
|
||||
0x2552F11D, 0xB1D2709C, 0x2C651B1F, 0xE26A79F2,
|
||||
0xD21C94DD, 0x07255447, 0xEF6CE6EF, 0xE0ECF096,
|
||||
0xF7FDCB67, 0x652D5413, 0x19C47FB8, 0xE6AC062C,
|
||||
0xF0A63B68, 0xD8AAA268, 0xE8B2CD7B, 0xFC5442B5,
|
||||
0x80000000, 0xC7CB122F, 0x0D1DB535, 0x230027C0,
|
||||
0x11683B0A, 0x21DB7818, 0xB910A6A7, 0x05974D7C,
|
||||
0xFCBE0BB0, 0x40FCE252, 0xCFCDD1E3, 0xDF5F4570,
|
||||
0x23F8A029, 0x200C14EC, 0xBE3DA4E4, 0x2F5C3DB7,
|
||||
0x0013166A, 0x1E7577D7, 0x4F3B5FB5, 0xC3F41EDB,
|
||||
0xC018BC72, 0x0E4CE929, 0x27457144, 0xE3B3CF77,
|
||||
0xC5EA4C35, 0x3F128EE8, 0x5A205CF8, 0xB542D2B9,
|
||||
0x079BBF8B, 0x5C13D315, 0xFA699B48, 0x16C7CA14,
|
||||
0xC10DF614, 0xCDFA5E42, 0x6FADB1C9, 0x167E4DD9,
|
||||
0x037C27BB, 0xDE7259C3, 0x11A95A1B, 0x4C5C954C,
|
||||
0x1768EF9E, 0xE2120819, 0xBA8221F6, 0x324724A4,
|
||||
0x16E54205, 0x2FB5FD76, 0x9C867FF9, 0x0A94B3DF,
|
||||
0xD2FB37A7, 0xD5A2DA0C, 0xB353B3B5, 0xDCD3273F,
|
||||
0xA8CCACC4, 0xCEAB32AE, 0x4968DB7D, 0xF68EA5E9
|
||||
};
|
||||
|
||||
static const q31_t in_levinson_durbin_3_0[4] = {
|
||||
0x7FFFFFFF, 0xE736755B, 0xD7FD03C4, 0x0164DFB7
|
||||
};
|
||||
|
||||
static const q31_t in_levinson_durbin_8_1[9] = {
|
||||
0x7FFFFFFF, 0xD7F0F394, 0x1AB5324C, 0x15EA91DE,
|
||||
0xDD9EA99C, 0x3483A634, 0xF0199596, 0x02DA4E61,
|
||||
0xFFDF3984
|
||||
};
|
||||
|
||||
static const q31_t in_levinson_durbin_11_2[12] = {
|
||||
0x7FFFFFFF, 0x267D9923, 0x189E5CE5, 0x37F6E1A7,
|
||||
0xFAB2984D, 0x165BC654, 0x2FAA8AAD, 0x10421578,
|
||||
0x1E68DBAD, 0x16A20F75, 0xF90A49B9, 0xFA031238
|
||||
};
|
||||
|
||||
static const q31_t in_levinson_durbin_err[3] = {
|
||||
0x67CE4AAB, 0x5770EC70, 0x471BFC5B
|
||||
};
|
||||
|
||||
static const q31_t ref_correlate_4_1[7] = {
|
||||
0x00000000, 0x00000000, 0x00000000, 0xFFD92836,
|
||||
0x0003D519, 0x000066CC, 0x000C6734
|
||||
|
@ -651,3 +741,30 @@ static const q31_t ref_conv_13_11[23] = {
|
|||
0x00005D00, 0xFFEBCA3C, 0x00034493
|
||||
};
|
||||
|
||||
static const q31_t ref_conv_partial_3_6_8[4] = {
|
||||
0xEFC1EEA1, 0x02974715, 0xD71508C8, 0xC3CB9A79
|
||||
};
|
||||
|
||||
static const q31_t ref_conv_partial_9_6_8[4] = {
|
||||
0xB8BC7452, 0x052F7BEC, 0xEEABB3FB, 0x1EDC0837
|
||||
};
|
||||
|
||||
static const q31_t ref_conv_partial_7_6_8[4] = {
|
||||
0xDA929F9F, 0xF55088CC, 0xB8BC7452, 0x052F7BEC
|
||||
};
|
||||
|
||||
static const q31_t ref_levinson_durbin_3_0[3] = {
|
||||
0xD6467AB7, 0xCBB0E0A6, 0xEA38BA29
|
||||
};
|
||||
|
||||
static const q31_t ref_levinson_durbin_8_1[8] = {
|
||||
0xE1EC76AF, 0x1F1C386C, 0x1AB06D8F, 0xE7B844BB,
|
||||
0x27942C10, 0x135E85C1, 0xF2B4C845, 0xE3F4F726
|
||||
};
|
||||
|
||||
static const q31_t ref_levinson_durbin_11_2[11] = {
|
||||
0x304EC702, 0xF30B2CEF, 0x416077F1, 0xC3E43AF8,
|
||||
0x25ABE048, 0x070FD164, 0x16634DB7, 0x01D91B16,
|
||||
0xFF1FD36A, 0xF7F5EAFB, 0xEA79CBB8
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue