nrfxlib API 2.7.99
Loading...
Searching...
No Matches
sw_codec_lc3.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: Nordic-5-Clause
7 *
8 * Redistribution and use in source and binary forms, with or without modification,
9 * are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright notice, this
12 * list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form, except as embedded into a Nordic
15 * Semiconductor ASA integrated circuit in a product or a software update for
16 * such product, must reproduce the above copyright notice, this list of
17 * conditions and the following disclaimer in the documentation and/or other
18 * materials provided with the distribution.
19 *
20 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
21 * contributors may be used to endorse or promote products derived from this
22 * software without specific prior written permission.
23 *
24 * 4. This software, with or without modification, must only be used with a
25 * Nordic Semiconductor ASA integrated circuit.
26 *
27 * 5. Any software provided in binary form under this license must not be reverse
28 * engineered, decompiled, modified and/or disassembled.
29 *
30 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
31 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
32 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
34 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
36 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
39 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 */
42
43#ifndef __SW_CODEC_LC3_H__
44#define __SW_CODEC_LC3_H__
45
46#include <zephyr/types.h>
47
48#define LC3_USE_BITRATE_FROM_INIT 0
49
76int sw_codec_lc3_enc_run(void const *const pcm_data, uint32_t pcm_data_size, uint32_t enc_bitrate,
77 uint8_t audio_ch, uint16_t lc3_data_buf_size, uint8_t *const lc3_data,
78 uint16_t *const lc3_data_wr_size);
79
97int sw_codec_lc3_dec_run(uint8_t const *const lc3_data, uint16_t lc3_data_size,
98 uint16_t pcm_data_buf_size, uint8_t audio_ch, void *const pcm_data,
99 uint16_t *const pcm_data_wr_size, bool bad_frame);
100
106
112
117int sw_codec_lc3_init(uint8_t *sw_codec_lc3_buffer, uint32_t *sw_codec_lc3_buffer_size,
118 uint16_t framesize_us);
119
138int sw_codec_lc3_enc_init(uint16_t pcm_sample_rate, uint8_t pcm_bit_depth, uint16_t framesize_us,
139 uint32_t enc_bitrate, uint8_t num_channels,
140 uint16_t *const pcm_bytes_req);
141
154int sw_codec_lc3_dec_init(uint16_t pcm_sample_rate, uint8_t pcm_bit_depth, uint16_t framesize_us,
155 uint8_t num_channels);
156 /* LC3_translation */
158
159#endif /* __SW_CODEC_LC3_H__ */
int sw_codec_lc3_enc_run(void const *const pcm_data, uint32_t pcm_data_size, uint32_t enc_bitrate, uint8_t audio_ch, uint16_t lc3_data_buf_size, uint8_t *const lc3_data, uint16_t *const lc3_data_wr_size)
Runs the LC3 encoder.
int sw_codec_lc3_enc_uninit_all(void)
Closes the LC3 encoder and frees allocated RAM.
int sw_codec_lc3_dec_init(uint16_t pcm_sample_rate, uint8_t pcm_bit_depth, uint16_t framesize_us, uint8_t num_channels)
Initializes the LC3 decoder and allocates required RAM.
int sw_codec_lc3_dec_run(uint8_t const *const lc3_data, uint16_t lc3_data_size, uint16_t pcm_data_buf_size, uint8_t audio_ch, void *const pcm_data, uint16_t *const pcm_data_wr_size, bool bad_frame)
Runs the LC3 decoder.
int sw_codec_lc3_init(uint8_t *sw_codec_lc3_buffer, uint32_t *sw_codec_lc3_buffer_size, uint16_t framesize_us)
Initializes the LC3 Codec.
int sw_codec_lc3_enc_init(uint16_t pcm_sample_rate, uint8_t pcm_bit_depth, uint16_t framesize_us, uint32_t enc_bitrate, uint8_t num_channels, uint16_t *const pcm_bytes_req)
Initializes the LC3 encoder and allocates required RAM.
int sw_codec_lc3_dec_uninit_all(void)
Closes the LC3 decoder and frees allocated RAM.