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

📄 decodestreamacelp.m

📁 ITU-T G.723.1 Speech Coder: Matlab implementation This package implements the speech coder and de
💻 M
字号:
function [L, b, Pulseval] = DecodeStreamACELP (QC, Pitchpar, ACELPpar);% Decode the bitstream data (ACELP mode)% $Id: DecodeStreamACELP.m 1.6 2004/08/03 G.723.1-v2r1a $% Extract the gains for the pitch and the pulse contributionsACBLC = QC.ACBLC;CGC = QC.CGC;GridC = QC.ACELPGridC;SignC = QC.ACELPSignC;PosC = QC.ACELPPosC;CBookI = 2;             % ACELP mode always uses the second pitch codebookNSubframe = length (CGC);for (i = 1:NSubframe)  % Process the combined gain code, giving the adaptive codebook gain code and  % the pulse gain code  [gC, ACBbC] = ExtractVals (CGC(i), Pitchpar.GModV{CBookI});   ACBbIB(:,i) = [ACBbC + 1; CBookI];  % Pulse positions and pulse gains  [Pulseval(i).g, Pulseval(i).m] = ACELP_Pulses (GridC(i), SignC(i), PosC(i), gC, ACELPpar);  Pulseval(i).gC = gC;       % Needed for PLC gainend% Get the pitch filter lag and gain vector[L, b] = DecodeACB (ACBLC, ACBbIB, Pitchpar);% Pitch repetition lag and gainfor (i = 1:NSubframe)  ShiftLag = L(i) + ACELPpar.POffs(ACBbIB(1,i));  if (ShiftLag < ACELPpar.LThr)    ShiftGain = ACELPpar.Pg(ACBbIB(1,i));  else    ShiftLag = Inf;    ShiftGain = 0;  end  Pulseval(i).ShiftLag = ShiftLag;  Pulseval(i).ShiftGain = ShiftGain;endreturn%--------------------function [g, m] = ACELP_Pulses (GridC, SignC, PPosC, gC, ACELPpar);NTrack = size (ACELPpar.Grid, 1);Np = NTrack;gV = ACELPpar.g(gC+1);g = repmat (gV, 1, Np);% Decode the signs (Np times 1 bit)Signs = ExtractVals (SignC, Np, 2);g(Signs == 0) = -gV;                % Signed gain per track% Decode the pulse positions (Np times 3 bits)PPosI = ExtractVals (PPosC, Np, 8) + 1;for (i = 1:Np)  m(i) = ACELPpar.Grid{i,GridC+1}(PPosI(i));  % Could be NaNend% Missing pulses are marked with a NaN; remove themI = isnan (m);m(I) = [];g(I) = [];return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -