g711u g711a 格式相互转换

pcm to g711编码,资料很多,这里只说一下g711u转换为g711a的方法,很简单,如下:


unsigned char * ulawtoalaw(unsigned char * ulawbuffer,int len)
{
unsigned char * ulaw = ulawbuffer;
unsigned char * alaw = new unsigned char[len];


int count = 0;
while(count < len )
{
alaw[count] = ulaw2alaw(*ulaw);
count++;
ulaw++;
}


return alaw;
}


说明一下:第一个参数是g711u的buffer,第二个参数是buffer的长度,函数返回g711a数据。其中ulaw2alaw(*ulaw),这个函数是库g711codec里面的


本文简单说了一下g711u to g711a ,其实g711a to g711u是一样的,就不说了

你可能感兴趣的:(g711a,g711u,转换)