⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcm_a_decode.m

📁 西交大刘树棠写的《数字信号处理》那本书的所有源代码
💻 M
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -