📄 g729a_coder.c
字号:
#include "../Common/typedef.h"
#include "../Include/G729A_basic_op.h"
#include "../Include/G729A_ld8a.h"
#include "../Include/G729A_tab_ld8a.h"
#include "../Include/G729A_Coder.h"
extern Word16 *G729A_new_speech;
static Word16 G729A_prm[G729A_PRM_SIZE];
static unsigned int G729A_bb_;
static unsigned int G729A_nbb_;
static unsigned char* G729A_bc_;
void G729AInitEncoder()
{
G729AInit_Pre_Process();
G729AInit_Coder_ld8a();
G729ASet_zero(G729A_prm, G729A_PRM_SIZE);
}
int G729AEnCoder(Word16 *sample, char *buf, int samplelen, int *buflen)
{
int i = 0, j = 0;
*buflen = 0;
G729A_bc_ = (unsigned char *)buf;
G729A_bb_ = 0;
G729A_nbb_ = 0;
for(i = 0; i < 3; i++)
{
memcpy((char *)G729A_new_speech, (char *)(sample + i*G729A_L_FRAME), G729A_L_FRAME*2);
G729APre_Process(G729A_new_speech, G729A_L_FRAME);
G729ACoder_ld8a(G729A_prm);
for(j = 0; j < G729A_PRM_SIZE; j++)
{
PUT_BITS(G729A_prm[j], G729A_bitsno [j], G729A_nbb_, G729A_bb_, G729A_bc_);
}
*buflen += 10;
STORE_BITS(G729A_bb_, G729A_bc_);
}
return (0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -