PCMUQC 解码算法:MATLAB 实现
function [outData] = PCMUQC_Decode( inputData)
n=length(inputData); outData=zeros(1,n/8); MM=zeros(1,8); for kk=1:n/8 MM(1:8)=inputData(1,(kk-1)8+1:kk8); %取得8位PCM码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% stuednt code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%task:理解PCM编码原理,将8位PCM码MM中的二进制段落码转化为十进制数,将其值赋给temp。
temp = MM(1)*2^2 + MM(2)*2^1 + MM(3)*2^0;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if temp==0
q=1; %段落内分成16份,每一份的长度
a=0; %段落内的起始值
end
if temp==1
q=1;
a=16;
end
if temp==2
q=2;
a=32;
end
if temp==3
q=4;
a=64;
end
if temp==4
q=8;
a=128;
end
if temp==5
q=16;
a=256;
end
if temp==6
q=32;
a=512;
end
if temp==7
q=64;
a=1024;
end
R=(a+( MM(5)*2^3+MM(6)*2^2+MM(7)*2+MM(8) )*q+q/2)/2048; %译码 段内码计算量化值
if MM(1)==0 %极性码判断正负
R=-R;
end
outData(1,kk)=R;
end
end
原文地址: https://www.cveoy.top/t/topic/or7c 著作权归作者所有。请勿转载和采集!