Skip to content

FD-CNG coherence reset

In function FdCngDecodeDiracMDCTStereoSID(), there is the following reset of the FD-CNG coherence parameter:

    sts[0]->hFdCngDec->hFdCngCom->coherence = 0.0f;
    sts[1]->hFdCngDec->hFdCngCom->coherence = 0.0f;

    if ( hCPE->nchan_out == 1 )
    {
        /* create proper M noise shape in channel zero after gains have been applied */
        for ( p = 0; p < N; p++ )
        {
            sts[0]->hFdCngDec->hFdCngCom->sidNoiseEst[p] = 0.5f * ( sts[0]->hFdCngDec->hFdCngCom->sidNoiseEst[p] + sts[1]->hFdCngDec->hFdCngCom->sidNoiseEst[p] );
        }
        sts[0]->hFdCngDec->hFdCngCom->coherence = 0.0f;
        sts[1]->hFdCngDec->hFdCngCom->coherence = 0.0f;
    }

I did not investigate the role of this parameter but it looks strange that it is reset twice. I am thus wondering if the first reset (in all cases) or the second one (only when nchan_out == 1) is the right one.