音频编码对比

opus
6 kb /秒到510 kb / s的比特率
采样率从8 kHz(窄带)到48 kHz(全频)
帧大小从2.5毫秒到60毫秒
支持恒定比特率(CBR)和可变比特率(VBR)
从窄带到全频段的音频带宽
支持语音和音乐
支持单声道和立体声
支持多达255个频道(多数据流的帧)
可动态调节比特率,音频带宽和帧大小
良好的鲁棒性丢失率和数据包丢失隐藏(PLC)
浮点和定点实现
ilbc
使用8 kHZ的采样频率,20毫秒帧比特率为15.2 kbps,
30毫米帧的比特率为13.33 kbps,标准由IETF RFC 3951和3952定义。
iLBC的主要优势在于对丢包的处理能力
iSAC
16khz或者32khz采样频率
在12到52kbps的比特率下。

针对VoIP和音频流的宽带和超宽带音频编解码器,是WebRTC音频引擎的默认的编解码器
采样频率:16khz,24khz,32khz;(默认为16khz)
自适应速率为10kbit/s ~ 52kbit/;
自适应包大小:30~60ms;
算法延时:frame + 3ms

PCMU

所需频宽:64Kbps(90.4)
特性:PCMU和PCMA都能提供较好的语音质量,但是它们占用的带宽较高,需要64kbps。
优点:语音质量优
缺点:占用的带宽较高
PCMA
所需频宽:64Kbps(90.4)
特性:PCMU和PCMA都能提供较好的语音质量,但是它们占用的带宽较高,需要64kbps。
优点:语音质量优
缺点:占用的带宽较高
telephone-event
在DTMF,就是双音多频,Dual Tone Multi Frequency ,由高频群和低频群组成,
高低频群各包含4个频率。一个高频信号和一个低频信号叠加组成一个组合信号,代表一个数字。常用于电话机
发布了16 篇原创文章 · 获赞 10 · 访问量 14万+
展开阅读全文

webrtc框架下得isac语音译码问题

10-26

