g_pitch.m

来自「VAD G729 for mobile phone」· M 代码 · 共 28 行

M
28
字号
function gp=g_pitch(xn,yn)
%/*---------------------------------------------------------------------*
% * Function  G_pitch:                                                  *
% *           ~~~~~~~~                                                  *
% *---------------------------------------------------------------------*
% * Compute correlations <xn,y1> and <y1,y1> to use in gains quantizer. *
% * Also compute the gain of pitch. Result in Q14                       *
% *  if (gain < 0)  gain =0                                             *
% *  if (gain >1.2) gain =1.2                                           *
% *---------------------------------------------------------------------*/

%xn,yn----Pitch target.    Filtered adaptive codebook.
%gp----Gain of pitch lag saturated to 1.2

temp1=xn*yn';
temp2=yn*yn';
if temp2==0
    temp2=1;
end
o=temp1/temp2;


if o<0
    o=0;
elseif o>1.2
    o=1.2;
end
gp=o;

⌨️ 快捷键说明

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