📄 pcm_decode.m
字号:
function [ output ] = pcm_decode( bitsIn )%UNTITLED1 Summary of this function goes here% Detailed explanation goes hereSLENGTH = length(bitsIn)/8;bytesIn = zeros(3,SLENGTH);for i = 1:SLENGTH, bytesIn(1,i) = bitsIn(8*(i-1)+1); for j = 2:4, bytesIn(2,i) = bytesIn(2,i) + bitsIn(8*(i-1)+j)*2^(4-j); end for j = 5:8 bytesIn(3,i) = bytesIn(3,i) + bitsIn(8*(i-1)+j)*2^(8-j); endend%==>== DECODE ====%output = zeros(1,SLENGTH);for i = 1:SLENGTH % in case! if bytesIn(2,i) == 0, preByte = (1/2)^7; preByte1 = 0; else preByte = (1/2)^(8-bytesIn(2,i)); preByte1 = preByte; end output(i) = (-1)^(bytesIn(1,i))*... (preByte1+... preByte*(bytesIn(3,i))/16);endclear preByte;clear preByte;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -