| 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 |
| 11 | #ifndef VIDEO_ALIGNMENT_ADJUSTER_H_ |
| 12 | #define VIDEO_ALIGNMENT_ADJUSTER_H_ |
| 13 |
| 14 | #include "api/video_codecs/video_encoder.h" |
| 15 | #include "video/config/video_encoder_config.h" |
| 16 |
| 17 | namespace webrtc { |
| 18 |
| 19 | class AlignmentAdjuster { |
| 20 | public: |
| 21 | // Returns the resolution alignment requested by the encoder (i.e |
| 22 | // `EncoderInfo::requested_resolution_alignment` which ensures that delivered |
| 23 | // frames to the encoder are divisible by this alignment). |
| 24 | // |
| 25 | // If `EncoderInfo::apply_alignment_to_all_simulcast_layers` is enabled, the |
| 26 | // alignment will be adjusted to ensure that each simulcast layer also is |
| 27 | // divisible by `requested_resolution_alignment`. The configured scale factors |
| 28 | // `scale_resolution_down_by` may be adjusted to a common multiple to limit |
| 29 | // the alignment value to avoid largely cropped frames and possibly with an |
| 30 | // aspect ratio far from the original. |
| 31 |
| 32 | // Note: `max_layers` currently only taken into account when using default |
| 33 | // scale factors. |
| 34 | static int GetAlignmentAndMaybeAdjustScaleFactors( |
| 35 | const VideoEncoder::EncoderInfo& info, |
| 36 | VideoEncoderConfig* config, |
| 37 | absl::optional<size_t> max_layers); |
| 38 | }; |
| 39 |
| 40 | } // namespace webrtc |
| 41 |
| 42 | #endif // VIDEO_ALIGNMENT_ADJUSTER_H_ |
| 43 |