extern void g726_Decode(char *bitstream,unsigned char *speech) { g726_state state_ptr; int i; int in; short temp; g726_init_state(&state_ptr); for(i=0;i<120;i++) { in=(int)(((*(bitstream+i))&(char)192)>>6); temp=g726_16_decoder(in,AUDIO_ENCODING_LINEAR,&state_ptr); memcpy(speech+i*8,&temp,2); in=(int)(((*(bitstream+i))&(char)48)>>4); temp=g726_16_decoder(in,AUDIO_ENCODING_LINEAR,&state_ptr); memcpy(speech+i*8+2,&temp,2); in=(int)(((*(bitstream+i))&(char)12)>>2); temp=g726_16_decoder(in,AUDIO_ENCODING_LINEAR,&state_ptr); memcpy(speech+i*8+4,&temp,2); in=(int)(((*(bitstream+i))&(char)3)); temp=g726_16_decoder(in,AUDIO_ENCODING_LINEAR,&state_ptr); memcpy(speech+i*8+6,&temp,2); } }
void g726_Decode(char *bitstream, int bitLen, unsigned char *speech, g726_state *state_ptr) { int i; int in; short temp; for(i=0;i<bitLen;i++) { in=(int)(((*(bitstream+i)))>>0); temp=g726_16_decoder(in,AUDIO_ENCODING_LINEAR,state_ptr); memcpy(speech+i*8,&temp,2); in=(int)(((*(bitstream+i)))>>2); temp=g726_16_decoder(in,AUDIO_ENCODING_LINEAR,state_ptr); memcpy(speech+i*8+2,&temp,2); in=(int)(((*(bitstream+i)))>>4); temp=g726_16_decoder(in,AUDIO_ENCODING_LINEAR,state_ptr); memcpy(speech+i*8+4,&temp,2); in=(int)(((*(bitstream+i)))>>6); temp=g726_16_decoder(in,AUDIO_ENCODING_LINEAR,state_ptr); memcpy(speech+i*8+6,&temp,2); } }