Need improvment in Zephyr LC3 encoding execution time for NRF53 MCU

Hi NRF team,

I am working on a patient monitoring system where we have used a stereo microphone. I am using the LC3 compression method and the Zephyr PDM microphone driver.

As of now, the block duration is 20ms.

So, every 20 ms, we are getting 1280 bytes from the microphone. Now I am compressing the microphone output by using the LC3 lib and encoding those 1280 bytes. The output of the LC3 lib is 160 bytes. And I stream that 160 bytes in BLE custom characteristics.

The issue is that the LC3 library consumes 13- 14ms of time for computation. Even though I am using the work queue, but CPU still needs this much time for the computation. And I need to add other peripherals like accelerometer, barometer, RGB LEDs, NAND flash, haptic and many more with nrf53.

Can we optimise the LC3 lib computation time?

Please find the microphone configuration:

CONFIG_MICROPHONE=y
CONFIG_AUDIO=y
CONFIG_NRFX_PDM=y
# CONFIG_AUDIO_DMIC=y
# CONFIG_AUDIO_DMIC_LOG_LEVEL_DBG=n
CONFIG_NRFX_PDM_LOG=n
CONFIG_DMA=y
CONFIG_MAX_PCM_SAMPLE_RATE=16000
CONFIG_SAMPLE_BIT_WIDTH=16
CONFIG_CHANNEL_COUNT=1
CONFIG_PRIMARY_CHANNEL=0
CONFIG_SH_LC3_CODEC=y
CONFIG_FPU=y
CONFIG_LIBLC3=y
CONFIG_PSCM=y
CONFIG_SW_CODEC_LC3_T2_SH_SOFTWARE=y
CONFIG_CMSIS_DSP=n
# CONFIG_CMSIS_DSP_FASTMATH=n
# CONFIG_CMSIS_DSP_TABLES=n
CONFIG_LC3_ENC_CHAN_MAX=2
CONFIG_LC3_DEC_CHAN_MAX=2
CONFIG_MICROPHONE_L_GAIN=80
CONFIG_MICROPHONE_R_GAIN=80

Parents
  • Hello, 

    Which nRF Connect SDK are you working with? 

    As a general advice, the way to reduce encoding time is to decrease the bitrate. 

    In the current setup, are you encoding the stream sequentially or in parallel? 

    Best regards,

    Maria

  • We have used Zephyr NCS version 3.5.99-ncs1-2 and nrfxlib v2.6.2. I am encoding the stream in one thread, so ideally, it is parallel. Do we have any benchmark document which gives CPU utilisation information? As of now, we have used a bit rate of 32000, so what is the minimum range of bitrate?

  • Hello,

    Based on the nRF Connect SDK repository revisions table, this means that you are using nRF Connect SDK v2.6.2, which is quite old at this point. This means that we are not able to support everything in this release. 

    If you have to stay with v2.6.2, we will do our best. 

    Dhruv@1997 said:
    Do we have any benchmark document which gives CPU utilisation information?

    We don't have any documents which we can release, but information I can share is that LC3 encoding typically uses about 30% of the CPU, while decoding uses about half of that at 15-16%. 

    Dhruv@1997 said:
    As of now, we have used a bit rate of 32000, so what is the minimum range of bitrate?

    32000 kpbs is the minimum bitrate for LC3, unfortunately. 

    So, since you are working on a quite old SDK version, is it feasable for you to upgrade to v3.0.2? We have migration guides which cover the biggest changes. The most important one is v2.7.0 which introduces both the hardware model v2 and sysbuild. I linked the separate migration guides for both those features. 

    Best regards,

    Maria

Reply
  • Hello,

    Based on the nRF Connect SDK repository revisions table, this means that you are using nRF Connect SDK v2.6.2, which is quite old at this point. This means that we are not able to support everything in this release. 

    If you have to stay with v2.6.2, we will do our best. 

    Dhruv@1997 said:
    Do we have any benchmark document which gives CPU utilisation information?

    We don't have any documents which we can release, but information I can share is that LC3 encoding typically uses about 30% of the CPU, while decoding uses about half of that at 15-16%. 

    Dhruv@1997 said:
    As of now, we have used a bit rate of 32000, so what is the minimum range of bitrate?

    32000 kpbs is the minimum bitrate for LC3, unfortunately. 

    So, since you are working on a quite old SDK version, is it feasable for you to upgrade to v3.0.2? We have migration guides which cover the biggest changes. The most important one is v2.7.0 which introduces both the hardware model v2 and sysbuild. I linked the separate migration guides for both those features. 

    Best regards,

    Maria

Children
No Data
Related