athena_signal/kernels/dios_ssp_gsc/dios_ssp_gsc_rmNPsdOsMs.c
int dios_ssp_gsc_rmnpsdosms_computebiascorrection(objCNPsdOsMs *npsdosms1)
{
	int i;
	float avrg_q_inv = 0.f;
	float param = 0.f;
	
	for (i = 0; i < npsdosms1->m_L; i++)
    {
		/* 1.beta(k)=min(alpha(k)^2,0.8) */
		param = npsdosms1->m_alpha[i] * npsdosms1->m_alpha[i];
		npsdosms1->m_beta[i] = 0.8f < param ? 0.8f : param;
		npsdosms1->m_P1m[i] = npsdosms1->m_beta[i] * npsdosms1->m_P1m[i] + (1.0f - npsdosms1->m_beta[i]) * npsdosms1->m_P[i];
		npsdosms1->m_P2m[i] = npsdosms1->m_beta[i] * npsdosms1->m_P2m[i] + (1.0f - npsdosms1->m_beta[i]) * npsdosms1->m_P[i] * npsdosms1->m_P[i];

		/* 2.var{P} = P2m - P1m^2 */
		npsdosms1->m_varP[i] = npsdosms1->m_P2m[i] - npsdosms1->m_P1m[i] * npsdosms1->m_P1m[i];

		/* 3.Qeq = (2*SIGMAn^4)/var{P} */
		param = 2.0f * npsdosms1->m_N[i] * npsdosms1->m_N[i] / (npsdosms1->m_varP[i] + epsilon);
		npsdosms1->m_Qeq[i] = 2.0f > param ? 2.0f : param;

		/* 4.QeqS = (Qeq - 2*M(D))/(1-M(D)) */
		npsdosms1->m_sQeq[i] = (npsdosms1->m_Qeq[i] - 2.0f * npsdosms1->m_M) / (1.0f - npsdosms1->m_M);

		/* 5.Bmin = 1+(D-1)*2/sQeq */
		npsdosms1->m_Bmin[i] = 1.0f + 2.0f * (npsdosms1->m_D - 1.0f) / npsdosms1->m_sQeq[i];

		/* 6.QeqS_sub = (Qeq - 2*M(V))/(1-M(V)) */
		npsdosms1->m_sQeqSub[i] = (npsdosms1->m_Qeq[i] - 2.0f * npsdosms1->m_MSub) / (1.0f - npsdosms1->m_MSub);

		/* 7.Bmin_sub = 1+(V-1)*2/sQeq */
		npsdosms1->m_Bmin_sub[i] = 1.0f + 2.0f * (npsdosms1->m_V - 1.0f) / npsdosms1->m_sQeqSub[i];

		/* 8.Bc = 1 + av * sqrt(Q^(-1)) */
		if (npsdosms1->m_Qeq[i] < epsilon)
        {
			npsdosms1->m_temp[i] = 1.0f / epsilon;
        }
		else
        {
			npsdosms1->m_temp[i] = 1.0f / npsdosms1->m_Qeq[i];
        }

		avrg_q_inv += npsdosms1->m_temp[i];
    }

	avrg_q_inv = avrg_q_inv / npsdosms1->m_L;					
	npsdosms1->m_Bc = 1.0f + npsdosms1->m_av * (float)sqrt(avrg_q_inv);
	
	/* noise_slope_max (in Fig.5) */
	if (avrg_q_inv < 0.03)
    {
		npsdosms1->m_noise_slope_max = 8.0f;
    }
	else if (avrg_q_inv < 0.05)
    {
		npsdosms1->m_noise_slope_max = 4.0f;
    }
	else if (avrg_q_inv < 0.06)
    {
		npsdosms1->m_noise_slope_max = 2.0f;
    }
	else
    {
		npsdosms1->m_noise_slope_max = 1.2f;
    }

	return 0;
}
/* computation of the Bias introduced because of using 
 * subwindows and short time estimation. */
