espressif / esp-dsp

DSP library for ESP-IDF
Apache License 2.0
465 stars 87 forks source link

Use load with increment to speed up inner FIR loop #28

Closed Barabas5532 closed 3 years ago

Barabas5532 commented 3 years ago

The lsxp instruction can load from, and increment a pointer in a single instruction. This is slightly faster than the current implementation, which uses lsi, lsx and addi. Around 15% less time is required for operation according to the provided benchmarks.

master branch
dsps_fir_f32_ae32: dsps_fir_f32_ae32 - 188.080078 per sample for for 32 coefficients, 5.877502 per tap
+----------------------------------------------------------+----------+----------+
| **FIR Filters**                                          |          |          |
+----------------------------------------------------------+----------+----------+
| dsps_fir_f32 1024 input samples and 256 coefficients     |  1343487 |  2152816 |
+----------------------------------------------------------+----------+----------+

this branch
dsps_fir_f32_ae32: dsps_fir_f32_ae32 - 159.625977 per sample for for 32 coefficients, 4.988312 per tap
+----------------------------------------------------------+----------+----------+
| **FIR Filters**                                          |          |          |
+----------------------------------------------------------+----------+----------+
| dsps_fir_f32 1024 input samples and 256 coefficients     |  1083014 |  2152791 |
+----------------------------------------------------------+----------+----------+
igrr commented 3 years ago

Thanks for the PR @Barabas5532, it has been cherry-picked in https://github.com/espressif/esp-dsp/commit/90505fd0d9d544cd04f50c46f328d68b3adf7042.