mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-01 13:20:50 +00:00
btstack_lc3plus_fraunhofer: support stride option for stereo audio
This commit is contained in:
parent
021ff6c00b
commit
294f7bb5b2
@ -44,6 +44,8 @@
|
||||
|
||||
#ifdef HAVE_LC3PLUS
|
||||
|
||||
#define MAX_SAMPLES_PER_FRAME 480
|
||||
|
||||
static uint8_t lc3plus_farunhofer_scratch[LC3PLUS_DEC_MAX_SCRATCH_SIZE];
|
||||
|
||||
static uint16_t lc3_frame_duration_in_us(btstack_lc3_frame_duration_t frame_duration){
|
||||
@ -89,9 +91,16 @@ static uint8_t lc3plus_fraunhofer_decoder_decode_signed_16(void * context, const
|
||||
btstack_lc3plus_fraunhofer_decoder_t *instance = (btstack_lc3plus_fraunhofer_decoder_t *) context;
|
||||
LC3PLUS_Dec *decoder = (LC3PLUS_Dec *) instance->decoder;
|
||||
|
||||
// output_samples: array of channel buffers.
|
||||
// temporary output buffer to interleave samples for caller
|
||||
int16_t temp_out[MAX_SAMPLES_PER_FRAME];
|
||||
|
||||
// output_samples: array of channel buffers. use temp_out if stride is used
|
||||
int16_t *output_samples[1];
|
||||
if (stride > 1) {
|
||||
output_samples[0] = temp_out;
|
||||
} else {
|
||||
output_samples[0] = pcm_out;
|
||||
}
|
||||
|
||||
// trigger plc if BFI by passing 0 valid input bytes
|
||||
uint16_t byte_count = instance->octets_per_frame;
|
||||
@ -101,6 +110,14 @@ static uint8_t lc3plus_fraunhofer_decoder_decode_signed_16(void * context, const
|
||||
|
||||
LC3PLUS_Error error = lc3plus_dec16(decoder, (void*) bytes, byte_count, output_samples, lc3plus_farunhofer_scratch, BFI);
|
||||
|
||||
// store samples
|
||||
if (stride > 1){
|
||||
uint16_t i;
|
||||
for (i = 0; i < instance->samples_per_frame; i++){
|
||||
pcm_out [i * stride] = temp_out[i];
|
||||
}
|
||||
}
|
||||
|
||||
// map error
|
||||
switch (error){
|
||||
case LC3PLUS_OK:
|
||||
|
Loading…
x
Reference in New Issue
Block a user