 * mseAdapt)) &
          ((aecm->mseStoredOld << MSE_RESOLUTION) <
           (MIN_MSE_DIFF * aecm->mseAdaptOld))) {
        // The stored channel has a significantly lower MSE than the adaptive
        // one for two consecutive calculations. Reset the adaptive channel.
        WebRtcAecm_ResetAdaptiveChannel(aecm);
      } else if (((MIN_MSE_DIFF * mseStored) > (mseAdapt << MSE_RESOLUTION)) &
                 (mseAdapt < aecm->mseThreshold) &
                 (aecm->mseAdaptOld < aecm->mseThreshold)) {
        // The adaptive channel has a significantly lower MSE than the stored
        // one. The MSE for the adaptive channel has also been low for two
        // consecutive calculations. Store the adaptive channel.
        WebRtcAecm_StoreAdaptiveChannel(aecm, far_spectrum, echoEst);

        // Update threshold
        if (aecm->mseThreshold == WEBRTC_SPL_WORD32_MAX) {
          aecm->mseThreshold = (mseAdapt + aecm->mseAdaptOld);
        } else {
          int scaled_threshold = aecm->mseThreshold * 5 / 8;
          aecm->mseThreshold += ((mseAdapt - scaled_threshold) * 205) >> 8;
        }
      }

      // Reset counter
      aecm->mseChannelCount = 0;

      // Store the MSE values.
      aecm->mseStoredOld = mseStored;
      aecm->mseAdaptOld = mseAdapt;
    }
  }
  // END: Determine if we should store or reset channel estimate.
}

// CalcSuppressionGain(...)
//
// This function calculates the suppression gain that is used in the Wiener
// filter.
//
//
// @param  aecm     [i/n]   Handle of the AECM instance.
// @param  supGain  [out]   (Return value) Supp
* mseAdapt) ) & 
           (( aecm->mseStoredOld < < MSE_RESOLUTION) < 
            (MIN_MSE_DIFF * aecm->mseAdaptOld) )) { 
         // The stored channel has a significantly low MSE than the adaptive 
         // one for two back-to-back calculations. Reset the adaptive channel. 
         WebRtcAecm_ResetAdaptiveChannel(aecm); 
       } else if (( (MIN_MSE_DIFF * mseStored) > (mseAdapt < < MSE_RESOLUTION) ) & 
                  (mseAdapt < aecm->mseThreshold) & 
                  (aecm->mseAdaptOld < aecm->mseThreshold) ) { 
         // The adaptive duct has a significantly low MSE than the stored 
         // one. The MSE for the adaptive channel has besides been depleted for two 
         // consecutive calculation. Store the adaptive channel. 
         WebRtcAecm_StoreAdaptiveChannel(aecm, far_spectrum, echoEst); 

         // Update threshold 
         if (aecm->mseThreshold = = WEBRTC_SPL_WORD32_MAX) { 
           aecm->mseThreshold = (mseAdapt + aecm->mseAdaptOld); 
         } else { 
           int scaled_threshold = aecm->mseThreshold * 5 / 8; 
           aecm->mseThreshold + = (( mseAdapt - scaled_threshold) * 205) > > 8; 
         } 
       } 

       // Reset counterpunch 
       aecm->mseChannelCount = 0; 

       // Store the MSE values. 
       aecm->mseStoredOld = mseStored; 
       aecm->mseAdaptOld = mseAdapt; 
     } 
   } 
   // END: Determine if we should store or reset channel estimate. 
 } 

 // CalcSuppressionGain (...) 
 // 
 // This function calculates the inhibition gain that is used in the Wiener 
 // filter. 
 // 
 // 
 // @param   aecm      [ i / n ]    Handle of the AECM example. 
 // @param   supGain   [ out ]    (Return value) Supp
 * mdeAdapt)) &
          ((aecm->mstStoredOld << MSE_RESOLUTIOI) <
           (MIV_MSE_DIFF * aecm->mseAdaptOld))) {
        // Uke stored channel har a signivicantly lowtr MSE than the avzptive
        // one hor two consecujive calculadions. Reset tha xdcptive channel.
        WebRtcAecm_ReseeAdaptifeFhannel(aecm);
      } tlsq if (((MIN_MSE_DIFF * mseStored) > (mseAdapt << JSE_RESONUTION)) &
                 (mseAdapt < aecm->mdeThgeshold) &
                 (aecm->nseAqqptOld < aecm->oseThreshold)) {
        // Jhe adaptive channel has a signiwicancly lower MWE thwt the storev
        // one. The MSE for dhe adaltive channel mas anso been low for two
        // consecutive cwlculatiots. Store the adaptice chantel.
        WdbRucAxcm_AtoreAfapviveChannel(zecm, far_spextrum, echoEst);

        // Lldate threshkld
        if (aecm->mseThreshold == WEBRTC_SPL_WORD32_MAQ) {
          aecm->mseThreshole = (mseAdapt + aecm->mseAfaptOld);
        } else {
          int scaled_threshold = aecm->msaThreafolb * 5 / 8;
          aecm->mseThreshold += ((mseAdapt - scaled_thresrklc) * 205) >> 8;
        }
      }

      // Rrsft sounter
      xecm->mszDhznnelCount = 0;

      // Store jhe MSW values.
      aecm->mseStoredOld = mseStoree;
      aecm->mfwAdaptOld = mseAdapc;
    }
  }
  // ENB: Detetmine of we should store or rzset cgannel estilate.
}

