Reformat existing code.  There should be no functional effects.

This includes changes like:
* Attempt to break lines at better positions
* Use "override" in more places, don't use "virtual" with it
* Use {} where the body is more than one line
* Make declaration and definition arg names match
* Eliminate unused code
* EXPECT_EQ(expected, actual) (but use (actual, expected) for e.g. _GT)
* Correct #include order
* Use anonymous namespaces in preference to "static" for file-scoping
* Eliminate unnecessary casts
* Update reference code in comments of ARM assembly sources to match actual current C code
* Fix indenting to be more style-guide compliant
* Use arraysize() in more places
* Use bool instead of int for "boolean" values (0/1)
* Shorten and simplify code
* Spaces around operators
* 80 column limit
* Use const more consistently
* Space goes after '*' in type name, not before
* Remove unnecessary return values
* Use "(var == const)", not "(const == var)"
* Spelling
* Prefer true, typed constants to "enum hack" constants
* Avoid "virtual" on non-overridden functions
* ASSERT(x == y) -> ASSERT_EQ(y, x)

BUG=none
R=andrew@webrtc.org, asapersson@webrtc.org, henrika@webrtc.org, juberti@webrtc.org, kjellander@webrtc.org, kwiberg@webrtc.org

Review URL: https://codereview.webrtc.org/1172163004

