src/media/audio/audio_core/mixer/test/mixer_response_tests.cc
// Given result and limit arrays, compare phase results (ensure that "was previously zero" stays
// that way). If 'summary_only', limit evaluation to the three basic frequencies.
Given result and limit arrays, compare phase results (ensure that "was previously zero" stays
that way). If 'summary_only', limit evaluation to the three basic frequencies.
Given result and limit arrays compare phase results ( ensure that " was previously zero " stays that way ) . If ' summary_only ' limit evaluation to the three basic frequencies .
void EvaluatePhaseResults(double* phase_results, const double* phase_limits,
                          bool summary_only = false) {
  auto use_full_set = (!summary_only) && FrequencySet::UseFullFrequencySet;
  const auto first_idx = use_full_set ? FrequencySet::kFirstInBandRefFreqIdx : 0u;
  const auto last_idx =
      use_full_set ? FrequencySet::kFirstOutBandRefFreqIdx : FrequencySet::kSummaryIdxs.size();
  for (auto idx = first_idx; idx < last_idx; ++idx) {
    auto freq = use_full_set ? idx : FrequencySet::kSummaryIdxs[idx];
    if (phase_limits[freq] == -INFINITY) {
      continue;
    }
    if ((phase_results[freq] - phase_limits[freq]) >= M_PI) {
      EXPECT_NEAR(phase_results[freq], phase_limits[freq] + (2.0 * M_PI),
                  AudioResult::kPhaseTolerance)
          << " [" << freq << "]  " << std::fixed << std::setprecision(5) << phase_results[freq];
    } else if ((phase_results[freq] - phase_limits[freq]) <= -M_PI) {
      EXPECT_NEAR(phase_results[freq], phase_limits[freq] - (2.0 * M_PI),
                  AudioResult::kPhaseTolerance)
          << " [" << freq << "]  " << std::fixed << std::setprecision(5) << phase_results[freq];
    } else {
      EXPECT_NEAR(phase_results[freq], phase_limits[freq], AudioResult::kPhaseTolerance)
          << " [" << freq << "]  " << std::fixed << std::setprecision(5) << phase_results[freq];
    }
  }
}
void EvaluatePhaseResults ( double * phase_results , const double * phase_limits , bool summary_only = false ) { auto use_full_set = ( ! summary_only ) && FrequencySet :: UseFullFrequencySet ; const auto first_idx = use_full_set ? FrequencySet :: kFirstInBandRefFreqIdx : 0u ; const auto last_idx = use_full_set ? FrequencySet :: kFirstOutBandRefFreqIdx : FrequencySet :: kSummaryIdxs . size ( ) ; for ( auto idx = first_idx ; idx < last_idx ; ++ idx ) { auto freq = use_full_set ? idx : FrequencySet :: kSummaryIdxs [ idx ] ; if ( phase_limits [ freq ] == - INFINITY ) { continue ; } if ( ( phase_results [ freq ] - phase_limits [ freq ] ) >= M_PI ) { EXPECT_NEAR ( phase_results [ freq ] , phase_limits [ freq ] + ( 2.0 * M_PI ) , AudioResult :: kPhaseTolerance ) << " " << freq << " " << std :: fixed << std :: setprecision ( 5 ) << phase_results [ freq ] ; } else if ( ( phase_results [ freq ] - phase_limits [ freq ] ) <= - M_PI ) { EXPECT_NEAR ( phase_results [ freq ] , phase_limits [ freq ] - ( 2.0 * M_PI ) , AudioResult :: kPhaseTolerance ) << " " << freq << " " << std :: fixed << std :: setprecision ( 5 ) << phase_results [ freq ] ; } else { EXPECT_NEAR ( phase_results [ freq ] , phase_limits [ freq ] , AudioResult :: kPhaseTolerance ) << " " << freq << " " << std :: fixed << std :: setprecision ( 5 ) << phase_results [ freq ] ; } } }
Given result and limit arrays, compare phase results (ensure that "was previously zero" stays
that way).
Given result and limit arrays compare phase results ( ensure that " was previously zero " stays that way ) .