1 /* 2 * Copyright (c) 2022 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 11 #ifndef MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_ 12 #define MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_ 13 14 #include "absl/strings/string_view.h" 15 #include "absl/types/optional.h" 16 #include "api/video_codecs/scalability_mode.h" 17 #include "api/video_codecs/video_codec.h" 18 19 namespace webrtc { 20 21 enum class ScalabilityModeResolutionRatio { 22 kTwoToOne, // The resolution ratio between spatial layers is 2:1. 23 kThreeToTwo, // The resolution ratio between spatial layers is 1.5:1. 24 }; 25 26 absl::optional<ScalabilityMode> ScalabilityModeFromString( 27 absl::string_view scalability_mode_string); 28 29 InterLayerPredMode ScalabilityModeToInterLayerPredMode( 30 ScalabilityMode scalability_mode); 31 32 int ScalabilityModeToNumSpatialLayers(ScalabilityMode scalability_mode); 33 34 int ScalabilityModeToNumTemporalLayers(ScalabilityMode scalability_mode); 35 36 absl::optional<ScalabilityModeResolutionRatio> ScalabilityModeToResolutionRatio( 37 ScalabilityMode scalability_mode); 38 39 ScalabilityMode LimitNumSpatialLayers(ScalabilityMode scalability_mode, 40 int max_spatial_layers); 41 42 } // namespace webrtc 43 44 #endif // MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_ 45