Cr-Commit-Position: refs/heads/master@{#9420}
diff --git a/webrtc/modules/audio_coding/neteq/decision_logic_normal.h b/webrtc/modules/audio_coding/neteq/decision_logic_normal.h
index 0254839..047663f 100644
--- a/webrtc/modules/audio_coding/neteq/decision_logic_normal.h
+++ b/webrtc/modules/audio_coding/neteq/decision_logic_normal.h
@@ -61,7 +61,8 @@
   virtual Operations FuturePacketAvailable(
       const SyncBuffer& sync_buffer,
       const Expand& expand,
-      int decoder_frame_length, Modes prev_mode,
+      int decoder_frame_length,
+      Modes prev_mode,
       uint32_t target_timestamp,
       uint32_t available_timestamp,
       bool play_dtmf);
diff --git a/webrtc/modules/audio_coding/neteq/expand.cc b/webrtc/modules/audio_coding/neteq/expand.cc
index d5f0f9c..bde6559 100644
--- a/webrtc/modules/audio_coding/neteq/expand.cc
+++ b/webrtc/modules/audio_coding/neteq/expand.cc
@@ -214,24 +214,24 @@
 
     // Create combined signal by shifting in more and more of unvoiced part.
     temp_shift = 8 - temp_shift;  // = getbits(mix_factor_increment).
-    size_t temp_lenght = (parameters.current_voice_mix_factor -
+    size_t temp_length = (parameters.current_voice_mix_factor -
         parameters.voice_mix_factor) >> temp_shift;
-    temp_lenght = std::min(temp_lenght, current_lag);
-    DspHelper::CrossFade(voiced_vector, unvoiced_vector, temp_lenght,
+    temp_length = std::min(temp_length, current_lag);
+    DspHelper::CrossFade(voiced_vector, unvoiced_vector, temp_length,
                          &parameters.current_voice_mix_factor,
                          mix_factor_increment, temp_data);
 
     // End of cross-fading period was reached before end of expanded signal
     // path. Mix the rest with a fixed mixing factor.
-    if (temp_lenght < current_lag) {
+    if (temp_length < current_lag) {
       if (mix_factor_increment != 0) {
         parameters.current_voice_mix_factor = parameters.voice_mix_factor;
       }
       int16_t temp_scale = 16384 - parameters.current_voice_mix_factor;
       WebRtcSpl_ScaleAndAddVectorsWithRound(
-          voiced_vector + temp_lenght, parameters.current_voice_mix_factor,
-          unvoiced_vector + temp_lenght, temp_scale, 14,
-          temp_data + temp_lenght, static_cast<int>(current_lag - temp_lenght));
+          voiced_vector + temp_length, parameters.current_voice_mix_factor,
+          unvoiced_vector + temp_length, temp_scale, 14,
+          temp_data + temp_length, static_cast<int>(current_lag - temp_length));
     }
 
     // Select muting slope depending on how many consecutive expands we have
@@ -428,13 +428,12 @@
 
   // Calculate the exact best correlation in the range between
   // |correlation_lag| and |distortion_lag|.
-  correlation_length = distortion_lag + 10;
-  correlation_length = std::min(correlation_length, fs_mult_120);
-  correlation_length = std::max(correlation_length, 60 * fs_mult);
+  correlation_length =
+      std::max(std::min(distortion_lag + 10, fs_mult_120), 60 * fs_mult);
 
   int start_index = std::min(distortion_lag, correlation_lag);
-  int correlation_lags = WEBRTC_SPL_ABS_W16((distortion_lag-correlation_lag))
-      + 1;
+  int correlation_lags =
+      WEBRTC_SPL_ABS_W16((distortion_lag-correlation_lag)) + 1;
   assert(correlation_lags <= 99 * fs_mult + 1);  // Cannot be larger.
 
   for (size_t channel_ix = 0; channel_ix < num_channels_; ++channel_ix) {
@@ -753,8 +752,10 @@
   memset(ar_filter_state, 0, sizeof(ar_filter_state));
 }
 
-int16_t Expand::Correlation(const int16_t* input, size_t input_length,
-                            int16_t* output, int16_t* output_scale) const {
+void Expand::Correlation(const int16_t* input,
+                         size_t input_length,
+                         int16_t* output,
+                         int16_t* output_scale) const {
   // Set parameters depending on sample rate.
   const int16_t* filter_coefficients;
   int16_t num_coefficients;
@@ -818,7 +819,6 @@
                                    norm_shift2);
   // Total scale factor (right shifts) of correlation value.
   *output_scale = 2 * norm_shift + kCorrelationShift + norm_shift2;
-  return kNumCorrelationLags;
 }
 
 void Expand::UpdateLagIndex() {
@@ -850,7 +850,7 @@
                                      int16_t* buffer) {
   static const int kNoiseLpcOrder = BackgroundNoise::kMaxLpcOrder;
   int16_t scaled_random_vector[kMaxSampleRate / 8000 * 125];
-  assert(static_cast<size_t>(kMaxSampleRate / 8000 * 125) >= num_noise_samples);
+  assert(num_noise_samples <= static_cast<size_t>(kMaxSampleRate / 8000 * 125));
   int16_t* noise_samples = &buffer[kNoiseLpcOrder];
   if (background_noise_->initialized()) {
     // Use background noise parameters.
diff --git a/webrtc/modules/audio_coding/neteq/expand.h b/webrtc/modules/audio_coding/neteq/expand.h
index 0000642..b015959 100644
--- a/webrtc/modules/audio_coding/neteq/expand.h
+++ b/webrtc/modules/audio_coding/neteq/expand.h
@@ -119,9 +119,11 @@
   // Calculate the auto-correlation of |input|, with length |input_length|
   // samples. The correlation is calculated from a downsampled version of
   // |input|, and is written to |output|. The scale factor is written to
-  // |output_scale|. Returns the length of the correlation vector.
-  int16_t Correlation(const int16_t* input, size_t input_length,
-                      int16_t* output, int16_t* output_scale) const;
+  // |output_scale|.
+  void Correlation(const int16_t* input,
+                   size_t input_length,
+                   int16_t* output,
+                   int16_t* output_scale) const;
 
   void UpdateLagIndex();
 
diff --git a/webrtc/modules/audio_coding/neteq/merge.cc b/webrtc/modules/audio_coding/neteq/merge.cc
index 8399a78..8e686ba 100644
--- a/webrtc/modules/audio_coding/neteq/merge.cc
+++ b/webrtc/modules/audio_coding/neteq/merge.cc
@@ -312,8 +312,8 @@
                                       int expand_period) const {
   // Calculate correlation without any normalization.
   const int max_corr_length = kMaxCorrelationLength;
-  int stop_position_downsamp = std::min(
-      max_corr_length, expand_->max_lag() / (fs_mult_ * 2) + 1);
+  int stop_position_downsamp =
+      std::min(max_corr_length, expand_->max_lag() / (fs_mult_ * 2) + 1);
   int16_t correlation_shift = 0;
   if (expanded_max * input_max > 26843546) {
     correlation_shift = 3;
@@ -367,9 +367,9 @@
   // Ensure that underrun does not occur for 10ms case => we have to get at
   // least 10ms + overlap . (This should never happen thanks to the above
   // modification of peak-finding starting point.)
-  while ((best_correlation_index + input_length) <
-      static_cast<int>(timestamps_per_call_ + expand_->overlap_length()) ||
-      best_correlation_index + input_length < start_position) {
+  while (((best_correlation_index + input_length) <
+      static_cast<int>(timestamps_per_call_ + expand_->overlap_length())) ||
+      ((best_correlation_index + input_length) < start_position)) {
     assert(false);  // Should never happen.
     best_correlation_index += expand_period;  // Jump one lag ahead.
   }
diff --git a/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
index 729dbf6..bf68b3b 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
@@ -74,7 +74,7 @@
       return -1;
     }
     payload_size_bytes_ = WebRtcPcm16b_Encode(input_, frame_size_samples_,
-                                              encoded_);;
+                                              encoded_);
 
     int next_send_time = rtp_generator_->GetRtpHeader(
         kPayloadType, frame_size_samples_, &rtp_header_);
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 3a3ad98..29b8d1a 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -315,9 +315,10 @@
 int NetEqImpl::NetworkStatistics(NetEqNetworkStatistics* stats) {
   CriticalSectionScoped lock(crit_sect_.get());
   assert(decoder_database_.get());
-  const int total_samples_in_buffers = packet_buffer_->NumSamplesInBuffer(
-      decoder_database_.get(), decoder_frame_length_) +
-          static_cast<int>(sync_buffer_->FutureLength());
+  const int total_samples_in_buffers =
+      packet_buffer_->NumSamplesInBuffer(decoder_database_.get(),
+                                         decoder_frame_length_) +
+      static_cast<int>(sync_buffer_->FutureLength());
   assert(delay_manager_.get());
   assert(decision_logic_.get());
   stats_.GetNetworkStatistics(fs_hz_, total_samples_in_buffers,
@@ -704,8 +705,10 @@
   return 0;
 }
 
-int NetEqImpl::GetAudioInternal(size_t max_length, int16_t* output,
-                                int* samples_per_channel, int* num_channels) {
+int NetEqImpl::GetAudioInternal(size_t max_length,
+                                int16_t* output,
+                                int* samples_per_channel,
+                                int* num_channels) {
   PacketList packet_list;
   DtmfEvent dtmf_event;
   Operations operation;
diff --git a/webrtc/modules/audio_coding/neteq/packet_buffer.cc b/webrtc/modules/audio_coding/neteq/packet_buffer.cc
index 08b237f..5792b22 100644
--- a/webrtc/modules/audio_coding/neteq/packet_buffer.cc
+++ b/webrtc/modules/audio_coding/neteq/packet_buffer.cc
@@ -250,16 +250,12 @@
     Packet* packet = (*it);
     AudioDecoder* decoder =
         decoder_database->GetDecoder(packet->header.payloadType);
-    if (decoder) {
-      int duration;
-      if (packet->sync_packet) {
-        duration = last_duration;
-      } else if (packet->primary) {
-        duration =
-            decoder->PacketDuration(packet->payload, packet->payload_length);
-      } else {
+    if (decoder && !packet->sync_packet) {
+      if (!packet->primary) {
         continue;
       }
+      int duration =
+        decoder->PacketDuration(packet->payload, packet->payload_length);
       if (duration >= 0) {
         last_duration = duration;  // Save the most up-to-date (valid) duration.
       }
diff --git a/webrtc/modules/audio_coding/neteq/preemptive_expand.h b/webrtc/modules/audio_coding/neteq/preemptive_expand.h
index c583a48..65da703 100644
--- a/webrtc/modules/audio_coding/neteq/preemptive_expand.h
+++ b/webrtc/modules/audio_coding/neteq/preemptive_expand.h
@@ -52,9 +52,9 @@
  protected:
   // Sets the parameters |best_correlation| and |peak_index| to suitable
   // values when the signal contains no active speech.
-  void SetParametersForPassiveSpeech(size_t len,
-                                     int16_t* w16_bestCorr,
-                                     int* w16_bestIndex) const override;
+  void SetParametersForPassiveSpeech(size_t input_length,
+                                     int16_t* best_correlation,
+                                     int* peak_index) const override;
 
   // Checks the criteria for performing the time-stretching operation and,
   // if possible, performs the time-stretching.
diff --git a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
index f637eb8..ce800dd 100644
--- a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
+++ b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
@@ -149,7 +149,7 @@
 
   stats->speech_expand_rate =
       CalculateQ14Ratio(expanded_speech_samples_,
-      timestamps_since_last_report_);
+                        timestamps_since_last_report_);
 
   stats->secondary_decoded_rate =
       CalculateQ14Ratio(secondary_decoded_samples_,
diff --git a/webrtc/modules/audio_coding/neteq/test/RTPencode.cc b/webrtc/modules/audio_coding/neteq/test/RTPencode.cc
index 192d374..f25a279 100644
--- a/webrtc/modules/audio_coding/neteq/test/RTPencode.cc
+++ b/webrtc/modules/audio_coding/neteq/test/RTPencode.cc
@@ -152,7 +152,7 @@
 #ifdef NETEQ_ISACFIX_CODEC
 #include "isacfix.h"
 #ifdef CODEC_ISAC
-#error Cannot have both ISAC and ISACfix defined. Please de-select one in the beginning of RTPencode.cpp
+#error Cannot have both ISAC and ISACfix defined. Please de-select one.
 #endif
 #endif
 #ifdef CODEC_G722
diff --git a/webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc b/webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc
index 65c4e9d..af4b8e1 100644
--- a/webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.cc
@@ -32,7 +32,7 @@
       timestamp_(0),
       payload_ssrc_(0xABCD1234) {
   int encoded_len = WebRtcPcm16b_Encode(&sample_value, 1, encoded_sample_);
-  CHECK_EQ(encoded_len, 2);
+  CHECK_EQ(2, encoded_len);
 }
 
 Packet* ConstantPcmPacketSource::NextPacket() {
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc
index 080b99b..1c76d76 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.cc
@@ -103,8 +103,8 @@
     static const int kMaxChannels = 1;
     static const int kMaxSamplesPerMs = 48000 / 1000;
     static const int kOutputBlockSizeMs = 10;
-    static const int kOutDataLen = kOutputBlockSizeMs * kMaxSamplesPerMs *
-        kMaxChannels;
+    static const int kOutDataLen =
+        kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels;
     int16_t out_data[kOutDataLen];
     int num_channels;
     int samples_per_channel;
diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
index 11dd20a..6bcd717 100644
--- a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
+++ b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
@@ -552,8 +552,8 @@
 
     // Check if it is time to get output audio.
     if (time_now_ms >= next_output_time_ms) {
-      static const int kOutDataLen = kOutputBlockSizeMs * kMaxSamplesPerMs *
-          kMaxChannels;
+      static const int kOutDataLen =
+          kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels;
       int16_t out_data[kOutDataLen];
       int num_channels;
       int samples_per_channel;