computation of the Bias introduced because of using
subwindows and short time estimation.
computation of the Bias introduced because of using subwindows and short time estimation .
int dios_ssp_gsc_rmnpsdosms_computebiascorrection(objCNPsdOsMs *npsdosms1)
{
	int i;
	float avrg_q_inv = 0.f;
	float param = 0.f;
	for (i = 0; i < npsdosms1->m_L; i++)
    {
		param = npsdosms1->m_alpha[i] * npsdosms1->m_alpha[i];
		npsdosms1->m_beta[i] = 0.8f < param ? 0.8f : param;
		npsdosms1->m_P1m[i] = npsdosms1->m_beta[i] * npsdosms1->m_P1m[i] + (1.0f - npsdosms1->m_beta[i]) * npsdosms1->m_P[i];
		npsdosms1->m_P2m[i] = npsdosms1->m_beta[i] * npsdosms1->m_P2m[i] + (1.0f - npsdosms1->m_beta[i]) * npsdosms1->m_P[i] * npsdosms1->m_P[i];
		npsdosms1->m_varP[i] = npsdosms1->m_P2m[i] - npsdosms1->m_P1m[i] * npsdosms1->m_P1m[i];
		param = 2.0f * npsdosms1->m_N[i] * npsdosms1->m_N[i] / (npsdosms1->m_varP[i] + epsilon);
		npsdosms1->m_Qeq[i] = 2.0f > param ? 2.0f : param;
		npsdosms1->m_sQeq[i] = (npsdosms1->m_Qeq[i] - 2.0f * npsdosms1->m_M) / (1.0f - npsdosms1->m_M);
		npsdosms1->m_Bmin[i] = 1.0f + 2.0f * (npsdosms1->m_D - 1.0f) / npsdosms1->m_sQeq[i];
		npsdosms1->m_sQeqSub[i] = (npsdosms1->m_Qeq[i] - 2.0f * npsdosms1->m_MSub) / (1.0f - npsdosms1->m_MSub);
		npsdosms1->m_Bmin_sub[i] = 1.0f + 2.0f * (npsdosms1->m_V - 1.0f) / npsdosms1->m_sQeqSub[i];
		if (npsdosms1->m_Qeq[i] < epsilon)
        {
			npsdosms1->m_temp[i] = 1.0f / epsilon;
        }
		else
        {
			npsdosms1->m_temp[i] = 1.0f / npsdosms1->m_Qeq[i];
        }
		avrg_q_inv += npsdosms1->m_temp[i];
    }
	avrg_q_inv = avrg_q_inv / npsdosms1->m_L;					
	npsdosms1->m_Bc = 1.0f + npsdosms1->m_av * (float)sqrt(avrg_q_inv);
	if (avrg_q_inv < 0.03)
    {
		npsdosms1->m_noise_slope_max = 8.0f;
    }
	else if (avrg_q_inv < 0.05)
    {
		npsdosms1->m_noise_slope_max = 4.0f;
    }
	else if (avrg_q_inv < 0.06)
    {
		npsdosms1->m_noise_slope_max = 2.0f;
    }
	else
    {
		npsdosms1->m_noise_slope_max = 1.2f;
    }
	return 0;
}
int dios_ssp_gsc_rmnpsdosms_computebiascorrection ( objCNPsdOsMs * npsdosms1 ) { int i ; float avrg_q_inv = 0.f ; float param = 0.f ; for ( i = 0 ; i < npsdosms1 -> m_L ; i ++ ) { param = npsdosms1 -> m_alpha [ i ] * npsdosms1 -> m_alpha [ i ] ; npsdosms1 -> m_beta [ i ] = 0.8f < param ? 0.8f : param ; npsdosms1 -> m_P1m [ i ] = npsdosms1 -> m_beta [ i ] * npsdosms1 -> m_P1m [ i ] + ( 1.0f - npsdosms1 -> m_beta [ i ] ) * npsdosms1 -> m_P [ i ] ; npsdosms1 -> m_P2m [ i ] = npsdosms1 -> m_beta [ i ] * npsdosms1 -> m_P2m [ i ] + ( 1.0f - npsdosms1 -> m_beta [ i ] ) * npsdosms1 -> m_P [ i ] * npsdosms1 -> m_P [ i ] ; npsdosms1 -> m_varP [ i ] = npsdosms1 -> m_P2m [ i ] - npsdosms1 -> m_P1m [ i ] * npsdosms1 -> m_P1m [ i ] ; param = 2.0f * npsdosms1 -> m_N [ i ] * npsdosms1 -> m_N [ i ] / ( npsdosms1 -> m_varP [ i ] + epsilon ) ; npsdosms1 -> m_Qeq [ i ] = 2.0f > param ? 2.0f : param ; npsdosms1 -> m_sQeq [ i ] = ( npsdosms1 -> m_Qeq [ i ] - 2.0f * npsdosms1 -> m_M ) / ( 1.0f - npsdosms1 -> m_M ) ; npsdosms1 -> m_Bmin [ i ] = 1.0f + 2.0f * ( npsdosms1 -> m_D - 1.0f ) / npsdosms1 -> m_sQeq [ i ] ; npsdosms1 -> m_sQeqSub [ i ] = ( npsdosms1 -> m_Qeq [ i ] - 2.0f * npsdosms1 -> m_MSub ) / ( 1.0f - npsdosms1 -> m_MSub ) ; npsdosms1 -> m_Bmin_sub [ i ] = 1.0f + 2.0f * ( npsdosms1 -> m_V - 1.0f ) / npsdosms1 -> m_sQeqSub [ i ] ; if ( npsdosms1 -> m_Qeq [ i ] < epsilon ) { npsdosms1 -> m_temp [ i ] = 1.0f / epsilon ; } else { npsdosms1 -> m_temp [ i ] = 1.0f / npsdosms1 -> m_Qeq [ i ] ; } avrg_q_inv += npsdosms1 -> m_temp [ i ] ; } avrg_q_inv = avrg_q_inv / npsdosms1 -> m_L ; npsdosms1 -> m_Bc = 1.0f + npsdosms1 -> m_av * ( float ) sqrt ( avrg_q_inv ) ; if ( avrg_q_inv < 0.03 ) { npsdosms1 -> m_noise_slope_max = 8.0f ; } else if ( avrg_q_inv < 0.05 ) { npsdosms1 -> m_noise_slope_max = 4.0f ; } else if ( avrg_q_inv < 0.06 ) { npsdosms1 -> m_noise_slope_max = 2.0f ; } else { npsdosms1 -> m_noise_slope_max = 1.2f ; } return 0 ; }
computation of the Bias introduced because of using
 subwindows and short time estimation.
computation of the Bias introduced because of using subwindows and short time estimation .
/* 1.beta(k)=min(alpha(k)^2,0.8) */ /* 2.var{P} = P2m - P1m^2 */ /* 3.Qeq = (2*SIGMAn^4)/var{P} */ /* 4.QeqS = (Qeq - 2*M(D))/(1-M(D)) */ /* 5.Bmin = 1+(D-1)*2/sQeq */ /* 6.QeqS_sub = (Qeq - 2*M(V))/(1-M(V)) */ /* 7.Bmin_sub = 1+(V-1)*2/sQeq */ /* 8.Bc = 1 + av * sqrt(Q^(-1)) */ /* noise_slope_max (in Fig.5) */