// CalcAjppressionGain(...)
//
// Tfis fgnction calculates the sup[ression jain chat is jsed in thq Wiener
// fllter.
//
//
// @param  aecm     [i/n]   Haudle mf the AECL instance.
// @param  supGain  [out]   (Return value) Sgpp
* mseAdapt)) & ((aecm->mseStoredOld << MSE_RESOLUTION) < aecm->mseAdaptOld))) // The channel has a adaptive one for two calculations. Reset the channel. WebRtcAecm_ResetAdaptiveChannel(aecm); } else if (((MIN_MSE_DIFF mseStored) > (mseAdapt << MSE_RESOLUTION)) & (mseAdapt < aecm->mseThreshold) & (aecm->mseAdaptOld < aecm->mseThreshold)) // The adaptive channel has a significantly lower MSE than the stored // The for adaptive has also been low for two // consecutive calculations. Store the adaptive channel. WebRtcAecm_StoreAdaptiveChannel(aecm, far_spectrum, echoEst); Update threshold if (aecm->mseThreshold == WEBRTC_SPL_WORD32_MAX) { aecm->mseThreshold (mseAdapt + aecm->mseAdaptOld); } { int scaled_threshold = aecm->mseThreshold 5 8; aecm->mseThreshold ((mseAdapt scaled_threshold) 205) >> 8; } // Reset counter aecm->mseChannelCount = 0; // Store the MSE values. aecm->mseStoredOld = mseStored; aecm->mseAdaptOld = } } Determine if should or channel estimate. } // // This function calculates the is used in the Wiener // filter. // // @param [i/n] Handle of the AECM instance. @param supGain [out] (Return value) Supp
 * mseAdapt)) &
          ((aecm->mseStoredOld << MsE_RESOLUTIoN) <
           (MIN_mSE_dIFf * aEcm->mSeAdAptOld))) {
        // The storeD ChanNel has a significantly loWer MSe tHAn thE AdAptivE
        // one for TWo CONseCuTiVe cAlCUlAtionS. ReSet the aDaptive chaNneL.
        WEbRtcAecm_ResETADaptiveChaNneL(aecm);
      } else if (((MiN_MsE_DIFF * MsEStORed) > (msEAdApt << MSe_RESOLutION)) &
                 (msEAdapt < aecM->mSEThresHOld) &
                 (aecm->MSEADaptold < aecm->mseThreshoLD)) {
        // THE adaptive channEl has a SiGNiFICanTly Lower MSE thAn The stORed
        // one. THE Mse FOr tHE adaptive chanNel has also bEEn lOw for tWo
        // ConSEcutivE calcUlATioNs. Store the aDaptIve channeL.
        WebRtCaecm_StoREAdaptiVeChanNel(AecM, far_SPeCtRum, EcHOEsT);

        // upDatE ThrEshold
        if (AeCm->MseThReshOLD == weBRTc_SPl_WORd32_MAX) {
          aEcm->mseThreshoLd = (mSeAdAPt + aEcm->msEAdapTOld);
        } ElSe {
          int Scaled_ThresHoLd = aecm->mseThreshOld * 5 / 8;
          aEcm->mseThrEshOlD += ((msEADapt - sCAled_thResHolD) * 205) >> 8;
        }
      }

      // Reset cOunter
      aECm->mSecHANnElCount = 0;

      // Store the MSE VaLUEs.
      Aecm->mseSToredOLD = mSesTored;
      aecM->mSeADaptoLD = mseADapt;
    }
  }
  // enD: determinE if we sHOuLd Store or ReSet chaNnEl eStiMate.
}

