diff --git a/tests/lib/cmsis_dsp/interpolation/CMakeLists.txt b/tests/lib/cmsis_dsp/interpolation/CMakeLists.txt index fb8215cef38..cc4e45ddeca 100644 --- a/tests/lib/cmsis_dsp/interpolation/CMakeLists.txt +++ b/tests/lib/cmsis_dsp/interpolation/CMakeLists.txt @@ -8,5 +8,6 @@ target_sources(app PRIVATE src/q7.c src/q15.c src/q31.c + src/f32.c src/main.c ) diff --git a/tests/lib/cmsis_dsp/interpolation/src/f32.c b/tests/lib/cmsis_dsp/interpolation/src/f32.c new file mode 100644 index 00000000000..bed9523d1b6 --- /dev/null +++ b/tests/lib/cmsis_dsp/interpolation/src/f32.c @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2021 Stephanos Ioannidis + * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include "../../common/test_common.h" + +#include "f32.pat" + +#define SNR_ERROR_THRESH ((float32_t)120) +#define REL_ERROR_THRESH (8.0e-5) + +void test_arm_linear_interp_f32(void) +{ + arm_linear_interp_instance_f32 inst; + size_t index; + size_t length = ARRAY_SIZE(ref_linear); + const float32_t *input = (const float32_t *)in_linear_x; + float32_t *output; + + /* Initialise instance */ + inst.nValues = ARRAY_SIZE(in_linear_y); + inst.x1 = 0.0; + inst.xSpacing = 1.0; + inst.pYData = (float32_t *)in_linear_y; + + /* Allocate output buffer */ + output = malloc(length * sizeof(float32_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + for (index = 0; index < length; index++) { + output[index] = arm_linear_interp_f32(&inst, + input[index]); + } + + /* Validate output */ + zassert_true( + test_snr_error_f32(length, output, (float32_t *)ref_linear, + SNR_ERROR_THRESH), + ASSERT_MSG_SNR_LIMIT_EXCEED); + + zassert_true( + test_rel_error_f32(length, output, (float32_t *)ref_linear, + REL_ERROR_THRESH), + ASSERT_MSG_REL_ERROR_LIMIT_EXCEED); + + /* Free output buffer */ + free(output); +} + +void test_arm_bilinear_interp_f32(void) +{ + arm_bilinear_interp_instance_f32 inst; + size_t index; + size_t length = ARRAY_SIZE(ref_bilinear); + const float32_t *input = (const float32_t *)in_bilinear_x; + float32_t *output; + + /* Initialise instance */ + inst.numRows = in_bilinear_config[1]; + inst.numCols = in_bilinear_config[0]; + inst.pData = (float32_t *)in_bilinear_y; + + /* Allocate output buffer */ + output = malloc(length * sizeof(float32_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Run test function */ + for (index = 0; index < length; index++) { + output[index] = arm_bilinear_interp_f32( + &inst, + input[2 * index], + input[2 * index + 1] + ); + } + + /* Validate output */ + zassert_true( + test_snr_error_f32(length, output, (float32_t *)ref_bilinear, + SNR_ERROR_THRESH), + ASSERT_MSG_SNR_LIMIT_EXCEED); + + zassert_true( + test_rel_error_f32(length, output, (float32_t *)ref_bilinear, + REL_ERROR_THRESH), + ASSERT_MSG_REL_ERROR_LIMIT_EXCEED); + + /* Free output buffer */ + free(output); +} + +static void test_arm_spline( + const uint32_t *input_x, const uint32_t *input_y, + const uint32_t *input_xq, const uint32_t *ref, size_t length, + uint32_t n, arm_spline_type type) +{ + float32_t *output; + float32_t *scratch; + float32_t *coeff; + arm_spline_instance_f32 inst; + + /* Allocate output buffer */ + output = malloc(length * sizeof(float32_t)); + zassert_not_null(output, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Allocate scratch buffer */ + scratch = malloc(((n * 2) - 1) * sizeof(float32_t)); + zassert_not_null(scratch, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Allocate coefficient buffer */ + coeff = malloc(((n - 1) * 3) * sizeof(float32_t)); + zassert_not_null(coeff, ASSERT_MSG_BUFFER_ALLOC_FAILED); + + /* Initialise spline */ + arm_spline_init_f32(&inst, type, + (float32_t *)input_x, (float32_t *)input_y, n, coeff, scratch); + + /* Run test function */ + arm_spline_f32(&inst, (float32_t *)input_xq, output, length); + + /* Validate output */ + zassert_true( + test_snr_error_f32(length, output, (float32_t *)ref, + SNR_ERROR_THRESH), + ASSERT_MSG_SNR_LIMIT_EXCEED); + + /* Free output buffer */ + free(output); + free(scratch); + free(coeff); +} + +DEFINE_TEST_VARIANT7(arm_spline, square_20, + in_spline_squ_x, in_spline_squ_y, in_spline_squ_xq, ref_spline_squ, 20, + 4, ARM_SPLINE_PARABOLIC_RUNOUT); + +DEFINE_TEST_VARIANT7(arm_spline, sine_33, + in_spline_sin_x, in_spline_sin_y, in_spline_sin_xq, ref_spline_sin, 33, + 9, ARM_SPLINE_NATURAL); + +DEFINE_TEST_VARIANT7(arm_spline, ramp_30, + in_spline_ram_x, in_spline_ram_y, in_spline_ram_xq, ref_spline_ram, 30, + 3, ARM_SPLINE_PARABOLIC_RUNOUT); + +void test_interpolation_f32(void) +{ + ztest_test_suite(interpolation_f32, + ztest_unit_test(test_arm_linear_interp_f32), + ztest_unit_test(test_arm_bilinear_interp_f32), + ztest_unit_test(test_arm_spline_square_20), + ztest_unit_test(test_arm_spline_sine_33), + ztest_unit_test(test_arm_spline_ramp_30) + ); + + ztest_run_test_suite(interpolation_f32); +} diff --git a/tests/lib/cmsis_dsp/interpolation/src/f32.pat b/tests/lib/cmsis_dsp/interpolation/src/f32.pat new file mode 100644 index 00000000000..1e0508c6d06 --- /dev/null +++ b/tests/lib/cmsis_dsp/interpolation/src/f32.pat @@ -0,0 +1,270 @@ +static const uint32_t in_linear_x[40] = { + 0x3f000000, 0x3fc00000, 0x40200000, 0x40600000, + 0x40900000, 0x40b00000, 0x40d00000, 0x40f00000, + 0x41080000, 0x41180000, 0x41280000, 0x41380000, + 0x41480000, 0x41580000, 0x41680000, 0x41780000, + 0x41840000, 0x418c0000, 0x41940000, 0x419c0000, + 0x41a40000, 0x41ac0000, 0x41b40000, 0x41bc0000, + 0x41c40000, 0x41cc0000, 0x41d40000, 0x41dc0000, + 0x41e40000, 0x41ec0000, 0x41f40000, 0x41fc0000, + 0x42020000, 0x42060000, 0x420a0000, 0x420e0000, + 0x42120000, 0x42160000, 0x421a0000, 0x421e0000 + }; + +static const uint32_t in_linear_y[41] = { + 0x3f800000, 0x3f7fea75, 0x3f7ea79a, 0x3f7936b0, + 0x3f6ac1bb, 0x3f4d2dfb, 0x3f1a7669, 0x3e9e53bf, + 0xbd8fb620, 0xbef836d2, 0xbf567c63, 0xbf7fce18, + 0xbf5a268a, 0xbebd7651, 0x3e9dc65e, 0x3f5eed38, + 0x3f75f717, 0x3edbce1d, 0xbee0695b, 0xbf7c614c, + 0xbf2c75a9, 0x3e9d38f0, 0x3f7ce303, 0x3f0ace3c, + 0xbf173f66, 0xbf7330cc, 0x3d5f6c50, 0x3f7cd76a, + 0x3e9ffb93, 0xbf69026c, 0xbeeeb565, 0x3f61ab91, + 0x3edd6086, 0xbf705e6f, 0xbe4f8e12, 0x3f7ffef2, + 0xbe776e22, 0xbf5ae819, 0x3f481afa, 0x3e88856c, + 0xbf7ba27a + }; + +static const uint32_t ref_linear[40] = { + 0x3f7ff53b, 0x3f7f4908, 0x3f7bef25, 0x3f71fc36, + 0x3f5bf7db, 0x3f33d232, 0x3ee9a049, 0x3df4cc6e, + 0xbe8e122d, 0xbf294be6, 0xbf6b253e, 0xbf6cfa51, + 0xbf1c70d9, 0xbcfd7f9a, 0x3f16e834, 0x3f6a7228, + 0x3f31ef13, 0xbb9367b4, 0xbf364afd, 0xbf546b7a, + 0xbe3bb262, 0x3f25bfbd, 0x3f43d8a0, 0xbcc71299, + 0xbf453819, 0xbee53a07, 0x3f056717, 0x3f266a9a, + 0xbe9904a3, 0xbf302e8f, 0x3e54a1be, 0x3f282dea, + 0xbe81ae2d, 0xbf1220fa, 0x3ecc1b6e, 0x3ec2236a, + 0xbf0c61d1, 0xbd1668f6, 0x3f062ed8, 0xbeb75fc4 + }; + +static const uint32_t in_bilinear_x[300] = { + 0x3f000000, 0x3f000000, 0x3f71c71c, 0x3f000000, + 0x3fb1c71c, 0x3f000000, 0x3feaaaab, 0x3f000000, + 0x4011c71c, 0x3f000000, 0x402e38e4, 0x3f000000, + 0x404aaaab, 0x3f000000, 0x40671c72, 0x3f000000, + 0x4081c71c, 0x3f000000, 0x40900000, 0x3f000000, + 0x3f000000, 0x3f5b6db7, 0x3f71c71c, 0x3f5b6db7, + 0x3fb1c71c, 0x3f5b6db7, 0x3feaaaab, 0x3f5b6db7, + 0x4011c71c, 0x3f5b6db7, 0x402e38e4, 0x3f5b6db7, + 0x404aaaab, 0x3f5b6db7, 0x40671c72, 0x3f5b6db7, + 0x4081c71c, 0x3f5b6db7, 0x40900000, 0x3f5b6db7, + 0x3f000000, 0x3f9b6db7, 0x3f71c71c, 0x3f9b6db7, + 0x3fb1c71c, 0x3f9b6db7, 0x3feaaaab, 0x3f9b6db7, + 0x4011c71c, 0x3f9b6db7, 0x402e38e4, 0x3f9b6db7, + 0x404aaaab, 0x3f9b6db7, 0x40671c72, 0x3f9b6db7, + 0x4081c71c, 0x3f9b6db7, 0x40900000, 0x3f9b6db7, + 0x3f000000, 0x3fc92492, 0x3f71c71c, 0x3fc92492, + 0x3fb1c71c, 0x3fc92492, 0x3feaaaab, 0x3fc92492, + 0x4011c71c, 0x3fc92492, 0x402e38e4, 0x3fc92492, + 0x404aaaab, 0x3fc92492, 0x40671c72, 0x3fc92492, + 0x4081c71c, 0x3fc92492, 0x40900000, 0x3fc92492, + 0x3f000000, 0x3ff6db6e, 0x3f71c71c, 0x3ff6db6e, + 0x3fb1c71c, 0x3ff6db6e, 0x3feaaaab, 0x3ff6db6e, + 0x4011c71c, 0x3ff6db6e, 0x402e38e4, 0x3ff6db6e, + 0x404aaaab, 0x3ff6db6e, 0x40671c72, 0x3ff6db6e, + 0x4081c71c, 0x3ff6db6e, 0x40900000, 0x3ff6db6e, + 0x3f000000, 0x40124925, 0x3f71c71c, 0x40124925, + 0x3fb1c71c, 0x40124925, 0x3feaaaab, 0x40124925, + 0x4011c71c, 0x40124925, 0x402e38e4, 0x40124925, + 0x404aaaab, 0x40124925, 0x40671c72, 0x40124925, + 0x4081c71c, 0x40124925, 0x40900000, 0x40124925, + 0x3f000000, 0x40292492, 0x3f71c71c, 0x40292492, + 0x3fb1c71c, 0x40292492, 0x3feaaaab, 0x40292492, + 0x4011c71c, 0x40292492, 0x402e38e4, 0x40292492, + 0x404aaaab, 0x40292492, 0x40671c72, 0x40292492, + 0x4081c71c, 0x40292492, 0x40900000, 0x40292492, + 0x3f000000, 0x40400000, 0x3f71c71c, 0x40400000, + 0x3fb1c71c, 0x40400000, 0x3feaaaab, 0x40400000, + 0x4011c71c, 0x40400000, 0x402e38e4, 0x40400000, + 0x404aaaab, 0x40400000, 0x40671c72, 0x40400000, + 0x4081c71c, 0x40400000, 0x40900000, 0x40400000, + 0x3f000000, 0x4056db6e, 0x3f71c71c, 0x4056db6e, + 0x3fb1c71c, 0x4056db6e, 0x3feaaaab, 0x4056db6e, + 0x4011c71c, 0x4056db6e, 0x402e38e4, 0x4056db6e, + 0x404aaaab, 0x4056db6e, 0x40671c72, 0x4056db6e, + 0x4081c71c, 0x4056db6e, 0x40900000, 0x4056db6e, + 0x3f000000, 0x406db6db, 0x3f71c71c, 0x406db6db, + 0x3fb1c71c, 0x406db6db, 0x3feaaaab, 0x406db6db, + 0x4011c71c, 0x406db6db, 0x402e38e4, 0x406db6db, + 0x404aaaab, 0x406db6db, 0x40671c72, 0x406db6db, + 0x4081c71c, 0x406db6db, 0x40900000, 0x406db6db, + 0x3f000000, 0x40824925, 0x3f71c71c, 0x40824925, + 0x3fb1c71c, 0x40824925, 0x3feaaaab, 0x40824925, + 0x4011c71c, 0x40824925, 0x402e38e4, 0x40824925, + 0x404aaaab, 0x40824925, 0x40671c72, 0x40824925, + 0x4081c71c, 0x40824925, 0x40900000, 0x40824925, + 0x3f000000, 0x408db6db, 0x3f71c71c, 0x408db6db, + 0x3fb1c71c, 0x408db6db, 0x3feaaaab, 0x408db6db, + 0x4011c71c, 0x408db6db, 0x402e38e4, 0x408db6db, + 0x404aaaab, 0x408db6db, 0x40671c72, 0x408db6db, + 0x4081c71c, 0x408db6db, 0x40900000, 0x408db6db, + 0x3f000000, 0x40992492, 0x3f71c71c, 0x40992492, + 0x3fb1c71c, 0x40992492, 0x3feaaaab, 0x40992492, + 0x4011c71c, 0x40992492, 0x402e38e4, 0x40992492, + 0x404aaaab, 0x40992492, 0x40671c72, 0x40992492, + 0x4081c71c, 0x40992492, 0x40900000, 0x40992492, + 0x3f000000, 0x40a49249, 0x3f71c71c, 0x40a49249, + 0x3fb1c71c, 0x40a49249, 0x3feaaaab, 0x40a49249, + 0x4011c71c, 0x40a49249, 0x402e38e4, 0x40a49249, + 0x404aaaab, 0x40a49249, 0x40671c72, 0x40a49249, + 0x4081c71c, 0x40a49249, 0x40900000, 0x40a49249, + 0x3f000000, 0x40b00000, 0x3f71c71c, 0x40b00000, + 0x3fb1c71c, 0x40b00000, 0x3feaaaab, 0x40b00000, + 0x4011c71c, 0x40b00000, 0x402e38e4, 0x40b00000, + 0x404aaaab, 0x40b00000, 0x40671c72, 0x40b00000, + 0x4081c71c, 0x40b00000, 0x40900000, 0x40b00000 + }; + +static const uint32_t in_bilinear_y[56] = { + 0x3f439c04, 0x3f74696e, 0xbf7c94a5, 0xbee0bd26, + 0xbf6c26ca, 0x3f2f0760, 0xbf397af7, 0x3eba7727, + 0xbf16e889, 0x3ef1dec0, 0xbf357caf, 0xbd8b206e, + 0x3ef0c510, 0x3f62d676, 0xbea8698d, 0x3f1e92e0, + 0xbf01546e, 0x3f2e92b4, 0x3cf8f034, 0xbedf9e01, + 0xbf672322, 0xbf54f3bc, 0xbf6a4a0e, 0x3f764875, + 0x3f098ab3, 0x3f75c630, 0xbf42f0f3, 0x3f2471ec, + 0xbed9598b, 0xbf7dddde, 0x3f76e386, 0x3cbe0990, + 0x3f2d38c6, 0xbea1d6cc, 0x3f724069, 0xbf6c26ca, + 0xbf524be8, 0x3f646d20, 0x3f303724, 0x3f7eed46, + 0xbf5f05de, 0x3ef7f7e6, 0x3d47ecfa, 0x3f5e5108, + 0xbf4aadad, 0x3eb76c87, 0xbeb14c2a, 0xbd8b206e, + 0xbf7f8898, 0xbe4eaf46, 0xbf6f315c, 0x3f6051a1, + 0xbe577368, 0x3ef90f23, 0xbdb0c5a8, 0x3f7ede79 + }; + +static const uint16_t in_bilinear_config[2] = { + 0x0007, 0x0008 + }; + +static const uint32_t ref_bilinear[150] = { + 0x3ebf2c3e, 0x3e50b615, 0x3c3e419d, 0xbe3c3dd2, + 0xbeb0b445, 0xbef8cc43, 0xbf0f9198, 0xbf069c2b, + 0xbedf0b77, 0x3d277c41, 0x3cd6c86d, 0xbea66424, + 0xbdfb712d, 0x3e224bd4, 0x3b913226, 0xbed257f4, + 0xbf171e34, 0xbec0edbb, 0xbe1b45ea, 0x3e1f18fc, + 0xbd6b0b94, 0xbe99a5e9, 0xbdcc27d9, 0x3e27f660, + 0x3d9b21cd, 0xbe6517a4, 0xbeb3502c, 0xbe40f3fb, + 0xbced0521, 0x3dea8714, 0x3d0e3898, 0x3dc05a66, + 0x3ce88d20, 0xbd612497, 0xbd1d6676, 0x3d1bd6d7, + 0x3d8e7eca, 0x3cd6a813, 0xbc61887e, 0xbcf4e140, + 0x3e01df31, 0x3ef9d31c, 0x3e203735, 0xbe8c4456, + 0xbe1c4421, 0x3e998188, 0x3efa8f91, 0x3e769e00, + 0x3ab7ca27, 0xbe327bda, 0xbe1553bd, 0x3e14207b, + 0x3d9e01cc, 0xbd29f3c3, 0x3ded3fa8, 0x3ee0a648, + 0x3f154a4c, 0x3edc2ad1, 0x3e8012da, 0xbdef21b6, + 0xbf0279ea, 0xbec41279, 0xbd5d3180, 0x3e9b90cd, + 0x3ef5bbb4, 0x3f0c0946, 0x3f186f74, 0x3f1ce23b, + 0x3f0ea9d5, 0xbc0f3300, 0xbf5f9ee5, 0xbf691a98, + 0xbe3d99a6, 0x3f26300a, 0x3f5813bf, 0x3f27bf69, + 0x3f1b949d, 0x3f4baf0e, 0x3f5d4a3c, 0x3dcb54f6, + 0xbf507ee7, 0xbf6da36d, 0xbe4e5ae5, 0x3f2533de, + 0x3f4b2d71, 0x3f05dccf, 0x3ee0304c, 0x3f29921c, + 0x3f47148d, 0x3e03496f, 0xbf415eea, 0xbf722c41, + 0xbe5f1c23, 0x3f2437b2, 0x3f3e4723, 0x3ec7f46b, + 0x3e89375e, 0x3f07752b, 0x3f30dede, 0x3e20e863, + 0xbf384477, 0xbf735df8, 0xbe66f52b, 0x3f22d969, + 0x3f36625f, 0x3ea292f8, 0x3e33b5a4, 0x3ee8ed61, + 0x3f240cff, 0x3e2ff9e6, 0xbf474030, 0xbf673338, + 0xbe4b2d5c, 0x3f1ff2ac, 0x3f4283bf, 0x3ef6c087, + 0x3ec8efcf, 0x3f1df215, 0x3f3cca5e, 0x3e04d5a2, + 0xbf563be9, 0xbf5b0878, 0xbe2f658c, 0x3f1d0bee, + 0x3f4ea520, 0x3f25770b, 0x3f1c0266, 0x3f476d79, + 0x3f5587be, 0x3db362bc, 0xbf2e9006, 0xbf17641e, + 0xbdceea98, 0x3ee49179, 0x3f261744, 0x3f24e479, + 0x3f2b17fa, 0x3f3da0a4, 0x3f37a691, 0x3cc329cf, + 0xbe53a2da, 0xbb095b58, 0x3d0ade74, 0x3d3badd2, + 0x3e3a0a34, 0x3ec8a7bf, 0x3efafc5e, 0x3ecdcef0, + 0x3e8faf21, 0xbd944576 + }; + +static const uint32_t in_spline_squ_x[4] = { + 0x0, 0x40400000, 0x41200000, 0x41a00000 + }; + +static const uint32_t in_spline_squ_y[4] = { + 0x0, 0x41100000, 0x42c80000, 0x43c80000 + }; + +static const uint32_t in_spline_squ_xq[20] = { + 0x0, 0x3f800000, 0x40000000, 0x40400000, + 0x40800000, 0x40a00000, 0x40c00000, 0x40e00000, + 0x41000000, 0x41100000, 0x41200000, 0x41300000, + 0x41400000, 0x41500000, 0x41600000, 0x41700000, + 0x41800000, 0x41880000, 0x41900000, 0x41980000 + }; + +static const uint32_t in_spline_sin_x[9] = { + 0x0, 0x3f490fdb, 0x3fc90fdb, 0x4016cbe4, + 0x40490fdb, 0x407b53d1, 0x4096cbe4, 0x40afeddf, + 0x40c90fdb + }; + +static const uint32_t in_spline_sin_y[9] = { + 0x0, 0x3f3504f3, 0x3f800000, 0x3f3504f3, + 0x250d3132, 0xbf3504f3, 0xbf800000, 0xbf3504f3, + 0xa58d3132 + }; + +static const uint32_t in_spline_sin_xq[33] = { + 0x0, 0x3e490fdb, 0x3ec90fdb, 0x3f16cbe4, + 0x3f490fdb, 0x3f7b53d1, 0x3f96cbe4, 0x3fafeddf, + 0x3fc90fdb, 0x3fe231d6, 0x3ffb53d1, 0x400a3ae6, + 0x4016cbe4, 0x40235ce2, 0x402feddf, 0x403c7edd, + 0x40490fdb, 0x4055a0d8, 0x406231d6, 0x406ec2d4, + 0x407b53d1, 0x4083f267, 0x408a3ae6, 0x40908365, + 0x4096cbe4, 0x409d1463, 0x40a35ce2, 0x40a9a560, + 0x40afeddf, 0x40b6365e, 0x40bc7edd, 0x40c2c75c, + 0x40c90fdb + }; + +static const uint32_t in_spline_ram_x[3] = { + 0x0, 0x40400000, 0x41200000 + }; + +static const uint32_t in_spline_ram_y[3] = { + 0x0, 0x40400000, 0x41200000 + }; + +static const uint32_t in_spline_ram_xq[30] = { + 0xc1200000, 0xc1100000, 0xc1000000, 0xc0e00000, + 0xc0c00000, 0xc0a00000, 0xc0800000, 0xc0400000, + 0xc0000000, 0xbf800000, 0x0, 0x3f800000, + 0x40000000, 0x40400000, 0x40800000, 0x40a00000, + 0x40c00000, 0x40e00000, 0x41000000, 0x41100000, + 0x41200000, 0x41300000, 0x41400000, 0x41500000, + 0x41600000, 0x41700000, 0x41800000, 0x41880000, + 0x41900000, 0x41980000 + }; + +static const uint32_t ref_spline_squ[20] = { + 0x0, 0x3f800000, 0x40800000, 0x41100000, + 0x41800000, 0x41c80000, 0x42100000, 0x42440000, + 0x42800000, 0x42a20000, 0x42c80000, 0x42f20000, + 0x43100000, 0x43290000, 0x43440000, 0x43610000, + 0x43800000, 0x43908000, 0x43a20000, 0x43b48000 + }; + +static const uint32_t ref_spline_sin[33] = { + 0x0, 0x3e476168, 0x3ec3b551, 0x3f0e30df, + 0x3f3504f3, 0x3f54aebc, 0x3f6c3da3, 0x3f7aeef6, + 0x3f800000, 0x3f7aeef6, 0x3f6c3da3, 0x3f54aebc, + 0x3f3504f3, 0x3f0e30df, 0x3ec3b551, 0x3e476168, + 0x250d3132, 0xbe476168, 0xbec3b551, 0xbf0e30df, + 0xbf3504f3, 0xbf54aebc, 0xbf6c3da3, 0xbf7aeef6, + 0xbf800000, 0xbf7aeef6, 0xbf6c3da3, 0xbf54aebc, + 0xbf3504f3, 0xbf0e30df, 0xbec3b551, 0xbe476168, + 0xa5a00000 + }; + +static const uint32_t ref_spline_ram[30] = { + 0xc1200000, 0xc1100000, 0xc1000000, 0xc0e00000, + 0xc0c00000, 0xc0a00000, 0xc0800000, 0xc0400000, + 0xc0000000, 0xbf800000, 0x0, 0x3f800000, + 0x40000000, 0x40400000, 0x40800000, 0x40a00000, + 0x40c00000, 0x40e00000, 0x41000000, 0x41100000, + 0x41200000, 0x41300000, 0x41400000, 0x41500000, + 0x41600000, 0x41700000, 0x41800000, 0x41880000, + 0x41900000, 0x41980000 + }; + diff --git a/tests/lib/cmsis_dsp/interpolation/src/main.c b/tests/lib/cmsis_dsp/interpolation/src/main.c index b3c44315d00..4226bcb8848 100644 --- a/tests/lib/cmsis_dsp/interpolation/src/main.c +++ b/tests/lib/cmsis_dsp/interpolation/src/main.c @@ -10,10 +10,12 @@ extern void test_interpolation_q7(void); extern void test_interpolation_q15(void); extern void test_interpolation_q31(void); +extern void test_interpolation_f32(void); void test_main(void) { test_interpolation_q7(); test_interpolation_q15(); test_interpolation_q31(); + test_interpolation_f32(); }