athena_signal/kernels/dios_ssp_aec/dios_ssp_aec_tde/dios_ssp_aec_tde_delay_estimator_wrapper.c
static unsigned int BinarySpectrum(float* spectrum, SpectrumType* threshold_spectrum, int q_domain, int* threshold_initialized)
{
    int i = kBandFirst;
    unsigned int out = 0;
    float kScale = 1 / 64.0; // adjustable
    
    if(q_domain >= 16)
    {
        return -1;
    }

    if (!(*threshold_initialized))
    {
        for (i = kBandFirst; i <= kBandLast; i++)
		{
            if (spectrum[i] > 0.0)
	        {
                threshold_spectrum[i].float_ = spectrum[i] / 2;
                *threshold_initialized = 1;
            }
        }
    }
    for (i = kBandFirst; i <= kBandLast; i++)
	{
        // Update the |threshold_spectrum|.
        threshold_spectrum[i].float_ += (spectrum[i] - threshold_spectrum[i].float_) * kScale;
        // Convert |spectrum| at current frequency bin to a binary value.
        if ((int)(spectrum[i]) > (int)(threshold_spectrum[i].float_))
	    {
            out = out | (1<<(i -kBandFirst ));
        }
    }

    return out;
}
/* Computes the binary spectrum by comparing the input |spectrum| with a |threshold_spectrum|. */
// Input: 
// spectrum: Spectrum of which the binary spectrum should be calculated.
// threshold_spectrum: Threshold spectrum with which the input spectrum is compared.
// Output: 
// Binary spectrum.

Computes the binary spectrum by comparing the input |spectrum| with a |threshold_spectrum|.
Input:
spectrum: Spectrum of which the binary spectrum should be calculated.
threshold_spectrum: Threshold spectrum with which the input spectrum is compared.
Output:
Binary spectrum.
Computes the binary spectrum by comparing the input |spectrum| with a |threshold_spectrum| . Input : spectrum : Spectrum of which the binary spectrum should be calculated . threshold_spectrum : Threshold spectrum with which the input spectrum is compared . Output : Binary spectrum .
static unsigned int BinarySpectrum(float* spectrum, SpectrumType* threshold_spectrum, int q_domain, int* threshold_initialized)
{
    int i = kBandFirst;
    unsigned int out = 0;
    float kScale = 1 / 64.0; 
    if(q_domain >= 16)
    {
        return -1;
    }
    if (!(*threshold_initialized))
    {
        for (i = kBandFirst; i <= kBandLast; i++)
		{
            if (spectrum[i] > 0.0)
	        {
                threshold_spectrum[i].float_ = spectrum[i] / 2;
                *threshold_initialized = 1;
            }
        }
    }
    for (i = kBandFirst; i <= kBandLast; i++)
	{
        threshold_spectrum[i].float_ += (spectrum[i] - threshold_spectrum[i].float_) * kScale;
        if ((int)(spectrum[i]) > (int)(threshold_spectrum[i].float_))
	    {
            out = out | (1<<(i -kBandFirst ));
        }
    }
    return out;
}
static unsigned int BinarySpectrum ( float * spectrum , SpectrumType * threshold_spectrum , int q_domain , int * threshold_initialized ) { int i = kBandFirst ; unsigned int out = 0 ; float kScale = 1 / 64.0 ; if ( q_domain >= 16 ) { return -1 ; } if ( ! ( * threshold_initialized ) ) { for ( i = kBandFirst ; i <= kBandLast ; i ++ ) { if ( spectrum [ i ] > 0.0 ) { threshold_spectrum [ i ] . float_ = spectrum [ i ] / 2 ; * threshold_initialized = 1 ; } } } for ( i = kBandFirst ; i <= kBandLast ; i ++ ) { threshold_spectrum [ i ] . float_ += ( spectrum [ i ] - threshold_spectrum [ i ] . float_ ) * kScale ; if ( ( int ) ( spectrum [ i ] ) > ( int ) ( threshold_spectrum [ i ] . float_ ) ) { out = out | ( 1 << ( i - kBandFirst ) ) ; } } return out ; }
Computes the binary spectrum by comparing the input |spectrum| with a |threshold_spectrum|.
Computes the binary spectrum by comparing the input |spectrum| with a |threshold_spectrum| .
// adjustable
 // Update the |threshold_spectrum|.
 // Convert |spectrum| at current frequency bin to a binary value.
