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}
This commit is contained in:
kthelgason
2016-09-14 02:14:58 -07:00
committed by Commit bot
parent a075848ebd
commit 194f40a2e7
10 changed files with 208 additions and 130 deletions

View File

@ -48,26 +48,25 @@ class QualityScaler {
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