Skip to content

lc3: refactor codec init/deinit functions#2039

Merged
koffes merged 1 commit intonrfconnect:mainfrom
ivaniushkov:lc3_init_only_requested_samplerate
Apr 8, 2026
Merged

lc3: refactor codec init/deinit functions#2039
koffes merged 1 commit intonrfconnect:mainfrom
ivaniushkov:lc3_init_only_requested_samplerate

Conversation

@ivaniushkov
Copy link
Copy Markdown
Contributor

@ivaniushkov ivaniushkov commented Mar 9, 2026

  • added encoder and decoder sample rate to
    sw_codec_lc3_init(). The function used to enable all the
    supported sample rates, but it adds redundant overhead to
    LC3 run-time, so the function changed to enable only one
    requested sample rate for both encoder and decoder;
  • added sw_codec_lc3_uninit() function to
    deinit LC3 completely. This change allows changing a codec
    usage flow where we initialize it with only one sample rate,
    and de-initialize the codec when audio stream has stopped;
  • changed type of framesize from LC3FrameSize_t to
    LC3FrameSizeConfig_t to avoid implicit enum conversion
    when passing it to LC3Initialize()

Changes in this commit allow enabling only the required
sample rate in LC3 codec, which decreases RAM usage and
time to initalize codec.

NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Mar 9, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-nrfxlib#2039

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@ivaniushkov ivaniushkov force-pushed the lc3_init_only_requested_samplerate branch from b271422 to 92611e0 Compare March 20, 2026 13:05
@ivaniushkov ivaniushkov marked this pull request as ready for review March 20, 2026 13:05
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Mar 20, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-nrfxlib#2039

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@ivaniushkov ivaniushkov force-pushed the lc3_init_only_requested_samplerate branch from 92611e0 to b298f55 Compare March 20, 2026 13:09
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Mar 20, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-nrfxlib#2039

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@ivaniushkov
Copy link
Copy Markdown
Contributor Author

ivaniushkov commented Mar 20, 2026

Changes in this PR didn't really improve performance of audio app in terms of CPU usage, but it decreases RAM usage and time to initialize lc3 codec.
The PR is ready for review

@ivaniushkov ivaniushkov requested a review from gWacey March 20, 2026 13:22
Comment thread lc3/include/sw_codec_lc3.h Outdated
Comment thread lc3/include/sw_codec_lc3.h
@ivaniushkov ivaniushkov force-pushed the lc3_init_only_requested_samplerate branch from b298f55 to d39ab37 Compare March 31, 2026 12:19
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Mar 31, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-nrfxlib#2039

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@ivaniushkov ivaniushkov force-pushed the lc3_init_only_requested_samplerate branch from d39ab37 to 81767b1 Compare March 31, 2026 12:22
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Mar 31, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-nrfxlib#2039

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@ivaniushkov ivaniushkov requested a review from koffes March 31, 2026 12:54
- added sw_codec_lc3_single_rate_init() function that enables
only one requested sample rate for encoder and decoder,
which decreases RAM usage and time to initialize codec
compared to sw_codec_lc3_init() which enables all supported
sample rates;
- added sw_codec_lc3_uninit() function to deinit LC3
completely. This change allows changing a codec usage flow
where we initialize it with only one sample rate, and
de-initialize the codec when audio stream has stopped;

Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
@ivaniushkov ivaniushkov force-pushed the lc3_init_only_requested_samplerate branch from 81767b1 to 651c0f7 Compare April 7, 2026 10:39
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Apr 7, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-nrfxlib#2039

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

@koffes koffes merged commit 63f0111 into nrfconnect:main Apr 8, 2026
6 checks passed
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request Apr 8, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-nrfxlib#2039

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants