void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t       *pInstance,
                                  LVM_INT16               *pDataIn,
                                  LVM_INT16               *pDataOut,
                                  LVM_INT16               NrSamples)
    {
        LVM_INT32  ynL,templ;
        LVM_INT16 ii;
        PFilter_State pBiquadState = (PFilter_State) pInstance;

         for (ii = NrSamples; ii != 0; ii--)
         {


            /**************************************************************************
                            PROCESSING OF THE LEFT CHANNEL
            ***************************************************************************/
            // ynL=A2 (Q14) * x(n-2)L (Q0) in Q14
            ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[1];

            // ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14
            ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];

            // ynL+=A0 (Q14) * x(n)L (Q0) in Q14
            ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);

            // ynL+= ( (-B2 (Q14) * y(n-2)L (Q16) )>>16) in Q14
            MUL32x16INTO32(pBiquadState->pDelays[3],pBiquadState->coefs[3],templ,16)
            ynL+=templ;

            // ynL+= ( (-B1 (Q14) * y(n-1)L (Q16) )>>16) in Q14
            MUL32x16INTO32(pBiquadState->pDelays[2],pBiquadState->coefs[4],templ,16)
            ynL+=templ;

            /**************************************************************************
                            UPDATING THE DELAYS
            ***************************************************************************/
            pBiquadState->pDelays[3]=pBiquadState->pDelays[2];  // y(n-2)L=y(n-1)L
            pBiquadState->pDelays[1]=pBiquadState->pDelays[0];  // x(n-2)L=x(n-1)L
            pBiquadState->pDelays[2]=ynL<<2;                    // Update y(n-1)L in Q16
            pBiquadState->pDelays[0]=(*pDataIn++);              // Update x(n-1)L in Q0

            /**************************************************************************
                            WRITING THE OUTPUT
            ***************************************************************************/
            *pDataOut++=(LVM_INT16)(ynL>>14); // Write Left output in Q0

        }
    }
void BQ_2I_D16F32C15_TRC_WRA_01 (           Biquad_Instance_t       *pInstance,
                                            LVM_INT16                    *pDataIn,
                                            LVM_INT16                    *pDataOut,
                                            LVM_INT16                    NrSamples)
    {
        LVM_INT32  ynL,ynR,templ;
        LVM_INT16 ii;
        PFilter_State pBiquadState = (PFilter_State) pInstance;

         for (ii = NrSamples; ii != 0; ii--)
         {


            /**************************************************************************
                            PROCESSING OF THE LEFT CHANNEL
            ***************************************************************************/
            /* ynL=A2 (Q15) * x(n-2)L (Q0) in Q15*/
            ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];

            /* ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15*/
            ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];

            /* ynL+=A0 (Q15) * x(n)L (Q0) in Q15*/
            ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);

            /* ynL+= ( (-B2 (Q15) * y(n-2)L (Q16) )>>16) in Q15 */
            MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
            ynL+=templ;

            /* ynL+=( (-B1 (Q15) * y(n-1)L (Q16) )>>16) in Q15 */
            MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
            ynL+=templ;

            /**************************************************************************
                            PROCESSING OF THE RIGHT CHANNEL
            ***************************************************************************/
            /* ynR=A2 (Q15) * x(n-2)R (Q0) in Q15*/
            ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];

            /* ynR+=A1 (Q15) * x(n-1)R (Q0) in Q15*/
            ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];

            /* ynR+=A0 (Q15) * x(n)R (Q0) in Q15*/
            ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));

            /* ynR+= ( (-B2 (Q15) * y(n-2)R (Q16) )>>16) in Q15 */
            MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
            ynR+=templ;

            /* ynR+=( (-B1 (Q15) * y(n-1)R (Q16) )>>16) in Q15 */
            MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
            ynR+=templ;

            /**************************************************************************
                            UPDATING THE DELAYS
            ***************************************************************************/
            pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
            pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
            pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
            pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
            pBiquadState->pDelays[5]=ynR<<1; /* Update y(n-1)R in Q16*/
            pBiquadState->pDelays[4]=ynL<<1; /* Update y(n-1)L in Q16*/
            pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
            pDataIn++;
            pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
            pDataIn++;

            /**************************************************************************
                            WRITING THE OUTPUT
            ***************************************************************************/
            *pDataOut=(LVM_INT16)(ynL>>15); /* Write Left output in Q0*/
            pDataOut++;
            *pDataOut=(LVM_INT16)(ynR>>15); /* Write Right ouput in Q0*/
            pDataOut++;
        }

    }
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t       *pInstance,
                                     LVM_INT16               *pDataIn,
                                     LVM_INT16               *pDataOut,
                                     LVM_INT16               NrSamples)
    {
        LVM_INT32   ynL,ynR;
        LVM_INT32   Temp;
        LVM_INT32   NegSatValue;
        LVM_INT16   ii;
        LVM_INT16   Shift;
        PFilter_State pBiquadState = (PFilter_State) pInstance;

        NegSatValue = LVM_MAXINT_16 +1;
        NegSatValue = -NegSatValue;

        Shift = pBiquadState->Shift;


        for (ii = NrSamples; ii != 0; ii--)
        {

            /**************************************************************************
                            PROCESSING OF THE LEFT CHANNEL
            ***************************************************************************/

            // ynL =A1 (Q15) * x(n-1)L (Q15) in Q30
            ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[0];
            // ynR =A1 (Q15) * x(n-1)R (Q15) in Q30
            ynR=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];


            // ynL+=A0 (Q15) * x(n)L (Q15) in Q30
            ynL+=(LVM_INT32)pBiquadState->coefs[1]* (*pDataIn);
            // ynR+=A0 (Q15) * x(n)L (Q15) in Q30
            ynR+=(LVM_INT32)pBiquadState->coefs[1]* (*(pDataIn+1));


            // ynL +=  (-B1 (Q15) * y(n-1)L (Q30) ) in Q30
            MUL32x16INTO32(pBiquadState->pDelays[1],pBiquadState->coefs[2],Temp,15);
            ynL +=Temp;
            // ynR +=  (-B1 (Q15) * y(n-1)R (Q30) ) in Q30
            MUL32x16INTO32(pBiquadState->pDelays[3],pBiquadState->coefs[2],Temp,15);
            ynR +=Temp;


            /**************************************************************************
                            UPDATING THE DELAYS
            ***************************************************************************/
            pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q30
            pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q15

            pBiquadState->pDelays[3]=ynR; // Update y(n-1)R in Q30
            pBiquadState->pDelays[2]=(*pDataIn++); // Update x(n-1)R in Q15

            /**************************************************************************
                            WRITING THE OUTPUT
            ***************************************************************************/
            /*Apply shift: Instead of left shift on 16-bit result, right shift of (15-shift) is applied
              for better SNR*/
            ynL = ynL>>(15-Shift);
            ynR = ynR>>(15-Shift);

            /*Saturate results*/
            if(ynL > LVM_MAXINT_16)
            {
                ynL = LVM_MAXINT_16;
            }
            else
            {
                if(ynL < NegSatValue)
                {
                    ynL = NegSatValue;
                }
            }

            if(ynR > LVM_MAXINT_16)
            {
                ynR = LVM_MAXINT_16;
            }
            else
            {
                if(ynR < NegSatValue)
                {
                    ynR = NegSatValue;
                }
            }

            *pDataOut++=(LVM_INT16)ynL;
            *pDataOut++=(LVM_INT16)ynR;
        }

    }