看了了webrtc源代码的isac编译码程序,自己写了一个控制台程序,读取一个pcm int16的话音文件,然后用isac编码,最后译码,译码后语音明显有破音和过载,与原语音比较差异很明显,始终找不到原因,忘高手指教。以下是我写的源代码。 #include "stdafx.h" #include "isac.h" #include "utility.h" #include "math.h" #include "windows.h"; int _tmain(int argc, _TCHAR* argv[]) { ISACStruct* ISAC_main_inst; WebRtc_Word16 stream_len = 0; IsacSamplingRate sampFreqKHz = kIsacWideband; WebRtc_Word16 declen; WebRtc_Word16 speechType[1]; *speechType = 1; WebRtc_UWord16 payload[600]; WebRtc_Word16 decoded[1920]; WebRtc_Word16 decodeout[1920]; WebRtc_UWord16 payloadRCU[600]; WebRtc_Word16 rcuStreamLen = 0; int samplesIn10Ms = 160, cur_framesmpls = 0; const char Infilename[] = "D:\\matlab code\\fileout.pcm"; const char Outfilename[] = "D:\\matlab code\\fileout_decode.pcm"; FILE *filein, *fileout; short shortdata[160]; memset(shortdata, 0, 160); memset(decoded, 0, 1920); filein = fopen(Infilename, "r"); fileout = fopen(Outfilename, "w"); fclose(fileout); fileout = fopen(Outfilename, "a+"); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ int err = WebRtcIsac_Create(&ISAC_main_inst); WebRtcIsac_SetEncSampRate(ISAC_main_inst, (sampFreqKHz == 16) ? kIsacWideband : kIsacSuperWideband); WebRtcIsac_SetDecSampRate(ISAC_main_inst, (sampFreqKHz == 16) ? kIsacWideband : kIsacSuperWideband); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ fseek(filein, 0, SEEK_END); int fsize = ftell(filein); int samplenum = floor((double)fsize / 2); int blocknum = floor((double)samplenum / samplesIn10Ms/3); fseek(filein, 0, SEEK_SET); if (WebRtcIsac_DecoderInit(ISAC_main_inst) < 0) { printf("cannot initialize decoder\n"); return -1; } if (WebRtcIsac_EncoderInit(ISAC_main_inst, 0) < 0) { printf("cannot initialize encoder\n"); return -1; } if (WebRtcIsac_ControlBwe(ISAC_main_inst, 36000, 30, 1) < 0) { printf("cannot configure BWE\n"); return -1; } BottleNeckModel packetData; packetData.arrival_time = 0; packetData.sample_count = 0; packetData.rtp_number = 0; stream_len = 0; for (int i = 0; i < blocknum; i++) { cur_framesmpls = 0; stream_len = 0; fseek(filein, i*samplesIn10Ms * 3 * 2, SEEK_SET); //+++++++++++read file and encode while (stream_len == 0) { int k = 0; int size = fread(shortdata, sizeof(short), samplesIn10Ms, filein); k++; fseek(filein, i*samplesIn10Ms * 3 * 2 + samplesIn10Ms*2*k, SEEK_SET); cur_framesmpls += samplesIn10Ms; //-------- iSAC encoding --------- stream_len = WebRtcIsac_Encode(ISAC_main_inst, shortdata, (WebRtc_Word16*)payload); if (stream_len < 0) { // exit if returned with error //errType=WebRtcIsac_GetErrorCode(ISAC_main_inst); fprintf(stderr, "\nError in encoder\n"); getchar(); exit(EXIT_FAILURE); } } rcuStreamLen = WebRtcIsac_GetRedPayload(ISAC_main_inst, (WebRtc_Word16*)payloadRCU); //++++++++++++++test parameters++++++++ //WebRtc_Word32 sendbottleneck; //WebRtcIsac_GetUplinkBw(ISAC_main_inst, &sendbottleneck); //WebRtcIsac_UpdateUplinkBw(ISAC_main_inst, 9); WebRtc_Word16 bweindex, framelen; WebRtcIsac_ReadBwIndex((WebRtc_Word16*)payload, &bweindex); WebRtcIsac_UpdateUplinkBw(ISAC_main_inst, bweindex); WebRtcIsac_ReadFrameLen(ISAC_main_inst, (WebRtc_Word16*)payload, &framelen); //=========================updata bw======================================== //get_arrival_time(cur_framesmpls, 10000, 16000, &packetData, //sampFreqKHz * 1000, sampFreqKHz * 1000); /* /* if (WebRtcIsac_UpdateBwEstimate(ISAC_main_inst, payload, stream_len, 1, 0, 480) < 0) { printf(" BWE Error at client\n"); return -1; }*/ //======================= iSAC decoding =========================== declen = WebRtcIsac_Decode(ISAC_main_inst, payload, stream_len, decoded, speechType); if (declen <= 0) { //errType=WebRtcIsac_GetErrorCode(ISAC_main_inst); fprintf(stderr, "\nError in decoder.\n"); getchar(); exit(1); } //+++++++++++++++++++++write file to the out file /*for (int i = 0; i < declen; i++) { WebRtc_Word16 bit1 = (int16_t)decoded[i] >> 15 & 0x0001; WebRtc_Word16 bit2 = (int16_t)decoded[i] >> 13 & 0x0002; WebRtc_Word16 bit3 = (int16_t)decoded[i] >> 11 & 0x0004; WebRtc_Word16 bit4 = (int16_t)decoded[i] >> 9 & 0x0008; WebRtc_Word16 bit5 = (int16_t)decoded[i] >> 7 & 0x0010; WebRtc_Word16 bit6 = (int16_t)decoded[i] >> 5 & 0x0020; WebRtc_Word16 bit7 = (int16_t)decoded[i] >> 3 & 0x0040; WebRtc_Word16 bit8 = (int16_t)decoded[i] >> 1 & 0x0080; WebRtc_Word16 bit9 = (int16_t)decoded[i] <<1 & 0x0100; WebRtc_Word16 bit10 = (int16_t)decoded[i] <<3 & 0x0200; WebRtc_Word16 bit11 = (int16_t)decoded[i] << 5 & 0x0400; WebRtc_Word16 bit12 = (int16_t)decoded[i] << 7 & 0x0800; WebRtc_Word16 bit13 = (int16_t)decoded[i] << 9 & 0x1000; WebRtc_Word16 bit14 = (int16_t)decoded[i] << 11 & 0x2000; WebRtc_Word16 bit15 = (int16_t)decoded[i] << 13 & 0x4000; WebRtc_Word16 bit16 = (int16_t)decoded[i] << 15 & 0x8000; decodeout[i] = bit1 | bit2 | bit3 | bit4 | bit5 | bit6| bit7 | bit8 | bit9 | bit10 | bit11 | bit12| bit13 | bit14 | bit15 | bit16; }*/ fwrite(decoded, sizeof(WebRtc_Word16), declen, fileout); } fclose(filein); fclose(fileout); return 0; } 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览