bucket_utility.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_CAPABILITIES_BUCKET_UTILITY_H_
  5. #define MEDIA_CAPABILITIES_BUCKET_UTILITY_H_
  6. #include "media/base/media_export.h"
  7. #include "ui/gfx/geometry/size.h"
  8. namespace media {
  9. // Find the nearest "bucket" with dimensions >= |raw_size|. While smaller
  10. // buckets may more closely describe |raw_size|, the next largest bucket is
  11. // chosen to surface cutoff resolutions in HW-accelerated decoders. Exceeding
  12. // the HW cutoff will invoke the software fallback, giving potentially very
  13. // different decode performance at larger resolutions. Will return an empty
  14. // size if |raw_size| is too small to be bucketed.
  15. MEDIA_EXPORT gfx::Size GetSizeBucket(const gfx::Size& raw_size);
  16. // Round |raw_fps| to the nearest (smaller or larger) "bucket". FrameRates in
  17. // the same bucket should have nearly identical decode performance
  18. // characteristics. Bucketing helps avoid fragmentation of recorded stats.
  19. MEDIA_EXPORT int GetFpsBucket(double raw_fps);
  20. // Find the nearest WebRTC pixels bucket. Pixel buckets are used to quantize the
  21. // resolution to limit the amount of information that is stored and exposed
  22. // through the API.
  23. MEDIA_EXPORT int GetWebrtcPixelsBucket(int pixels);
  24. // Find the nearest WebRTC pixels bucket index. The index is used when logging
  25. // the performance of the API, if the index is changed the corresponding logging
  26. // code must also be changed.
  27. MEDIA_EXPORT int GetWebrtcPixelsBucketIndex(int pixels);
  28. } // namespace media
  29. #endif // MEDIA_CAPABILITIES_BUCKET_UTILITY_H_