tests: lib: cmsis_dsp: filtering: Update MISC F32 tests for 1.9.0
This commit updates the filtering MISC F32 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
267780dc2b
commit
d817c138d4
2 changed files with 223 additions and 3 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
|
||||
*/
|
||||
|
@ -16,6 +16,8 @@
|
|||
#define SNR_ERROR_THRESH ((float32_t)120)
|
||||
#define REL_ERROR_THRESH (1.0e-6)
|
||||
#define ABS_ERROR_THRESH (1.0e-5)
|
||||
#define REL_ERROR_THRESH_LD (1.0e-6)
|
||||
#define ABS_ERROR_THRESH_LD (1.0e-6)
|
||||
|
||||
static void test_arm_correlate_f32(
|
||||
size_t in1_length, size_t in2_length, const uint32_t *ref,
|
||||
|
@ -167,6 +169,101 @@ DEFINE_CONV_TEST(13, 3);
|
|||
DEFINE_CONV_TEST(13, 8);
|
||||
DEFINE_CONV_TEST(13, 11);
|
||||
|
||||
static void test_arm_conv_partial_f32(
|
||||
size_t first, size_t in1_length, size_t in2_length,
|
||||
const uint32_t *ref, size_t ref_length)
|
||||
{
|
||||
float32_t *output;
|
||||
float32_t *temp;
|
||||
arm_status status;
|
||||
|
||||
/* Allocate output buffer */
|
||||
output = calloc(first + ref_length, sizeof(float32_t));
|
||||
temp = calloc(ref_length, sizeof(float32_t));
|
||||
|
||||
/* Run test function */
|
||||
status = arm_conv_partial_f32(
|
||||
(const float32_t *)in_partial1, in1_length,
|
||||
(const float32_t *)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(float32_t));
|
||||
|
||||
/* Validate output */
|
||||
zassert_true(
|
||||
test_snr_error_f32(ref_length, (const float32_t *)ref, temp,
|
||||
SNR_ERROR_THRESH),
|
||||
ASSERT_MSG_SNR_LIMIT_EXCEED);
|
||||
|
||||
zassert_true(
|
||||
test_close_error_f32(ref_length, (const float32_t *)ref, temp,
|
||||
ABS_ERROR_THRESH, REL_ERROR_THRESH),
|
||||
ASSERT_MSG_ERROR_LIMIT_EXCEED);
|
||||
|
||||
/* Free output buffer */
|
||||
free(output);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
#define DEFINE_CONV_PARTIAL_TEST(a, b, c) \
|
||||
DEFINE_TEST_VARIANT5( \
|
||||
arm_conv_partial_f32, 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_f32(
|
||||
size_t in_length, size_t err_index, const uint32_t *in,
|
||||
const uint32_t *ref, size_t ref_length)
|
||||
{
|
||||
float32_t *output;
|
||||
float32_t err;
|
||||
|
||||
/* Allocate output buffer */
|
||||
output = calloc(ref_length, sizeof(float32_t));
|
||||
|
||||
/* Run test function */
|
||||
arm_levinson_durbin_f32((const float32_t *)in, output, &err,
|
||||
in_length);
|
||||
|
||||
/* Validate output */
|
||||
zassert_true(
|
||||
test_snr_error_f32(ref_length, (const float32_t *)ref, output,
|
||||
SNR_ERROR_THRESH),
|
||||
ASSERT_MSG_SNR_LIMIT_EXCEED);
|
||||
|
||||
zassert_true(
|
||||
test_close_error_f32(ref_length, (const float32_t *)ref,
|
||||
output, ABS_ERROR_THRESH_LD, REL_ERROR_THRESH_LD),
|
||||
ASSERT_MSG_ERROR_LIMIT_EXCEED);
|
||||
|
||||
zassert_true(
|
||||
test_close_error_f32(1,
|
||||
(const float32_t *)&in_levinson_durbin_err[err_index],
|
||||
&(err), ABS_ERROR_THRESH_LD, REL_ERROR_THRESH_LD),
|
||||
ASSERT_MSG_ERROR_LIMIT_EXCEED);
|
||||
|
||||
/* Free output buffer */
|
||||
free(output);
|
||||
}
|
||||
|
||||
#define DEFINE_LEVINSON_DURBIN_TEST(a, b) \
|
||||
DEFINE_TEST_VARIANT5( \
|
||||
arm_levinson_durbin_f32, 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_f32(void)
|
||||
{
|
||||
ztest_test_suite(filtering_misc_f32,
|
||||
|
@ -249,7 +346,13 @@ void test_filtering_misc_f32(void)
|
|||
ztest_unit_test(test_arm_conv_f32_13_2),
|
||||
ztest_unit_test(test_arm_conv_f32_13_3),
|
||||
ztest_unit_test(test_arm_conv_f32_13_8),
|
||||
ztest_unit_test(test_arm_conv_f32_13_11)
|
||||
ztest_unit_test(test_arm_conv_f32_13_11),
|
||||
ztest_unit_test(test_arm_conv_partial_f32_3_6_8),
|
||||
ztest_unit_test(test_arm_conv_partial_f32_9_6_8),
|
||||
ztest_unit_test(test_arm_conv_partial_f32_7_6_8),
|
||||
ztest_unit_test(test_arm_levinson_durbin_f32_3_0),
|
||||
ztest_unit_test(test_arm_levinson_durbin_f32_8_1),
|
||||
ztest_unit_test(test_arm_levinson_durbin_f32_11_2)
|
||||
);
|
||||
|
||||
ztest_run_test_suite(filtering_misc_f32);
|
||||
|
|
117
tests/lib/cmsis_dsp/filtering/src/misc_f32.pat
generated
117
tests/lib/cmsis_dsp/filtering/src/misc_f32.pat
generated
|
@ -68,6 +68,96 @@ static const uint32_t in_com2[128] = {
|
|||
0x3dd17c57, 0x3e992ebd, 0x3f38261d, 0xbcb14667
|
||||
};
|
||||
|
||||
static const uint32_t in_partial1[128] = {
|
||||
0xbed15588, 0x3eb4b9b8, 0xbe59a3fb, 0xbda22722,
|
||||
0xbe529696, 0x3ee317e7, 0xbd13c371, 0xbe299e91,
|
||||
0xbeb9c37f, 0xbdb9aa86, 0xbf26b4d9, 0x3d2bca34,
|
||||
0xbdf75c41, 0xbe0e1dbd, 0x3e8861ee, 0x3e30b9ae,
|
||||
0xbe55b0fd, 0x3f800000, 0x3e9f1598, 0xbf3791b2,
|
||||
0x3e0cfe56, 0xbee39721, 0xbef1a9c0, 0xbe9c3efe,
|
||||
0xbd097af3, 0x3bccfed4, 0x3d35fc82, 0x3ee70b7a,
|
||||
0xbf5fd9e8, 0x3da9bae3, 0xbe083620, 0xbb8346f5,
|
||||
0x3df5307e, 0xbf5044d0, 0x3cfd05cf, 0xbe625e19,
|
||||
0xbe18fa6b, 0xbdb32b24, 0xbb6e91ee, 0x3e5b3e60,
|
||||
0x3f4b92ae, 0xbe1fd999, 0x3b95c3e7, 0xbf3790d4,
|
||||
0xbe8a5de9, 0x3e3dadfa, 0xbee1a556, 0x3e69eaa4,
|
||||
0xbd303eb3, 0xbcd0d125, 0xbe0dbaaf, 0x3e4844dd,
|
||||
0x3f0122fa, 0xbe5f3b85, 0xbdbfa568, 0x3f09e2f8,
|
||||
0x3e5f026c, 0xbed41c6b, 0x3d9b78cf, 0xbe1883b9,
|
||||
0x3a879fcd, 0x3e38ccdd, 0xbd521a29, 0x3c7e1b72,
|
||||
0xbe9777dc, 0x3db12915, 0xbd923119, 0xbef9a7e0,
|
||||
0xbf090579, 0x3ea396f8, 0xbed755af, 0xbeb20d43,
|
||||
0x3ef411e4, 0xbe0b480b, 0x3e8ffd9a, 0xbef63953,
|
||||
0xbe08c93d, 0x3eb92913, 0x3d81d2ab, 0x3efcfcf8,
|
||||
0x3f7df12c, 0xbe1de6a5, 0x3f707934, 0x3efd3005,
|
||||
0x3f629082, 0x3e654790, 0xbf6eecd2, 0x3ecf382f,
|
||||
0x3ea8114a, 0xbec2ea9f, 0xbf49306a, 0x3b3f641f,
|
||||
0x3dc5a538, 0x3ebb77b3, 0x3e774158, 0x3c46fdea,
|
||||
0x3e6090be, 0xbecac716, 0x3dccdb8e, 0xbde14f85,
|
||||
0xbf2ac5ca, 0x3e18c33e, 0xbe1ef5dc, 0xbe5b1477,
|
||||
0xbd55be22, 0xbd6978ff, 0x3f1c910a, 0x3e5429f9,
|
||||
0x3ed21298, 0xbeba7a98, 0x3e0142c4, 0x3f3538b9,
|
||||
0x3e98a36a, 0x3eebeea0, 0xbe3d35b4, 0xbf2f95ce,
|
||||
0x3ec545b4, 0x3e1af15a, 0x3f365531, 0x3ea3f651,
|
||||
0xbc53c100, 0xbe32b887, 0xbe9fc713, 0xbf1cc3a0,
|
||||
0x3ccbf8c0, 0xbbd60980, 0xbea6502d, 0x3e5878eb
|
||||
};
|
||||
|
||||
static const uint32_t in_partial2[128] = {
|
||||
0x3d9c7fd4, 0x3eb388ec, 0x3e414f06, 0xbe02c4df,
|
||||
0xbf1438b6, 0x3ed3acff, 0x3d8cf45c, 0xbdba8cf3,
|
||||
0x3eb6f923, 0x3f2e2d7b, 0xbf14a6a0, 0x3e835928,
|
||||
0x3f526839, 0xbf800000, 0xbeb8caaa, 0xbe199ef8,
|
||||
0x3e1489f5, 0x3f323342, 0x3eb38771, 0xbf3fd12b,
|
||||
0x3f71c7f1, 0x3e68fb45, 0xbdb3ce10, 0x3f487459,
|
||||
0xbeae2e3b, 0xbf51eca4, 0x3d82c39e, 0xbe2d0fc1,
|
||||
0x3ec1e725, 0xbf59dc33, 0x3f021882, 0x3d305dee,
|
||||
0xbe05a5cb, 0xbe52d4d5, 0x3e72e227, 0xbe363685,
|
||||
0x3f679479, 0x3e0cfa43, 0x3e5e3d04, 0xbe5f03d7,
|
||||
0x3e310209, 0x3f720920, 0x3e9dbfa3, 0xbe2e6aff,
|
||||
0xbe53e66a, 0x3e832dc0, 0xbda1fe06, 0x3eed4a40,
|
||||
0xbe91e21b, 0xbf1189f6, 0xbde8681a, 0xbd3b04ce,
|
||||
0x3f7d0476, 0x3f11c049, 0xbde7dc78, 0xbf149b4b,
|
||||
0xbe6dbd69, 0xbe9e9f95, 0xbd598429, 0x3e4e81fd,
|
||||
0x3dabda61, 0xbcc2904c, 0xbe90ab20, 0xbef19658,
|
||||
0x3d933b78, 0x3c6271d2, 0x3e25677c, 0x3f0b9507,
|
||||
0x3e177153, 0xbba9c9dd, 0xbe4410bc, 0xbf0a3b6b,
|
||||
0x3edaabe6, 0x3f5a7bc1, 0xbde7f2e4, 0x3f13e21f,
|
||||
0x3e449465, 0x3e574779, 0xbee08a0f, 0xbf170164,
|
||||
0x3e78b0c2, 0x3e999953, 0xbf441e40, 0x3df3a0b9,
|
||||
0xbeccda66, 0xbf3cd7d7, 0x3ea81efa, 0xbd97ab3c,
|
||||
0xbf3b7471, 0x3f3a338f, 0xbe9b174c, 0x3dd40049,
|
||||
0x3f6a0911, 0xbee46560, 0xbf05e6d1, 0x3ee20af2,
|
||||
0xbf3d484a, 0x3ebff17f, 0x3de1ec0a, 0xbf17460d,
|
||||
0xbf60449e, 0x3f097504, 0x3f6afca2, 0x3ebd2a70,
|
||||
0xbe40edf4, 0xbd9d3742, 0x3ec718bd, 0xbcfdf767,
|
||||
0x3e377b80, 0x3db19bf3, 0xbdfe53bd, 0xbe8a12eb,
|
||||
0xbe04ef0c, 0xbdea748a, 0xbf0b8c1f, 0xbf036abc,
|
||||
0x3e79476d, 0xbd7c75d1, 0xbf486eb6, 0x3e17e113,
|
||||
0x3f44646c, 0xbdd5908c, 0xbf19ca94, 0xbe191bed,
|
||||
0xbd0dde3c, 0x3f4ddd49, 0xbd77704e, 0xbe8ea7d6
|
||||
};
|
||||
|
||||
static const uint32_t in_levinson_durbin_3_0[4] = {
|
||||
0x3f800000, 0xbc325142, 0x3dc53bc3, 0xbc126c9c
|
||||
};
|
||||
|
||||
static const uint32_t in_levinson_durbin_8_1[9] = {
|
||||
0x3f800000, 0xbea33bfb, 0xbedff1ae, 0x3eb6eac1,
|
||||
0x3e0d5fad, 0xbda96491, 0xbd84808a, 0x3d8cc977,
|
||||
0x3c16ec8b
|
||||
};
|
||||
|
||||
static const uint32_t in_levinson_durbin_11_2[12] = {
|
||||
0x3f800000, 0x3ec5d65b, 0x3e5d64b1, 0x3e31ebce,
|
||||
0xbd9b5b79, 0xbd8985e8, 0xbed99c7d, 0xbe811a8d,
|
||||
0xbddbffbc, 0xbe28f6ce, 0xbd330242, 0xbd268e1f
|
||||
};
|
||||
|
||||
static const uint32_t in_levinson_durbin_err[3] = {
|
||||
0x3f7d96a4, 0x3edbd552, 0x3f19ebd2
|
||||
};
|
||||
|
||||
static const uint32_t ref_correlate_4_1[7] = {
|
||||
0x0, 0x0, 0x0, 0x3b509f51,
|
||||
0x3a9bfd5d, 0xbaf5d8e1, 0xba16913c
|
||||
|
@ -651,3 +741,30 @@ static const uint32_t ref_conv_13_11[23] = {
|
|||
0xbeb62378, 0x3e0b3d3c, 0x3df05d87
|
||||
};
|
||||
|
||||
static const uint32_t ref_conv_partial_3_6_8[4] = {
|
||||
0x3d1cc01d, 0x3ddd46ce, 0xbecc81e3, 0x3ebc3f17
|
||||
};
|
||||
|
||||
static const uint32_t ref_conv_partial_9_6_8[4] = {
|
||||
0xbea7e4ed, 0x3e34aa5a, 0x3d49c485, 0xbd257c67
|
||||
};
|
||||
|
||||
static const uint32_t ref_conv_partial_7_6_8[4] = {
|
||||
0x3e049c31, 0xbc8bf770, 0xbea7e4ed, 0x3e34aa5a
|
||||
};
|
||||
|
||||
static const uint32_t ref_levinson_durbin_3_0[3] = {
|
||||
0xbc161e18, 0x3dc4df7d, 0xbbe5a6b2
|
||||
};
|
||||
|
||||
static const uint32_t ref_levinson_durbin_8_1[8] = {
|
||||
0xbf3e829c, 0xbf49dfd2, 0x3c138245, 0x3ec4836c,
|
||||
0x3f2ec6c4, 0x3ee04620, 0x3e80308b, 0xbc7c2075
|
||||
};
|
||||
|
||||
static const uint32_t ref_levinson_durbin_11_2[11] = {
|
||||
0x3ee3e73b, 0xbd995240, 0x3e978cb7, 0xbe970b27,
|
||||
0x3e68791b, 0xbf11c549, 0x3e479844, 0xbd1a6d8c,
|
||||
0x3dd46c45, 0xbe0af921, 0x3d0905b8
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue