📄 lsfcxlpi.m
字号:
function [aQI, lsfQ] = LSFCxLPI (LSFC, lsfQP, LSFpar)% Inverse quantize the LSF's, interpolate the quantized% LSF's, convert to quantized LP parameters. If LSFC is% empty, this is a packet loss frame.% $Id: LSFCxLPI.m 1.1 2004/07/09 G.723.1-v2r1a $% Inverse quantization of the LSFsif (isempty (LSFC)) LSFMode = 2; % PLC frame NSplit = length (LSFpar.VQ); LSFC = zeros (NSplit, 1);else LSFMode = 1;endlsfQ = IQLSF (LSFC, lsfQP, LSFMode, LSFpar);% Interpolation of the LSF's and convert to LPaQI = LSFxLPI (lsfQ, lsfQP, LSFpar);return%--------------------function lsfQ = IQLSF (LSFC, lsfQP, LSFMode, LSFpar)% LSFC is a vector of codebook codes% Calculate the prediction errorPval = LSFpar.Pcof(LSFMode) * (lsfQP - LSFpar.Mean);Nsplit = length (LSFpar.VQ);i1 = 1;for (k = 1:Nsplit) i2 = i1 + size (LSFpar.VQ{k}, 1) - 1; DlsfQ(i1:i2,1) = LSFpar.VQ{k}(:,LSFC(k) + 1); i1 = i2 + 1;end% Fix closely spaced LSF'slsfQ = FixLSF (DlsfQ + Pval + LSFpar.Mean, LSFMode, LSFpar.Fix);if (isempty (lsfQ)) lsfQ = lsfQP;endreturn%------------------------function lsf = FixLSF (lsf, LSFMode, Fix)% Fix closely spaced LSF'sNp = length (lsf);lsf(1) = max (lsf(1), Fix.Min);lsf(Np) = min (lsf(Np), Fix.Max);dwMin = Fix.MinSep(LSFMode);dwTest = Fix.SepCheck(LSFMode);NFix = 0;for (m = 1:Fix.NIter) % Force a minimum separation for (j = 1:Np-1) dw = lsf(j+1) - lsf(j); if (dw < dwMin) lsf(j) = lsf(j) - 0.5 * (dwMin - dw); lsf(j+1) = lsf(j+1) + 0.5 * (dwMin - dw); NFix = NFix + 1; end end % Test separation (dwTest is a bit smaller than dwMin) dw = diff (lsf); TooClose = any (dw < dwTest); if (~ TooClose) break; % No more fixes necessary endendif (NFix > 0) disp ('FixLSF: Fix for close LSFs');endif (TooClose) lsf = []; disp ('FixLSF: Fix not successful');endreturn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -