2022-04-29 11:03:13 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_
|
|
|
|
|
#define MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_
|
|
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
#include <optional>
|
|
|
|
|
|
2022-04-29 11:03:13 +02:00
|
|
|
#include "absl/strings/string_view.h"
|
|
|
|
|
#include "api/video_codecs/scalability_mode.h"
|
2022-05-16 22:37:34 +02:00
|
|
|
#include "api/video_codecs/video_codec.h"
|
2022-04-29 11:03:13 +02:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2022-08-30 19:07:17 +09:00
|
|
|
enum class ScalabilityModeResolutionRatio {
|
|
|
|
|
kTwoToOne, // The resolution ratio between spatial layers is 2:1.
|
|
|
|
|
kThreeToTwo, // The resolution ratio between spatial layers is 1.5:1.
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-11 15:50:58 +01:00
|
|
|
static constexpr char kDefaultScalabilityModeStr[] = "L1T2";
|
|
|
|
|
|
2024-11-14 20:51:07 +08:00
|
|
|
// Scalability mode to be used if falling back to default scalability mode is
|
|
|
|
|
// unsupported.
|
|
|
|
|
static constexpr char kNoLayeringScalabilityModeStr[] = "L1T1";
|
|
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
RTC_EXPORT std::optional<ScalabilityMode> MakeScalabilityMode(
|
2024-04-05 11:15:10 +00:00
|
|
|
int num_spatial_layers,
|
|
|
|
|
int num_temporal_layers,
|
|
|
|
|
InterLayerPredMode inter_layer_pred,
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<ScalabilityModeResolutionRatio> ratio,
|
2024-04-05 11:15:10 +00:00
|
|
|
bool shift);
|
|
|
|
|
|
2024-10-25 17:18:28 +08:00
|
|
|
RTC_EXPORT std::optional<ScalabilityMode> ScalabilityModeFromString(
|
2022-04-29 11:03:13 +02:00
|
|
|
absl::string_view scalability_mode_string);
|
|
|
|
|
|
2022-05-16 22:37:34 +02:00
|
|
|
InterLayerPredMode ScalabilityModeToInterLayerPredMode(
|
|
|
|
|
ScalabilityMode scalability_mode);
|
|
|
|
|
|
2022-05-13 16:24:22 +02:00
|
|
|
int ScalabilityModeToNumSpatialLayers(ScalabilityMode scalability_mode);
|
|
|
|
|
|
2022-05-13 13:34:37 +02:00
|
|
|
int ScalabilityModeToNumTemporalLayers(ScalabilityMode scalability_mode);
|
|
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<ScalabilityModeResolutionRatio> ScalabilityModeToResolutionRatio(
|
2022-08-30 19:07:17 +09:00
|
|
|
ScalabilityMode scalability_mode);
|
|
|
|
|
|
2024-04-05 11:15:10 +00:00
|
|
|
bool ScalabilityModeIsShiftMode(ScalabilityMode scalability_mode);
|
|
|
|
|
|
2022-10-21 10:59:19 +02:00
|
|
|
ScalabilityMode LimitNumSpatialLayers(ScalabilityMode scalability_mode,
|
|
|
|
|
int max_spatial_layers);
|
|
|
|
|
|
2022-04-29 11:03:13 +02:00
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
#endif // MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_
|