mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-31 09:32:57 +00:00
test: switch to Google LC3 codec
This commit is contained in:
parent
9a19cd7860
commit
e40ee29a88
@ -17,26 +17,14 @@ endif()
|
|||||||
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
|
# local dir for btstack_config.h after build dir to avoid using .h from Makefile
|
||||||
include_directories(.)
|
include_directories(.)
|
||||||
|
|
||||||
include_directories(../../3rd-party/kissfft)
|
include_directories(../../3rd-party/lc3-google/include)
|
||||||
include_directories(../../3rd-party/liblc3codec)
|
|
||||||
include_directories(../../3rd-party/tinydir)
|
include_directories(../../3rd-party/tinydir)
|
||||||
include_directories(../../src)
|
|
||||||
include_directories(../../platform/posix)
|
include_directories(../../platform/posix)
|
||||||
|
include_directories(../../src)
|
||||||
include_directories(../../3rd-party/liblc3codec/Api)
|
|
||||||
include_directories(../../3rd-party/liblc3codec/Common)
|
|
||||||
include_directories(../../3rd-party/liblc3codec/Common/KissFft)
|
|
||||||
include_directories(../../3rd-party/liblc3codec/Common/Tables)
|
|
||||||
include_directories(../../3rd-party/liblc3codec/TestSupport)
|
|
||||||
|
|
||||||
file(GLOB SOURCES_POSIX "../../platform/posix/*.c")
|
file(GLOB SOURCES_POSIX "../../platform/posix/*.c")
|
||||||
file(GLOB SOURCES_SRC "../../src/*.c" "../../src/*.cpp")
|
file(GLOB SOURCES_SRC "../../src/*.c" "../../src/*.cpp")
|
||||||
file(GLOB LC3_COMMON "../../3rd-party/liblc3codec/Common/*.cpp")
|
file(GLOB SOURCES_LC3_GOOGLE "../../3rd-party/lc3-google/src/*.c")
|
||||||
file(GLOB LC3_TABLES "../../3rd-party/liblc3codec/Common/Tables/*.cpp")
|
|
||||||
file(GLOB LC3_DECODER "../../3rd-party/liblc3codec/Decoder/*.cpp")
|
|
||||||
file(GLOB LC3_ENCODER "../../3rd-party/liblc3codec/Encoder/*.cpp")
|
|
||||||
|
|
||||||
set (SOURCES_LC3 ${LC3_COMMON} ${LC3_TABLES} ${LC3_DECODER} ${LC3_ENCODER} ${LC3_TESTSUPPORT})
|
|
||||||
|
|
||||||
# Enable ASAN
|
# Enable ASAN
|
||||||
add_compile_options( -g -fsanitize=address)
|
add_compile_options( -g -fsanitize=address)
|
||||||
@ -46,7 +34,7 @@ add_link_options( -fsanitize=address)
|
|||||||
file(GLOB EXAMPLES "lc3_*.c")
|
file(GLOB EXAMPLES "lc3_*.c")
|
||||||
foreach(EXAMPLE_FILE ${EXAMPLES})
|
foreach(EXAMPLE_FILE ${EXAMPLES})
|
||||||
get_filename_component(EXAMPLE ${EXAMPLE_FILE} NAME_WE)
|
get_filename_component(EXAMPLE ${EXAMPLE_FILE} NAME_WE)
|
||||||
set (SOURCE_FILES ${SOURCES_POSIX} ${SOURCES_SRC} ${SOURCES_LC3} ${EXAMPLE_FILE})
|
set (SOURCE_FILES ${SOURCES_POSIX} ${SOURCES_SRC} ${SOURCES_LC3_GOOGLE} ${EXAMPLE_FILE})
|
||||||
message("Tool: ${EXAMPLE}")
|
message("Tool: ${EXAMPLE}")
|
||||||
add_executable(${EXAMPLE} ${SOURCE_FILES} )
|
add_executable(${EXAMPLE} ${SOURCE_FILES} )
|
||||||
endforeach(EXAMPLE_FILE)
|
endforeach(EXAMPLE_FILE)
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#define HAVE_MALLOC
|
#define HAVE_MALLOC
|
||||||
#define HAVE_POSIX_FILE_IO
|
#define HAVE_POSIX_FILE_IO
|
||||||
#define HAVE_POSIX_TIME
|
#define HAVE_POSIX_TIME
|
||||||
#define HAVE_LC3_EHIMA
|
|
||||||
|
|
||||||
// BTstack features that can be enabled
|
// BTstack features that can be enabled
|
||||||
#define ENABLE_BLE
|
#define ENABLE_BLE
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
//
|
//
|
||||||
// LC3 decoder EHIMA
|
// LC3 decoder Google
|
||||||
//
|
//
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
|
|
||||||
@ -53,7 +53,7 @@
|
|||||||
#include "btstack_debug.h"
|
#include "btstack_debug.h"
|
||||||
|
|
||||||
#include "btstack_lc3.h"
|
#include "btstack_lc3.h"
|
||||||
#include "btstack_lc3_ehima.h"
|
#include "btstack_lc3_google.h"
|
||||||
|
|
||||||
#define MAX_NUM_CHANNELS 2
|
#define MAX_NUM_CHANNELS 2
|
||||||
#define MAX_SAMPLES_PER_FRAME 480
|
#define MAX_SAMPLES_PER_FRAME 480
|
||||||
@ -133,11 +133,11 @@ int main (int argc, const char * argv[]){
|
|||||||
|
|
||||||
// init decoder
|
// init decoder
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
lc3_decoder_ehima_t decoder_contexts[MAX_NUM_CHANNELS];
|
btstack_lc3_decoder_google_t decoder_contexts[MAX_NUM_CHANNELS];
|
||||||
const btstack_lc3_decoder_t * lc3_decoder;
|
const btstack_lc3_decoder_t * lc3_decoder;
|
||||||
for (channel = 0 ; channel < num_channels ; channel++){
|
for (channel = 0 ; channel < num_channels ; channel++){
|
||||||
lc3_decoder_ehima_t * decoder_context = &decoder_contexts[channel];
|
btstack_lc3_decoder_google_t * decoder_context = &decoder_contexts[channel];
|
||||||
lc3_decoder = lc3_decoder_ehima_init_instance(decoder_context);
|
lc3_decoder = btstack_lc3_decoder_google_init_instance(decoder_context);
|
||||||
lc3_decoder->configure(decoder_context, sample_rate_hz, duration2);
|
lc3_decoder->configure(decoder_context, sample_rate_hz, duration2);
|
||||||
}
|
}
|
||||||
|
|
@ -53,7 +53,7 @@
|
|||||||
#include "btstack_debug.h"
|
#include "btstack_debug.h"
|
||||||
|
|
||||||
#include "btstack_lc3.h"
|
#include "btstack_lc3.h"
|
||||||
#include "btstack_lc3_ehima.h"
|
#include "btstack_lc3_google.h"
|
||||||
|
|
||||||
#define MAX_NUM_CHANNELS 2
|
#define MAX_NUM_CHANNELS 2
|
||||||
#define MAX_SAMPLES_PER_FRAME 480
|
#define MAX_SAMPLES_PER_FRAME 480
|
||||||
@ -110,11 +110,11 @@ int main (int argc, const char * argv[]){
|
|||||||
|
|
||||||
// init decoder
|
// init decoder
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
lc3_encoder_ehima_t encoder_contexts[MAX_NUM_CHANNELS];
|
btstack_lc3_encoder_google_t encoder_contexts[MAX_NUM_CHANNELS];
|
||||||
const btstack_lc3_encoder_t * lc3_encoder;
|
const btstack_lc3_encoder_t * lc3_encoder;
|
||||||
for (channel = 0 ; channel < num_channels ; channel++){
|
for (channel = 0 ; channel < num_channels ; channel++){
|
||||||
lc3_encoder_ehima_t * encoder_context = &encoder_contexts[channel];
|
btstack_lc3_encoder_google_t * encoder_context = &encoder_contexts[channel];
|
||||||
lc3_encoder = lc3_encoder_ehima_init_instance(encoder_context);
|
lc3_encoder = btstack_lc3_encoder_google_init_instance(encoder_context);
|
||||||
lc3_encoder->configure(encoder_context, sampling_frequency_hz, frame_duration);
|
lc3_encoder->configure(encoder_context, sampling_frequency_hz, frame_duration);
|
||||||
}
|
}
|
||||||
uint32_t bitrate_per_channel = lc3_encoder->get_bitrate_for_number_of_octets(&encoder_contexts[0], bytes_per_frame);
|
uint32_t bitrate_per_channel = lc3_encoder->get_bitrate_for_number_of_octets(&encoder_contexts[0], bytes_per_frame);
|
@ -75,12 +75,7 @@ include_directories(../../3rd-party/bluedroid/encoder/include)
|
|||||||
include_directories(../../3rd-party/md5)
|
include_directories(../../3rd-party/md5)
|
||||||
include_directories(../../3rd-party/hxcmod-player)
|
include_directories(../../3rd-party/hxcmod-player)
|
||||||
include_directories(../../3rd-party/hxcmod-player/mod)
|
include_directories(../../3rd-party/hxcmod-player/mod)
|
||||||
include_directories(../../3rd-party/kissfft)
|
include_directories(../../3rd-party/lc3-google/include)
|
||||||
include_directories(../../3rd-party/liblc3codec/Api)
|
|
||||||
include_directories(../../3rd-party/liblc3codec/Common)
|
|
||||||
include_directories(../../3rd-party/liblc3codec/Common/KissFft)
|
|
||||||
include_directories(../../3rd-party/liblc3codec/Common/Tables)
|
|
||||||
include_directories(../../3rd-party/liblc3codec/TestSupport)
|
|
||||||
include_directories(../../3rd-party/lwip/core/src/include)
|
include_directories(../../3rd-party/lwip/core/src/include)
|
||||||
include_directories(../../3rd-party/lwip/dhcp-server)
|
include_directories(../../3rd-party/lwip/dhcp-server)
|
||||||
include_directories(../../3rd-party/rijndael)
|
include_directories(../../3rd-party/rijndael)
|
||||||
@ -107,13 +102,7 @@ file(GLOB SOURCES_RIJNDAEL "../../3rd-party/rijndael/rijndael.c")
|
|||||||
file(GLOB SOURCES_POSIX "../../platform/posix/*.c")
|
file(GLOB SOURCES_POSIX "../../platform/posix/*.c")
|
||||||
file(GLOB SOURCES_MAIN "main.c")
|
file(GLOB SOURCES_MAIN "main.c")
|
||||||
file(GLOB SOURCES_ZEPHYR "../../chipset/zephyr/*.c")
|
file(GLOB SOURCES_ZEPHYR "../../chipset/zephyr/*.c")
|
||||||
|
file(GLOB SOURCES_LC3_GOOGLE "../../3rd-party/lc3-google/src/*.c")
|
||||||
file(GLOB LC3_COMMON "../../3rd-party/liblc3codec/Common/*.cpp")
|
|
||||||
file(GLOB LC3_TABLES "../../3rd-party/liblc3codec/Common/Tables/*.cpp")
|
|
||||||
file(GLOB LC3_DECODER "../../3rd-party/liblc3codec/Decoder/*.cpp")
|
|
||||||
file(GLOB LC3_ENCODER "../../3rd-party/liblc3codec/Encoder/*.cpp")
|
|
||||||
|
|
||||||
set (SOURCES_LC3 ${LC3_COMMON} ${LC3_TABLES} ${LC3_DECODER} ${LC3_ENCODER} ${LC3_TESTSUPPORT})
|
|
||||||
|
|
||||||
file(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c")
|
file(GLOB SOURCES_BLE_OFF "../../src/ble/le_device_db_memory.c")
|
||||||
list(REMOVE_ITEM SOURCES_BLE ${SOURCES_BLE_OFF})
|
list(REMOVE_ITEM SOURCES_BLE ${SOURCES_BLE_OFF})
|
||||||
@ -124,7 +113,7 @@ list(REMOVE_ITEM SOURCES_POSIX ${SOURCES_POSIX_OFF})
|
|||||||
set(SOURCES
|
set(SOURCES
|
||||||
${SOURCES_MD5}
|
${SOURCES_MD5}
|
||||||
${SOURCES_YXML}
|
${SOURCES_YXML}
|
||||||
${SOURCES_LC3}
|
${SOURCES_LC3_GOOGLE}
|
||||||
${SOURCES_POSIX}
|
${SOURCES_POSIX}
|
||||||
${SOURCES_MAIN}
|
${SOURCES_MAIN}
|
||||||
${SOURCES_RIJNDAEL}
|
${SOURCES_RIJNDAEL}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#define HAVE_MALLOC
|
#define HAVE_MALLOC
|
||||||
#define HAVE_POSIX_FILE_IO
|
#define HAVE_POSIX_FILE_IO
|
||||||
#define HAVE_POSIX_TIME
|
#define HAVE_POSIX_TIME
|
||||||
#define HAVE_LC3_EHIMA
|
|
||||||
|
|
||||||
// BTstack features that can be enabled
|
// BTstack features that can be enabled
|
||||||
#define ENABLE_ATT_DELAYED_RESPONSE
|
#define ENABLE_ATT_DELAYED_RESPONSE
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
#include "hci.h"
|
#include "hci.h"
|
||||||
#include "hci_cmd.h"
|
#include "hci_cmd.h"
|
||||||
#include "btstack_lc3.h"
|
#include "btstack_lc3.h"
|
||||||
#include "btstack_lc3_ehima.h"
|
#include "btstack_lc3_google.h"
|
||||||
#include "wav_util.h"
|
#include "wav_util.h"
|
||||||
|
|
||||||
// max config
|
// max config
|
||||||
@ -152,7 +152,7 @@ static uint8_t num_bis;
|
|||||||
|
|
||||||
// lc3 decoder
|
// lc3 decoder
|
||||||
static const btstack_lc3_decoder_t * lc3_decoder;
|
static const btstack_lc3_decoder_t * lc3_decoder;
|
||||||
static lc3_decoder_ehima_t decoder_contexts[MAX_NUM_BIS];
|
static btstack_lc3_decoder_google_t decoder_contexts[MAX_NUM_BIS];
|
||||||
static int16_t pcm[MAX_NUM_BIS * MAX_SAMPLES_PER_FRAME];
|
static int16_t pcm[MAX_NUM_BIS * MAX_SAMPLES_PER_FRAME];
|
||||||
|
|
||||||
// playback
|
// playback
|
||||||
@ -216,8 +216,8 @@ static void open_lc3_file(void) {
|
|||||||
static void setup_lc3_decoder(void){
|
static void setup_lc3_decoder(void){
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
for (channel = 0 ; channel < num_bis ; channel++){
|
for (channel = 0 ; channel < num_bis ; channel++){
|
||||||
lc3_decoder_ehima_t * decoder_context = &decoder_contexts[channel];
|
btstack_lc3_decoder_google_t * decoder_context = &decoder_contexts[channel];
|
||||||
lc3_decoder = lc3_decoder_ehima_init_instance(decoder_context);
|
lc3_decoder = btstack_lc3_decoder_google_init_instance(decoder_context);
|
||||||
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration);
|
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration);
|
||||||
}
|
}
|
||||||
number_samples_per_frame = lc3_decoder->get_number_samples_per_frame(&decoder_contexts[0]);
|
number_samples_per_frame = lc3_decoder->get_number_samples_per_frame(&decoder_contexts[0]);
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
#include "hci_cmd.h"
|
#include "hci_cmd.h"
|
||||||
#include "hci_dump.h"
|
#include "hci_dump.h"
|
||||||
#include "btstack_lc3.h"
|
#include "btstack_lc3.h"
|
||||||
#include "btstack_lc3_ehima.h"
|
#include "btstack_lc3_google.h"
|
||||||
|
|
||||||
#include "hxcmod.h"
|
#include "hxcmod.h"
|
||||||
#include "mods/mod.h"
|
#include "mods/mod.h"
|
||||||
@ -241,7 +241,7 @@ static uint8_t num_bis = 1;
|
|||||||
|
|
||||||
// lc3 encoder
|
// lc3 encoder
|
||||||
static const btstack_lc3_encoder_t * lc3_encoder;
|
static const btstack_lc3_encoder_t * lc3_encoder;
|
||||||
static lc3_encoder_ehima_t encoder_contexts[MAX_NUM_BIS];
|
static btstack_lc3_encoder_google_t encoder_contexts[MAX_NUM_BIS];
|
||||||
static int16_t pcm[MAX_NUM_BIS * MAX_SAMPLES_PER_FRAME];
|
static int16_t pcm[MAX_NUM_BIS * MAX_SAMPLES_PER_FRAME];
|
||||||
static uint32_t time_generation_ms;
|
static uint32_t time_generation_ms;
|
||||||
|
|
||||||
@ -348,8 +348,8 @@ static void print_config(void) {
|
|||||||
static void setup_lc3_encoder(void){
|
static void setup_lc3_encoder(void){
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
for (channel = 0 ; channel < num_bis ; channel++){
|
for (channel = 0 ; channel < num_bis ; channel++){
|
||||||
lc3_encoder_ehima_t * context = &encoder_contexts[channel];
|
btstack_lc3_encoder_google_t * context = &encoder_contexts[channel];
|
||||||
lc3_encoder = lc3_encoder_ehima_init_instance(context);
|
lc3_encoder = btstack_lc3_encoder_google_init_instance(context);
|
||||||
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration);
|
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration);
|
||||||
}
|
}
|
||||||
number_samples_per_frame = lc3_encoder->get_number_samples_per_frame(&encoder_contexts[0]);
|
number_samples_per_frame = lc3_encoder->get_number_samples_per_frame(&encoder_contexts[0]);
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
#include "hci.h"
|
#include "hci.h"
|
||||||
#include "hci_cmd.h"
|
#include "hci_cmd.h"
|
||||||
#include "btstack_lc3.h"
|
#include "btstack_lc3.h"
|
||||||
#include "btstack_lc3_ehima.h"
|
#include "btstack_lc3_google.h"
|
||||||
#include "wav_util.h"
|
#include "wav_util.h"
|
||||||
|
|
||||||
// max config
|
// max config
|
||||||
@ -155,7 +155,7 @@ static uint8_t num_channels;
|
|||||||
|
|
||||||
// lc3 decoder
|
// lc3 decoder
|
||||||
static const btstack_lc3_decoder_t * lc3_decoder;
|
static const btstack_lc3_decoder_t * lc3_decoder;
|
||||||
static lc3_decoder_ehima_t decoder_contexts[MAX_CHANNELS];
|
static btstack_lc3_decoder_google_t decoder_contexts[MAX_CHANNELS];
|
||||||
static int16_t pcm[MAX_CHANNELS * MAX_SAMPLES_PER_FRAME];
|
static int16_t pcm[MAX_CHANNELS * MAX_SAMPLES_PER_FRAME];
|
||||||
|
|
||||||
// playback
|
// playback
|
||||||
@ -219,8 +219,8 @@ static void open_lc3_file(void) {
|
|||||||
static void setup_lc3_decoder(void){
|
static void setup_lc3_decoder(void){
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
for (channel = 0 ; channel < num_channels ; channel++){
|
for (channel = 0 ; channel < num_channels ; channel++){
|
||||||
lc3_decoder_ehima_t * decoder_context = &decoder_contexts[channel];
|
btstack_lc3_decoder_google_t * decoder_context = &decoder_contexts[channel];
|
||||||
lc3_decoder = lc3_decoder_ehima_init_instance(decoder_context);
|
lc3_decoder = btstack_lc3_decoder_google_init_instance(decoder_context);
|
||||||
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration);
|
lc3_decoder->configure(decoder_context, sampling_frequency_hz, frame_duration);
|
||||||
}
|
}
|
||||||
number_samples_per_frame = lc3_decoder->get_number_samples_per_frame(&decoder_contexts[0]);
|
number_samples_per_frame = lc3_decoder->get_number_samples_per_frame(&decoder_contexts[0]);
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
#include "hci_cmd.h"
|
#include "hci_cmd.h"
|
||||||
#include "hci_dump.h"
|
#include "hci_dump.h"
|
||||||
#include "btstack_lc3.h"
|
#include "btstack_lc3.h"
|
||||||
#include "btstack_lc3_ehima.h"
|
#include "btstack_lc3_google.h"
|
||||||
|
|
||||||
#include "hxcmod.h"
|
#include "hxcmod.h"
|
||||||
#include "mods/mod.h"
|
#include "mods/mod.h"
|
||||||
@ -158,7 +158,7 @@ static uint8_t num_channels = 1;
|
|||||||
|
|
||||||
// lc3 encoder
|
// lc3 encoder
|
||||||
static const btstack_lc3_encoder_t * lc3_encoder;
|
static const btstack_lc3_encoder_t * lc3_encoder;
|
||||||
static lc3_encoder_ehima_t encoder_contexts[MAX_CHANNELS];
|
static btstack_lc3_encoder_google_t encoder_contexts[MAX_CHANNELS];
|
||||||
static int16_t pcm[MAX_CHANNELS * MAX_SAMPLES_PER_FRAME];
|
static int16_t pcm[MAX_CHANNELS * MAX_SAMPLES_PER_FRAME];
|
||||||
static uint32_t time_generation_ms;
|
static uint32_t time_generation_ms;
|
||||||
|
|
||||||
@ -265,8 +265,8 @@ static void print_config(void) {
|
|||||||
static void setup_lc3_encoder(void){
|
static void setup_lc3_encoder(void){
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
for (channel = 0 ; channel < num_channels ; channel++){
|
for (channel = 0 ; channel < num_channels ; channel++){
|
||||||
lc3_encoder_ehima_t * context = &encoder_contexts[channel];
|
btstack_lc3_encoder_google_t * context = &encoder_contexts[channel];
|
||||||
lc3_encoder = lc3_encoder_ehima_init_instance(context);
|
lc3_encoder = btstack_lc3_encoder_google_init_instance(context);
|
||||||
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration);
|
lc3_encoder->configure(context, sampling_frequency_hz, frame_duration);
|
||||||
}
|
}
|
||||||
number_samples_per_frame = lc3_encoder->get_number_samples_per_frame(&encoder_contexts[0]);
|
number_samples_per_frame = lc3_encoder->get_number_samples_per_frame(&encoder_contexts[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user