quality_scaling_experiment.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2018 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef RTC_BASE_EXPERIMENTS_QUALITY_SCALING_EXPERIMENT_H_
  11. #define RTC_BASE_EXPERIMENTS_QUALITY_SCALING_EXPERIMENT_H_
  12. #include "absl/types/optional.h"
  13. #include "api/video_codecs/video_encoder.h"
  14. namespace webrtc {
  15. class QualityScalingExperiment {
  16. public:
  17. struct Settings {
  18. int vp8_low; // VP8: low QP threshold.
  19. int vp8_high; // VP8: high QP threshold.
  20. int vp9_low; // VP9: low QP threshold.
  21. int vp9_high; // VP9: high QP threshold.
  22. int h264_low; // H264: low QP threshold.
  23. int h264_high; // H264: high QP threshold.
  24. int generic_low; // Generic: low QP threshold.
  25. int generic_high; // Generic: high QP threshold.
  26. float alpha_high; // |alpha_| for ExpFilter used when checking high QP.
  27. float alpha_low; // |alpha_| for ExpFilter used when checking low QP.
  28. int drop; // >0 sets |use_all_drop_reasons| to true.
  29. };
  30. // Used by QualityScaler.
  31. struct Config {
  32. float alpha_high = 0.9995f;
  33. float alpha_low = 0.9999f;
  34. // If set, all type of dropped frames are used.
  35. // Otherwise only dropped frames by MediaOptimization are used.
  36. bool use_all_drop_reasons = false;
  37. };
  38. // Returns true if the experiment is enabled.
  39. static bool Enabled();
  40. // Returns settings from field trial.
  41. static absl::optional<Settings> ParseSettings();
  42. // Returns QpThresholds for the |codec_type|.
  43. static absl::optional<VideoEncoder::QpThresholds> GetQpThresholds(
  44. VideoCodecType codec_type);
  45. // Returns parsed values. If the parsing fails, default values are returned.
  46. static Config GetConfig();
  47. };
  48. } // namespace webrtc
  49. #endif // RTC_BASE_EXPERIMENTS_QUALITY_SCALING_EXPERIMENT_H_