mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Add support for scalability modes S2T2, S3T1, S3T2.
Bug: webrtc:13960 Change-Id: Icafd3a5a3f8889777d65da5313b24e56a57af4d9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273301 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Florent Castelli <orphis@webrtc.org> Commit-Queue: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37943}
This commit is contained in:
parent
11093b2ca3
commit
6d0516412e
9 changed files with 140 additions and 0 deletions
|
@ -66,8 +66,14 @@ absl::string_view ScalabilityModeToString(ScalabilityMode scalability_mode) {
|
|||
return "L3T3_KEY";
|
||||
case ScalabilityMode::kS2T1:
|
||||
return "S2T1";
|
||||
case ScalabilityMode::kS2T2:
|
||||
return "S2T2";
|
||||
case ScalabilityMode::kS2T3:
|
||||
return "S2T3";
|
||||
case ScalabilityMode::kS3T1:
|
||||
return "S3T1";
|
||||
case ScalabilityMode::kS3T2:
|
||||
return "S3T2";
|
||||
case ScalabilityMode::kS3T3:
|
||||
return "S3T3";
|
||||
}
|
||||
|
|
|
@ -50,7 +50,10 @@ enum class ScalabilityMode : uint8_t {
|
|||
kL3T3h,
|
||||
kL3T3_KEY,
|
||||
kS2T1,
|
||||
kS2T2,
|
||||
kS2T3,
|
||||
kS3T1,
|
||||
kS3T2,
|
||||
kS3T3,
|
||||
};
|
||||
|
||||
|
@ -81,7 +84,10 @@ inline constexpr ScalabilityMode kAllScalabilityModes[] = {
|
|||
ScalabilityMode::kL3T3h,
|
||||
ScalabilityMode::kL3T3_KEY,
|
||||
ScalabilityMode::kS2T1,
|
||||
ScalabilityMode::kS2T2,
|
||||
ScalabilityMode::kS2T3,
|
||||
ScalabilityMode::kS3T1,
|
||||
ScalabilityMode::kS3T2,
|
||||
ScalabilityMode::kS3T3,
|
||||
// clang-format on
|
||||
};
|
||||
|
|
|
@ -113,6 +113,13 @@ constexpr ScalableVideoController::StreamLayersConfig kConfigS2T1 = {
|
|||
{1, 1},
|
||||
{2, 1}};
|
||||
|
||||
constexpr ScalableVideoController::StreamLayersConfig kConfigS2T2 = {
|
||||
/*num_spatial_layers=*/2,
|
||||
/*num_temporal_layers=*/2,
|
||||
/*uses_reference_scaling=*/false,
|
||||
{1, 1},
|
||||
{2, 1}};
|
||||
|
||||
constexpr ScalableVideoController::StreamLayersConfig kConfigS2T3 = {
|
||||
/*num_spatial_layers=*/2,
|
||||
/*num_temporal_layers=*/3,
|
||||
|
@ -120,6 +127,20 @@ constexpr ScalableVideoController::StreamLayersConfig kConfigS2T3 = {
|
|||
{1, 1},
|
||||
{2, 1}};
|
||||
|
||||
constexpr ScalableVideoController::StreamLayersConfig kConfigS3T1 = {
|
||||
/*num_spatial_layers=*/3,
|
||||
/*num_temporal_layers=*/1,
|
||||
/*uses_reference_scaling=*/false,
|
||||
{1, 1, 1},
|
||||
{4, 2, 1}};
|
||||
|
||||
constexpr ScalableVideoController::StreamLayersConfig kConfigS3T2 = {
|
||||
/*num_spatial_layers=*/3,
|
||||
/*num_temporal_layers=*/2,
|
||||
/*uses_reference_scaling=*/false,
|
||||
{1, 1, 1},
|
||||
{4, 2, 1}};
|
||||
|
||||
constexpr ScalableVideoController::StreamLayersConfig kConfigS3T3 = {
|
||||
/*num_spatial_layers=*/3,
|
||||
/*num_temporal_layers=*/3,
|
||||
|
@ -154,7 +175,10 @@ constexpr NamedStructureFactory kFactories[] = {
|
|||
{ScalabilityMode::kL3T3_KEY, Create<ScalabilityStructureL3T3Key>,
|
||||
kConfigL3T3},
|
||||
{ScalabilityMode::kS2T1, Create<ScalabilityStructureS2T1>, kConfigS2T1},
|
||||
{ScalabilityMode::kS2T2, Create<ScalabilityStructureS2T2>, kConfigS2T2},
|
||||
{ScalabilityMode::kS2T3, Create<ScalabilityStructureS2T3>, kConfigS2T3},
|
||||
{ScalabilityMode::kS3T1, Create<ScalabilityStructureS3T1>, kConfigS3T1},
|
||||
{ScalabilityMode::kS3T2, Create<ScalabilityStructureS3T2>, kConfigS3T2},
|
||||
{ScalabilityMode::kS3T3, Create<ScalabilityStructureS3T3>, kConfigS3T3},
|
||||
};
|
||||
|
||||
|
|
|
@ -75,8 +75,14 @@ absl::optional<ScalabilityMode> ScalabilityModeFromString(
|
|||
|
||||
if (mode_string == "S2T1")
|
||||
return ScalabilityMode::kS2T1;
|
||||
if (mode_string == "S2T2")
|
||||
return ScalabilityMode::kS2T2;
|
||||
if (mode_string == "S2T3")
|
||||
return ScalabilityMode::kS2T3;
|
||||
if (mode_string == "S3T1")
|
||||
return ScalabilityMode::kS3T1;
|
||||
if (mode_string == "S3T2")
|
||||
return ScalabilityMode::kS3T2;
|
||||
if (mode_string == "S3T3")
|
||||
return ScalabilityMode::kS3T3;
|
||||
|
||||
|
@ -123,7 +129,10 @@ InterLayerPredMode ScalabilityModeToInterLayerPredMode(
|
|||
case ScalabilityMode::kL3T3_KEY:
|
||||
return InterLayerPredMode::kOnKeyPic;
|
||||
case ScalabilityMode::kS2T1:
|
||||
case ScalabilityMode::kS2T2:
|
||||
case ScalabilityMode::kS2T3:
|
||||
case ScalabilityMode::kS3T1:
|
||||
case ScalabilityMode::kS3T2:
|
||||
case ScalabilityMode::kS3T3:
|
||||
return InterLayerPredMode::kOff;
|
||||
}
|
||||
|
@ -160,8 +169,11 @@ int ScalabilityModeToNumSpatialLayers(ScalabilityMode scalability_mode) {
|
|||
case ScalabilityMode::kL3T3_KEY:
|
||||
return 3;
|
||||
case ScalabilityMode::kS2T1:
|
||||
case ScalabilityMode::kS2T2:
|
||||
case ScalabilityMode::kS2T3:
|
||||
return 2;
|
||||
case ScalabilityMode::kS3T1:
|
||||
case ScalabilityMode::kS3T2:
|
||||
case ScalabilityMode::kS3T3:
|
||||
return 3;
|
||||
}
|
||||
|
@ -204,7 +216,11 @@ int ScalabilityModeToNumTemporalLayers(ScalabilityMode scalability_mode) {
|
|||
case ScalabilityMode::kL3T3_KEY:
|
||||
return 3;
|
||||
case ScalabilityMode::kS2T1:
|
||||
case ScalabilityMode::kS3T1:
|
||||
return 1;
|
||||
case ScalabilityMode::kS2T2:
|
||||
case ScalabilityMode::kS3T2:
|
||||
return 2;
|
||||
case ScalabilityMode::kS2T3:
|
||||
case ScalabilityMode::kS3T3:
|
||||
return 3;
|
||||
|
|
|
@ -242,6 +242,22 @@ FrameDependencyStructure ScalabilityStructureS2T1::DependencyStructure() const {
|
|||
return structure;
|
||||
}
|
||||
|
||||
FrameDependencyStructure ScalabilityStructureS2T2::DependencyStructure() const {
|
||||
FrameDependencyStructure structure;
|
||||
structure.num_decode_targets = 4;
|
||||
structure.num_chains = 2;
|
||||
structure.decode_target_protected_by_chain = {0, 0, 1, 1};
|
||||
auto& t = structure.templates;
|
||||
t.resize(6);
|
||||
t[1].S(0).T(0).Dtis("SS--").ChainDiffs({0, 0});
|
||||
t[4].S(1).T(0).Dtis("--SS").ChainDiffs({1, 0});
|
||||
t[2].S(0).T(1).Dtis("-D--").ChainDiffs({2, 1}).FrameDiffs({2});
|
||||
t[5].S(1).T(1).Dtis("---D").ChainDiffs({3, 2}).FrameDiffs({2});
|
||||
t[0].S(0).T(0).Dtis("SS--").ChainDiffs({4, 3}).FrameDiffs({4});
|
||||
t[3].S(1).T(0).Dtis("--SS").ChainDiffs({1, 4}).FrameDiffs({4});
|
||||
return structure;
|
||||
}
|
||||
|
||||
FrameDependencyStructure ScalabilityStructureS2T3::DependencyStructure() const {
|
||||
FrameDependencyStructure structure;
|
||||
structure.num_decode_targets = 6;
|
||||
|
@ -262,6 +278,45 @@ FrameDependencyStructure ScalabilityStructureS2T3::DependencyStructure() const {
|
|||
return structure;
|
||||
}
|
||||
|
||||
FrameDependencyStructure ScalabilityStructureS3T1::DependencyStructure() const {
|
||||
FrameDependencyStructure structure;
|
||||
structure.num_decode_targets = 3;
|
||||
structure.num_chains = 3;
|
||||
structure.decode_target_protected_by_chain = {0, 1, 2};
|
||||
auto& t = structure.templates;
|
||||
t.resize(6);
|
||||
t[1].S(0).T(0).Dtis("S--").ChainDiffs({0, 0, 0});
|
||||
t[3].S(1).T(0).Dtis("-S-").ChainDiffs({1, 0, 0});
|
||||
t[5].S(2).T(0).Dtis("--S").ChainDiffs({2, 1, 0});
|
||||
t[0].S(0).T(0).Dtis("S--").ChainDiffs({3, 2, 1}).FrameDiffs({3});
|
||||
t[2].S(1).T(0).Dtis("-S-").ChainDiffs({1, 3, 2}).FrameDiffs({3});
|
||||
t[4].S(2).T(0).Dtis("--S").ChainDiffs({2, 1, 3}).FrameDiffs({3});
|
||||
return structure;
|
||||
}
|
||||
|
||||
FrameDependencyStructure ScalabilityStructureS3T2::DependencyStructure() const {
|
||||
FrameDependencyStructure structure;
|
||||
structure.num_decode_targets = 6;
|
||||
structure.num_chains = 3;
|
||||
structure.decode_target_protected_by_chain = {0, 0, 1, 1, 2, 2};
|
||||
auto& t = structure.templates;
|
||||
t.resize(9);
|
||||
// Templates are shown in the order frames following them appear in the
|
||||
// stream, but in `structure.templates` array templates are sorted by
|
||||
// (`spatial_id`, `temporal_id`) since that is a dependency descriptor
|
||||
// requirement.
|
||||
t[1].S(0).T(0).Dtis("SS----").ChainDiffs({0, 0, 0});
|
||||
t[4].S(1).T(0).Dtis("--SS--").ChainDiffs({1, 0, 0});
|
||||
t[7].S(2).T(0).Dtis("----SS").ChainDiffs({2, 1, 0});
|
||||
t[2].S(0).T(1).Dtis("-D----").ChainDiffs({3, 2, 1}).FrameDiffs({3});
|
||||
t[5].S(1).T(1).Dtis("---D--").ChainDiffs({4, 3, 2}).FrameDiffs({3});
|
||||
t[8].S(2).T(1).Dtis("-----D").ChainDiffs({5, 4, 3}).FrameDiffs({3});
|
||||
t[0].S(0).T(0).Dtis("SS----").ChainDiffs({6, 5, 4}).FrameDiffs({6});
|
||||
t[3].S(1).T(0).Dtis("--SS--").ChainDiffs({1, 6, 5}).FrameDiffs({6});
|
||||
t[6].S(2).T(0).Dtis("----SS").ChainDiffs({2, 1, 6}).FrameDiffs({6});
|
||||
return structure;
|
||||
}
|
||||
|
||||
FrameDependencyStructure ScalabilityStructureS3T3::DependencyStructure() const {
|
||||
FrameDependencyStructure structure;
|
||||
structure.num_decode_targets = 9;
|
||||
|
|
|
@ -76,6 +76,14 @@ class ScalabilityStructureS2T1 : public ScalabilityStructureSimulcast {
|
|||
FrameDependencyStructure DependencyStructure() const override;
|
||||
};
|
||||
|
||||
class ScalabilityStructureS2T2 : public ScalabilityStructureSimulcast {
|
||||
public:
|
||||
ScalabilityStructureS2T2() : ScalabilityStructureSimulcast(2, 2) {}
|
||||
~ScalabilityStructureS2T2() override = default;
|
||||
|
||||
FrameDependencyStructure DependencyStructure() const override;
|
||||
};
|
||||
|
||||
// S1T2 3 7
|
||||
// | /
|
||||
// S1T1 / 5
|
||||
|
@ -96,6 +104,22 @@ class ScalabilityStructureS2T3 : public ScalabilityStructureSimulcast {
|
|||
FrameDependencyStructure DependencyStructure() const override;
|
||||
};
|
||||
|
||||
class ScalabilityStructureS3T1 : public ScalabilityStructureSimulcast {
|
||||
public:
|
||||
ScalabilityStructureS3T1() : ScalabilityStructureSimulcast(3, 1) {}
|
||||
~ScalabilityStructureS3T1() override = default;
|
||||
|
||||
FrameDependencyStructure DependencyStructure() const override;
|
||||
};
|
||||
|
||||
class ScalabilityStructureS3T2 : public ScalabilityStructureSimulcast {
|
||||
public:
|
||||
ScalabilityStructureS3T2() : ScalabilityStructureSimulcast(3, 2) {}
|
||||
~ScalabilityStructureS3T2() override = default;
|
||||
|
||||
FrameDependencyStructure DependencyStructure() const override;
|
||||
};
|
||||
|
||||
class ScalabilityStructureS3T3 : public ScalabilityStructureSimulcast {
|
||||
public:
|
||||
ScalabilityStructureS3T3() : ScalabilityStructureSimulcast(3, 3) {}
|
||||
|
|
|
@ -374,7 +374,10 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
SvcTestParam{"L3T1_KEY", /*num_temporal_units=*/3},
|
||||
SvcTestParam{"L3T3", /*num_temporal_units=*/8},
|
||||
SvcTestParam{"S2T1", /*num_temporal_units=*/3},
|
||||
SvcTestParam{"S2T2", /*num_temporal_units=*/4},
|
||||
SvcTestParam{"S2T3", /*num_temporal_units=*/8},
|
||||
SvcTestParam{"S3T1", /*num_temporal_units=*/3},
|
||||
SvcTestParam{"S3T2", /*num_temporal_units=*/4},
|
||||
SvcTestParam{"S3T3", /*num_temporal_units=*/8},
|
||||
SvcTestParam{"L2T2", /*num_temporal_units=*/4},
|
||||
SvcTestParam{"L2T2_KEY", /*num_temporal_units=*/4},
|
||||
|
|
|
@ -217,7 +217,10 @@ class PeerConnectionFactoryTest : public ::testing::Test {
|
|||
webrtc::ScalabilityMode::kL3T3,
|
||||
webrtc::ScalabilityMode::kL3T3_KEY,
|
||||
webrtc::ScalabilityMode::kS2T1,
|
||||
webrtc::ScalabilityMode::kS2T2,
|
||||
webrtc::ScalabilityMode::kS2T3,
|
||||
webrtc::ScalabilityMode::kS3T1,
|
||||
webrtc::ScalabilityMode::kS3T2,
|
||||
webrtc::ScalabilityMode::kS3T3)
|
||||
// clang-format on
|
||||
)
|
||||
|
|
|
@ -3373,7 +3373,10 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
{"L3T3", 3, 3, InterLayerPredMode::kOn},
|
||||
{"L3T3_KEY", 3, 3, InterLayerPredMode::kOnKeyPic},
|
||||
{"S2T1", 2, 1, InterLayerPredMode::kOff},
|
||||
{"S2T2", 2, 2, InterLayerPredMode::kOff},
|
||||
{"S2T3", 2, 3, InterLayerPredMode::kOff},
|
||||
{"S3T1", 3, 1, InterLayerPredMode::kOff},
|
||||
{"S3T2", 3, 2, InterLayerPredMode::kOff},
|
||||
{"S3T3", 3, 3, InterLayerPredMode::kOff}}),
|
||||
::testing::Values(false, true)), // use_scalability_mode_identifier
|
||||
ParamInfoToStr);
|
||||
|
|
Loading…
Reference in a new issue