iLBC

         iLBC是一种专为包交换网络通信设计的编解码,优于目前流行的G.729、G.723.1,对丢包进行了特有处理,即使在丢包率 相当高的网络环境下,仍可获得非常清晰的语音效果。  

           30ms ptime的iLBC所占用的总通信带宽比通常采用的ptime 20ms的G.729的带宽还要小,语音质量一直是VoIP应用的主要难点,如何保证和提高IP网络传输语音的通话效果,是VoIP应用迫切需要解决的问题。“iLBC”编解码的出现,解决了在包交换的IP网络中,传输语音所遇到的网络丢包严重影响通话质量等实际问题,实现了“语音质量的飞跃”。

          无论在高丢包率条件下还是在没有丢包的条件下,iLBC的语音质量都优于目前流行的G.723.1, G.729A等标准编解码;而且丢包率越大,使用iLBC的语音质量优势越明显。通常情况下,为了衡量IP网络语音质量,将≥5%丢包率的网络情况定义为VoIP的极限网络条件。经过语音质量测试,即使在5%丢包率的情况下,iLBC仍然能够提供相当于GSM手机的语音质量。  

        iLBC的技术优势   

        iLBC的主要优势在于对丢包的处理能力。iLBC独立处理每一个语音包,是一种理想的包交换网络语音编解码。在正常情况下,iLBC会记录下当前数据的相关参数和激励信号,以便在之后的数据丢失的情况下进行处理;在当前数据接收正常而之前数据包丢失的情况下,iLBC会对当前解码出的语音和之前模拟生成的语音进行平滑处理,以消除不连贯的感觉;在当前数据包丢失的情况下,iLBC会对之前记录下来的激励信号作相关处理并与随机信号进行混合,以得到模拟的激励信号,从而得到替代丢失语音的模拟语音。总的来说,和标准的低位速率编解码相比,iLBC使用更多自然、清晰的元素,精确的模仿出原始语音信号,被誉为更适合包交换网络使用的可获得高语音质量的编解码。  此外,大部分标准的低位速率编解码,如G.723.1和G.729,仅对300Hz——3400Hz的频率范围进行编码。在这个频率范围里,用G.711编解码所达到的语音质量,就是传统PSTN网络进行语音通话的效果。


from: http://my.oschina.net/AlexZhuang/blog/66187

iLBC (internet Low Bitrate Codec) is a speech codec used for encoding and decoding speech signals. To decode an iLBC-encoded audio file, you can use a decoder library or tool that supports iLBC decoding. Here is an example of how you can decode an iLBC file using the libilbc library in C: 1. Install the libilbc library on your system. 2. Include the necessary header files in your C code: ```c #include <stdio.h> #include <stdlib.h> #include <ilbc/ilbc.h> ``` 3. Write a function to perform the iLBC decoding: ```c void ilbc_decode(const char* input_file, const char* output_file) { FILE* fin = fopen(input_file, "rb"); FILE* fout = fopen(output_file, "wb"); // Get input file size fseek(fin, 0, SEEK_END); long input_size = ftell(fin); rewind(fin); // Allocate memory for input and output buffers int16_t* input_buffer = (int16_t*)malloc(input_size); int16_t* output_buffer = (int16_t*)malloc(input_size * 2); // Double the size for stereo audio // Read the input file into the input buffer fread(input_buffer, sizeof(int16_t), input_size / sizeof(int16_t), fin); // Create an iLBC decoder instance iLBC_Dec_Inst_t* dec_inst = iLBC_create(1); // 1 for 20ms frame size // Perform the decoding int num_frames = input_size / (2 * sizeof(int16_t)); // Assuming mono audio, 2 bytes per sample iLBC_decode(dec_inst, input_buffer, num_frames, output_buffer); // Write the decoded audio to the output file fwrite(output_buffer, sizeof(int16_t), num_frames * sizeof(int16_t), fout); // Cleanup fclose(fin); fclose(fout); free(input_buffer); free(output_buffer); iLBC_free(dec_inst); } ``` 4. Call the `ilbc_decode` function with the input and output file paths: ```c int main() { const char* input_file = "encoded.ilbc"; const char* output_file = "decoded.pcm"; ilbc_decode(input_file, output_file); return 0; } ``` Make sure to replace "encoded.ilbc" with the path to your iLBC-encoded file and "decoded.pcm" with the desired output file path. After running the program, you should have the decoded audio in the output file. Please note that this is just a basic example, and you may need to modify it according to your specific requirements and the iLBC decoder library you are using.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值