如何转换一个G.726 ADPCM信号转换成PCM信号? [英] How do I convert a G.726 ADPCM signal into a PCM signal?

查看:1173
本文介绍了如何转换一个G.726 ADPCM信号转换成PCM信号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是盼望SOX法案或窗口内置的这个东西音频库,但似乎也没有G.726 codeCS。

I usually look to SoX or Window's built in audio libraries for this stuff, but it appears that neither have G.726 codecs.

所以我有,我知道都设有$ C $光盘作为G.726虽然比特率,以及它是否是μ律或A律是不是在这个时候称为(实验将确定这些字节序列参数),我需要取消code他们进入一个正常的PCM信号。

So I have a sequence of bytes that I know are encoded as G.726 although the bit-rate and whether it is mu-law or A-law is not known at this time (experimentation will determine those parameters), and I need to decode them into a normal PCM signal.

所以,我下载了ITU-T(ITU-T G.191建议)的参考实现,但我是那种关于如何使用的迷茫 G726_de code 功能。根据该文件 inp_buf out_buf 需要具有相同的长度 smpno 和两个缓冲器是16位的缓冲区。这在我看来就像一个步骤是丢失;否则没有COM pression是通过使用G.726完成。根据在 G.726 的样本大小Wikipedia页面取决于比特率(从2至5个位)。我应该做DECOM pression到样品自己?所以,如果我认为最大的COM pression(2位样本),那么每个字节会产生4个样本。

So I downloaded the reference implementation from the ITU-T (ITU-T Recommendation G.191) but I'm kind of confused on how to use the G726_decode function. According to the documentation inp_buf and out_buf need to have the same length smpno and both buffers are 16-bit buffers. This seems to me like a step is missing; otherwise no compression is accomplished by using G.726. According to the Wikipedia page on G.726 sample size depends on bit rate (from 2 to 5 bits). Am I supposed to do the decompression into samples myself? So if I assume maximum compression (2 bit samples) then each byte will produce 4 samples.

例如:

char b = /* read the code from input */
short inp[4], output[4];
inp[0] = b & 0x0003;
inp[1] = b & 0x000C >> 2;
inp[2] = (b & 0x0030) >> 4;
inp[3] = (b & 0x00C0) >> 6;
G726_state state;
memset(&state, 0, sizeof(G726_state));
G726_decode(inp, output, 4, "u", 2, 1, &state);
/* ouput now contains 4 PCM samples */

还是我完全失去了一些东西?

Or am I missing something completely?

推荐答案

看起来像ffmpeg的实际上是无法做到这一点,因为我认为这肯定将能够...然而,当我在谷歌上搜索我确实发现这发布到它提供了一个解决方案,FFmpeg的邮件列表

Looks like ffmpeg actually isn't able to do this, as I thought it surely would be able to... however, while I was googling I did find this post to the ffmpeg mailing list which offers a solution.

基本上,有一个名为 g72x ++ 独立的程序,这似乎能够取消code中的音频原始PCM你。

Basically, there is a separate program called g72x++ which seems to be able to decode the audio to raw PCM for you.

这篇关于如何转换一个G.726 ADPCM信号转换成PCM信号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