/* Combine the tonal band spectrum and regular band spectrum Return position of the last tonal coefficient */
static int addTonalComponents(float *pSpectrum, int numComponents, tonal_component *pComponent)
/* Combine the tonal band spectrum and regular band spectrum Return position of the last tonal coefficient */
static int addTonalComponents(float *pSpectrum, int numComponents, tonal_component *pComponent)
{
    int   cnt, i, lastPos = -1;
    float   *pIn, *pOut;
    for (cnt = 0; cnt < numComponents; cnt++){
        lastPos = FFMAX(pComponent[cnt].pos + pComponent[cnt].numCoefs, lastPos);
        pIn = pComponent[cnt].coef;
        pOut = &(pSpectrum[pComponent[cnt].pos]);
        for (i=0 ; i<pComponent[cnt].numCoefs ; i++)
            pOut[i] += pIn[i];
    }
    return lastPos;
}