extern void g726_Encode(unsigned char *speech,char *bitstream) { // g726_state state_ptr; short temp[480]; int i; g726_init_state(&state_ptr); memcpy(temp,speech,960); for(i=0;i<120;i++) { *(bitstream+i)=(((char)(g726_16_encoder(temp[i*4],AUDIO_ENCODING_LINEAR,&state_ptr)))<<6)|(((char)(g726_16_encoder(temp[i*4+1],AUDIO_ENCODING_LINEAR,&state_ptr)))<<4)|(((char)(g726_16_encoder(temp[i*4+2],AUDIO_ENCODING_LINEAR,&state_ptr)))<<2)|(((char)(g726_16_encoder(temp[i*4+3],AUDIO_ENCODING_LINEAR,&state_ptr)))); } }
void g726_Encode(unsigned char *speech,char *bitstream) { g726_state state_ptr; short temp[480]; int i; //char c; g726_init_state(&state_ptr); /*for(i=0;i<480;i++) { c=*(speech+i*2); *(speech+i*2)=*(speech+i*2+1); *(speech+i*2+1)=c; }*/ memcpy(temp,speech,960); for(i=0;i<120;i++) { *(bitstream+i)=(((char)(g726_16_encoder(temp[i*4],AUDIO_ENCODING_LINEAR,&state_ptr)))<<6)|(((char)(g726_16_encoder(temp[i*4+1],AUDIO_ENCODING_LINEAR,&state_ptr)))<<4)|(((char)(g726_16_encoder(temp[i*4+2],AUDIO_ENCODING_LINEAR,&state_ptr)))<<2)|(((char)(g726_16_encoder(temp[i*4+3],AUDIO_ENCODING_LINEAR,&state_ptr)))); } }