pcm_a_decode.m
来自「西交大刘树棠写的《数字信号处理》那本书的所有源代码」· M 代码 · 共 33 行
M
33 行
function [out]=pcm_a_decode(in,v)
%decode the input pcm alaw code
%in:input the pcm code 8 bits sample
%v:quantized level
n=length(in);
in=reshape(in',8,n/8)';
slot(1)=0;
slot(2)=32;
slot(3)=64;
slot(4)=128;
slot(5)=256;
slot(6)=512;
slot(7)=1024;
slot(8)=2048;
step(1)=2;
step(2)=2;
step(3)=4;
step(4)=8;
step(5)=16;
step(6)=32;
step(7)=64;
step(8)=128;
for i=1:n/8
ss=2*in(i,1)-1;
tmp=in(i,2)*4+in(i,3)*2+in(i,4)+1;
st=slot(tmp);
dt=(in(i,5)*8+in(i,6)*4+in(i,7)*2+in(i,8))*step(tmp);
out(i)=ss*(st+dt);
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?