code: public static float g_pitch(          /* output: pitch gain */
  	 float xn[],int xns,            /* input : target vector */
  	 float y1[],int y1s,            /* input : filtered adaptive codebook vector */
  	 float g_coeff[],int gs,       /* output: <y1,y1> and -2<xn,y1> */
  	 int l_subfr            /* input : vector dimension */
  	)
  	{
  	    float xy, yy, gain;
  	    int   i;
  
  	    xy = (float)0.0;
  	    for (i = 0; i < l_subfr; i++) {
  	        xy += xn[xns+i] * y1[y1s+i];
  	    }
  	    yy = (float)0.01;
  	    for (i = 0; i < l_subfr; i++) {
  	        yy += y1[y1s+i] * y1[y1s+i];          /* energy of filtered excitation */
  	    }
  	    g_coeff[gs+0] = yy;
  	    g_coeff[gs+1] = (float)-2.0*xy +(float)0.01;
  
  	    /* find pitch gain and bound it by [0,1.2] */
  
  	    gain = xy/yy;
  
  	    if (gain<(float)0.0)  gain = (float)0.0;
  	    if (gain>LD8KConstants.GAIN_PIT_MAX) gain = LD8KConstants.GAIN_PIT_MAX;
  
  	    return gain;
  	}
docs: /*----------------------------------------------------------------------------
  g_pitch - compute adaptive codebook gain and compute <y1,y1> , -2<xn,y1>
  ----------------------------------------------------------------------------