alignment_adjuster.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2020 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 VIDEO_ALIGNMENT_ADJUSTER_H_
  11. #define VIDEO_ALIGNMENT_ADJUSTER_H_
  12. #include "api/video_codecs/video_encoder.h"
  13. #include "api/video_codecs/video_encoder_config.h"
  14. namespace webrtc {
  15. class AlignmentAdjuster {
  16. public:
  17. // Returns the resolution alignment requested by the encoder (i.e
  18. // |EncoderInfo::requested_resolution_alignment| which ensures that delivered
  19. // frames to the encoder are divisible by this alignment).
  20. //
  21. // If |EncoderInfo::apply_alignment_to_all_simulcast_layers| is enabled, the
  22. // alignment will be adjusted to ensure that each simulcast layer also is
  23. // divisible by |requested_resolution_alignment|. The configured scale factors
  24. // |scale_resolution_down_by| may be adjusted to a common multiple to limit
  25. // the alignment value to avoid largely cropped frames and possibly with an
  26. // aspect ratio far from the original.
  27. static int GetAlignmentAndMaybeAdjustScaleFactors(
  28. const VideoEncoder::EncoderInfo& info,
  29. VideoEncoderConfig* config);
  30. };
  31. } // namespace webrtc
  32. #endif // VIDEO_ALIGNMENT_ADJUSTER_H_