XenevaOS
Loading...
Searching...
No Matches
XenevaOS
KernelAA64
Bt
sbc.h
Go to the documentation of this file.
1
30
#ifndef __BT_SBC_H__
31
#define __BT_SBC_H__
32
33
#include <stdint.h>
34
35
/* Encode-only SBC for A2DP (Bluetooth Advanced Audio Distribution,
36
* Appendix B). Fixed production configuration, matching what every A2DP
37
* sink (including Sony ULT WEAR) accepts:
38
* joint stereo, 8 subbands, 16 blocks, Loudness allocation,
39
* 44.1 kHz or 48 kHz, configurable bitpool (53 = A2DP high quality).
40
*
41
* One frame carries 16 blocks x 8 subbands = 128 PCM samples per channel.
42
* At bitpool 53 a frame is 119 bytes (~328 kbit/s at 44.1 kHz).
43
*
44
* Filterbank, Loudness offsets, bit allocation, CRC and packing follow the
45
* A2DP spec as implemented by google/libsbc (Apache-2.0); only integer
46
* <stdint.h>/<string.h> operations are used so this compiles both in the
47
* kernel and in the host unit test. */
48
#define SBC_NBLOCKS 16
49
#define SBC_NSUBBANDS 8
50
#define SBC_NSAMPLES (SBC_NBLOCKS * SBC_NSUBBANDS)
51
#define SBC_MAX_FRAME 128
52
#define SBC_FREQ_44100 0
53
#define SBC_FREQ_48000 1
54
55
typedef
struct
{
56
int16_t
x
[2][
SBC_NSUBBANDS
][5];
57
int32_t
y
[4];
58
int
idx
;
59
}
BtSbcCh
;
60
61
typedef
struct
{
62
BtSbcCh
ch[2];
63
}
BtSbcEnc
;
64
65
void
bt_sbc_init
(
BtSbcEnc
* e);
66
/* Frame length in bytes for a bitpool, or 0 when the bitpool is invalid. */
67
unsigned
bt_sbc_frame_len
(
int
bitpool);
68
/* Encode 128 interleaved stereo frames (256 int16 samples, LRLR...).
69
* freq is SBC_FREQ_44100 or SBC_FREQ_48000. Returns frame bytes in out
70
* (SBC_MAX_FRAME available), or -1 on bad parameters. */
71
int
bt_sbc_encode
(
BtSbcEnc
* e,
const
int16_t
* interleaved,
int
bitpool,
int
freq,
72
uint8_t
*
out
);
73
74
#endif
out
#define out(...)
Definition
main.cpp:65
int32_t
int int32_t
Definition
acefiex.h:160
int16_t
short int int16_t
Definition
acefiex.h:159
uint8_t
unsigned char uint8_t
Definition
acefiex.h:161
y
int y
Definition
layout.c:118
x
int x
Definition
layout.c:118
bt_sbc_encode
int bt_sbc_encode(BtSbcEnc *e, const int16_t *interleaved, int bitpool, int freq, uint8_t *out)
Definition
sbc.c:223
bt_sbc_frame_len
unsigned bt_sbc_frame_len(int bitpool)
Definition
sbc.c:205
SBC_NSUBBANDS
#define SBC_NSUBBANDS
Definition
sbc.h:49
bt_sbc_init
void bt_sbc_init(BtSbcEnc *e)
Definition
sbc.c:201
BtSbcCh
Definition
sbc.h:55
BtSbcCh::idx
int idx
Definition
sbc.h:58
BtSbcEnc
Definition
sbc.h:61
Generated by
1.9.8