sbc_编码过程详解
编码部分源码
// sbcenc.c
static void encode(char *filename, int subbands, int bitpool, int joint,
int dualchannel, int snr, int blocks, bool msbc)
{
struct au_header au_hdr;
sbc_t sbc;
int fd, size, srate, codesize, nframes;
ssize_t encoded;
ssize_t len;
// 数据初始化
···
// codesize = subbands * blocks *channels * 2
codesize = sbc_get_codesize(&sbc);
// read(fd, input, BE_INT(au_hdr.hdr_size) - len)
nframes = sizeof(input) / codesize;
while (1) {
unsigned char *inp, *outp;
/* read data for up to 'nframes' frames of input data */
size = read(fd, input, codesize * nframes);
if (size < 0) {
/* Something really bad happened */
perror("Can't read audio data");
break;
}
if (size < codesize)