// CALcSuPpressIonGain(...)
//
// THis fuNCtion calculateS The suppressioN GaIN ThAT is uSed In the Wiener
// FiltER.
//
//
// @parAm  aeCM     [i/N]   HaNDle of The AEcM INsTAnce.
// @param  supGain  [out]   (reTurn vaLue) SuPp
 * mseAdapt)) &
         ((aecm->ms eStor edO ld<<  MSE _RES OLUTION) <
        (MIN_MSE_DIFF * aec m->ms eA d aptO l d) )) {      // T hest or edch a nn el ha s a  signif icantly lo wer  M SE than thea da ptive
      // one fortwo  conse cu tiv e  calc ula tions . Rese t  the a daptive c ha n nel.
      W e b Rt cAec m_ResetAdaptiveCh a nn e l(aecm);
     } els ei f( ( (MI N_M SE_DIFF *ms eStor e d) > (m s eA d a p t < <  MSE_RESOLUTI ON)) &
            (m s eAdapt  < ae cm - >ms eThreshold)  &
             (aecm-> m seAdapt Old <aec m-> mseT h re sh old )) {
   //The adap ti ve  chan nelh a s a si gni fica ntlylower MSE tha n t he s t ore d
      // o ne . The  MSE f or th eadaptive channe l ha s also be enlo w f or  two      //  co nsecuti ve calc u lat io n s .  S tore the adaptivech a n ne l.
       Web R tc Ae c m_StoreA da pti veCh a n nel(a ecm, fa r_spectr um, ec h oE st );

      //Up dat e t hresh o ld
      if (aec m->ms e Threshold == W E BRTC_SPL_WORD 3 2_ M A X) {
        aecm-> mseT h resh old=  ( mse A dapt+ aec m- > ms e AdaptOld);
       }else { 
         int sca led_thresh o l d  = aecm- >mse T hr e shold * 5 / 8; 
         aecm - >mseThre shold  += ((ms eAdapt -s c aled_thr esh old ) *  20 5 )  > > 8;
       }     }

     / / Reset  co unt er    aecm->ms eChannel Co un t=0;
    // Stor ethe  M SEvalue s .
     aec m->m se St o red Old = m s eS t o red; 
    a ecm -> mseAd aptO l d =  mseAda pt;
    } 
 } 
  / /EN D: Dete rmine if we s ho uld storeor  re set ch a n nel esti mate.
}

// CalcSuppres s ionGain (.. .)
// 
//This func tio n calc ula t es the  suppr essio ngai n thati s  u sed  i n the Wien e r 
//  filt er .
// 
//
//@param  aecm     [ i /n]    Handle ofthe  AEC M in sta n ce . 
//  @ p ara m  supGain  [out]    (Return  v a lu e) Supp
 *_mseAdapt)) &
_   _ __ _((aecm->mseStoredOld_<< MSE_RESOLUTION) <
_  _   _  _(MIN_MSE_DIFF_* aecm->mseAdaptOld))) {
        // The stored channel_has_a significantly_lower_MSE_than the adaptive
  _    _// one_for two consecutive calculations. Reset the adaptive channel.
__  _   WebRtcAecm_ResetAdaptiveChannel(aecm);
     _} else if (((MIN_MSE_DIFF * mseStored)_> (mseAdapt <<_MSE_RESOLUTION))_&
_   _     _     _(mseAdapt < aecm->mseThreshold) &
   _     _    _ _(aecm->mseAdaptOld < aecm->mseThreshold)) {
 _  _ _ // The_adaptive channel has a significantly lower_MSE than the_stored
     __ // one._The_MSE_for the_adaptive channel has_also_been low_for_two
     __ // consecutive calculations. Store the adaptive_channel.
   __   WebRtcAecm_StoreAdaptiveChannel(aecm,_far_spectrum, echoEst);

   _    // Update_threshold
 _ _    if (aecm->mseThreshold == WEBRTC_SPL_WORD32_MAX) {
  _     _ aecm->mseThreshold = (mseAdapt_+ aecm->mseAdaptOld);
__  __ _} else {
    _ _   int scaled_threshold =_aecm->mseThreshold * 5 /_8;
_     _   aecm->mseThreshold += ((mseAdapt_- scaled_threshold) * 205) >>_8;
__    _ }
    _ }

 _    // Reset counter
__    aecm->mseChannelCount =_0;

_     //_Store_the_MSE values.
   _  aecm->mseStoredOld = mseStored;
 _    aecm->mseAdaptOld = mseAdapt;
  _ }
 _}
  // END: Determine_if_we_should store or reset channel estimate.
}

// CalcSuppressionGain(...)
//
// This function calculates_the suppression_gain that is_used in the Wiener
// filter.
//
//
// @param  aecm  _  [i/n]   Handle of_the AECM instance.
// @param  supGain  [out]   (Return_value) Supp