Refactor QualityScaler and MovingAverage

The MovingAverage class was very specific to the QualityScaler. This
commit generalizes the MovingAverage class to be useful in other
situations as well, and adapts the QualityScaler to use the new
MovingAverage.

BUG=webrtc:6304

Review-Url: https://codereview.webrtc.org/2310853002
Cr-Commit-Position: refs/heads/master@{#14207}
diff --git a/webrtc/modules/video_coding/utility/quality_scaler.h b/webrtc/modules/video_coding/utility/quality_scaler.h
index 7176d49..c1ae50b 100644
--- a/webrtc/modules/video_coding/utility/quality_scaler.h
+++ b/webrtc/modules/video_coding/utility/quality_scaler.h
@@ -48,26 +48,25 @@
   static const int kBadH264QpThreshold;
 
  private:
-  void AdjustScale(bool up);
-  void UpdateTargetResolution(int frame_width, int frame_height);
   void ClearSamples();
-  void UpdateSampleCounts();
+  void ScaleUp();
+  void ScaleDown();
+  void UpdateTargetResolution(int width, int height);
 
   I420BufferPool pool_;
 
   size_t num_samples_downscale_;
   size_t num_samples_upscale_;
-  int measure_seconds_upscale_;
-  MovingAverage<int> average_qp_upscale_;
-  MovingAverage<int> average_qp_downscale_;
+  bool fast_rampup_;
+  MovingAverage average_qp_;
+  MovingAverage framedrop_percent_;
 
-  int framerate_;
   int low_qp_threshold_;
   int high_qp_threshold_;
-  MovingAverage<int> framedrop_percent_;
-  Resolution res_;
+  Resolution target_res_;
 
   int downscale_shift_;
+  int maximum_shift_;
 };
 
 }  // namespace webrtc