Skip to content

File syn_sbc.h

FileList > audio > syn_sbc.h

Go to the source code of this file

Bluetooth A2DP Sub-Band Codec (SBC) Decoder. More...

  • #include "../common/syn_defs.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_SBC_Decoder
SBC Decoder Instance State (~1.5 KB static memory).
struct SYN_SBC_FrameInfo
SBC Parsed Frame Header Information.

Public Types

Type Name
enum SYN_SBC_AllocMethod
SBC Allocation Method Enums.
enum SYN_SBC_ChannelMode
SBC Channel Mode Enums.

Public Functions

Type Name
SYN_Status syn_sbc_decode_frame (SYN_SBC_Decoder * dec, const uint8_t * in, size_t in_len, int16_t * pcm_out, size_t pcm_cap, size_t * out_samples)
Decode a single SBC audio frame to 16-bit interleaved PCM samples.
void syn_sbc_decoder_init (SYN_SBC_Decoder * dec)
Initialize an SBC decoder instance.
SYN_Status syn_sbc_parse_header (const uint8_t * data, size_t len, SYN_SBC_FrameInfo * info)
Parse an SBC frame header without decoding audio payload.

Macros

Type Name
define SYN_SBC_SYNCWORD 0x9CU
SBC Frame Synchronization Byte (0x9C)

Detailed Description

Zero-heap, fixed-point integer implementation of the Bluetooth SIG SBC decoder (A2DP spec v1.3 / Bluetooth Core Spec AVTP). Supports 4 and 8 subbands, 4, 8, 12, 16 blocks, Mono/Dual Channel/Stereo/Joint Stereo, Loudness and SNR bit allocation, and sample rates 16k, 32k, 44.1k, 48k.

Public Types Documentation

enum SYN_SBC_AllocMethod

SBC Allocation Method Enums.

enum SYN_SBC_AllocMethod {
    SYN_SBC_ALLOC_LOUDNESS = 0,
    SYN_SBC_ALLOC_SNR = 1
};


enum SYN_SBC_ChannelMode

SBC Channel Mode Enums.

enum SYN_SBC_ChannelMode {
    SYN_SBC_MODE_MONO = 0,
    SYN_SBC_MODE_DUAL_CHANNEL = 1,
    SYN_SBC_MODE_STEREO = 2,
    SYN_SBC_MODE_JOINT_STEREO = 3
};


Public Functions Documentation

function syn_sbc_decode_frame

Decode a single SBC audio frame to 16-bit interleaved PCM samples.

SYN_Status syn_sbc_decode_frame (
    SYN_SBC_Decoder * dec,
    const uint8_t * in,
    size_t in_len,
    int16_t * pcm_out,
    size_t pcm_cap,
    size_t * out_samples
) 

Parameters:

  • dec Decoder context pointer.
  • in Input SBC frame buffer starting at syncword 0x9C.
  • in_len Input frame buffer length.
  • pcm_out Output 16-bit PCM buffer (interleaved stereo or mono).
  • pcm_cap Capacity of output PCM buffer in samples.
  • out_samples Output pointer receiving actual decoded sample count.

Returns:

SYN_OK on successful frame decode, or error code (<0).


function syn_sbc_decoder_init

Initialize an SBC decoder instance.

void syn_sbc_decoder_init (
    SYN_SBC_Decoder * dec
) 

Parameters:

  • dec Decoder context pointer.

function syn_sbc_parse_header

Parse an SBC frame header without decoding audio payload.

SYN_Status syn_sbc_parse_header (
    const uint8_t * data,
    size_t len,
    SYN_SBC_FrameInfo * info
) 

Parameters:

  • data Input byte buffer containing SBC stream.
  • len Length of input buffer in bytes.
  • info Output frame header structure.

Returns:

SYN_OK on success, or SYN_INVALID_PARAM / SYN_ERROR if syncword missing or invalid.


Macro Definition Documentation

define SYN_SBC_SYNCWORD

SBC Frame Synchronization Byte (0x9C)

#define SYN_SBC_SYNCWORD `0x9CU`



The documentation for this class was generated from the following file src/syntropic/audio/syn_sbc.h