Add support for scalability modes L3T1_KEY, L3T2, L3T2_KEY.

Bug: webrtc:13960
Change-Id: Ib5c8309271d83a0fcfdecf7a93fdd61483c7d3e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273105
Commit-Queue: Åsa Persson <asapersson@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37927}
This commit is contained in:
Åsa Persson 2022-08-26 12:24:59 +02:00 committed by WebRTC LUCI CQ
parent c18a8fd8d1
commit 46f4de5722
9 changed files with 125 additions and 6 deletions

View File

@ -92,6 +92,13 @@ constexpr ScalableVideoController::StreamLayersConfig kConfigL3T1 = {
{1, 1, 1}, {1, 1, 1},
{4, 2, 1}}; {4, 2, 1}};
constexpr ScalableVideoController::StreamLayersConfig kConfigL3T2 = {
/*num_spatial_layers=*/3,
/*num_temporal_layers=*/2,
/*uses_reference_scaling=*/true,
{1, 1, 1},
{4, 2, 1}};
constexpr ScalableVideoController::StreamLayersConfig kConfigL3T3 = { constexpr ScalableVideoController::StreamLayersConfig kConfigL3T3 = {
/*num_spatial_layers=*/3, /*num_spatial_layers=*/3,
/*num_temporal_layers=*/3, /*num_temporal_layers=*/3,
@ -138,6 +145,11 @@ constexpr NamedStructureFactory kFactories[] = {
{ScalabilityMode::kL2T3_KEY, Create<ScalabilityStructureL2T3Key>, {ScalabilityMode::kL2T3_KEY, Create<ScalabilityStructureL2T3Key>,
kConfigL2T3}, kConfigL2T3},
{ScalabilityMode::kL3T1, Create<ScalabilityStructureL3T1>, kConfigL3T1}, {ScalabilityMode::kL3T1, Create<ScalabilityStructureL3T1>, kConfigL3T1},
{ScalabilityMode::kL3T1_KEY, Create<ScalabilityStructureL3T1Key>,
kConfigL3T1},
{ScalabilityMode::kL3T2, Create<ScalabilityStructureL3T2>, kConfigL3T2},
{ScalabilityMode::kL3T2_KEY, Create<ScalabilityStructureL3T2Key>,
kConfigL3T2},
{ScalabilityMode::kL3T3, Create<ScalabilityStructureL3T3>, kConfigL3T3}, {ScalabilityMode::kL3T3, Create<ScalabilityStructureL3T3>, kConfigL3T3},
{ScalabilityMode::kL3T3_KEY, Create<ScalabilityStructureL3T3Key>, {ScalabilityMode::kL3T3_KEY, Create<ScalabilityStructureL3T3Key>,
kConfigL3T3}, kConfigL3T3},

View File

@ -389,6 +389,29 @@ FrameDependencyStructure ScalabilityStructureL3T1::DependencyStructure() const {
return structure; return structure;
} }
FrameDependencyStructure ScalabilityStructureL3T2::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("SSSSSS").ChainDiffs({0, 0, 0});
t[4].S(1).T(0).Dtis("--SSSS").ChainDiffs({1, 1, 1}).FrameDiffs({1});
t[7].S(2).T(0).Dtis("----SS").ChainDiffs({2, 1, 1}).FrameDiffs({1});
t[2].S(0).T(1).Dtis("-D-R-R").ChainDiffs({3, 2, 1}).FrameDiffs({3});
t[5].S(1).T(1).Dtis("---D-R").ChainDiffs({4, 3, 2}).FrameDiffs({3, 1});
t[8].S(2).T(1).Dtis("-----D").ChainDiffs({5, 4, 3}).FrameDiffs({3, 1});
t[0].S(0).T(0).Dtis("SSRRRR").ChainDiffs({6, 5, 4}).FrameDiffs({6});
t[3].S(1).T(0).Dtis("--SSRR").ChainDiffs({1, 1, 1}).FrameDiffs({6, 1});
t[6].S(2).T(0).Dtis("----SS").ChainDiffs({2, 1, 1}).FrameDiffs({6, 1});
return structure;
}
FrameDependencyStructure ScalabilityStructureL3T3::DependencyStructure() const { FrameDependencyStructure ScalabilityStructureL3T3::DependencyStructure() const {
FrameDependencyStructure structure; FrameDependencyStructure structure;
structure.num_decode_targets = 9; structure.num_decode_targets = 9;

View File

@ -165,6 +165,16 @@ class ScalabilityStructureL3T1 : public ScalabilityStructureFullSvc {
FrameDependencyStructure DependencyStructure() const override; FrameDependencyStructure DependencyStructure() const override;
}; };
// https://www.w3.org/TR/webrtc-svc/#L3T2*
class ScalabilityStructureL3T2 : public ScalabilityStructureFullSvc {
public:
explicit ScalabilityStructureL3T2(ScalingFactor resolution_factor = {})
: ScalabilityStructureFullSvc(3, 2, resolution_factor) {}
~ScalabilityStructureL3T2() override = default;
FrameDependencyStructure DependencyStructure() const override;
};
// https://www.w3.org/TR/webrtc-svc/#L3T3* // https://www.w3.org/TR/webrtc-svc/#L3T3*
class ScalabilityStructureL3T3 : public ScalabilityStructureFullSvc { class ScalabilityStructureL3T3 : public ScalabilityStructureFullSvc {
public: public:

View File

@ -343,6 +343,55 @@ FrameDependencyStructure ScalabilityStructureL2T3Key::DependencyStructure()
return structure; return structure;
} }
ScalabilityStructureL3T1Key::~ScalabilityStructureL3T1Key() = default;
FrameDependencyStructure ScalabilityStructureL3T1Key::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);
// 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).Dtis("SSS").ChainDiffs({0, 0, 0});
t[3].S(1).Dtis("-SS").ChainDiffs({1, 1, 1}).FrameDiffs({1});
t[5].S(2).Dtis("--S").ChainDiffs({2, 1, 1}).FrameDiffs({1});
t[0].S(0).Dtis("S--").ChainDiffs({3, 2, 1}).FrameDiffs({3});
t[2].S(1).Dtis("-S-").ChainDiffs({1, 3, 2}).FrameDiffs({3});
t[4].S(2).Dtis("--S").ChainDiffs({2, 1, 3}).FrameDiffs({3});
return structure;
}
ScalabilityStructureL3T2Key::~ScalabilityStructureL3T2Key() = default;
FrameDependencyStructure ScalabilityStructureL3T2Key::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("SSSSSS").ChainDiffs({0, 0, 0});
t[4].S(1).T(0).Dtis("--SSSS").ChainDiffs({1, 1, 1}).FrameDiffs({1});
t[7].S(2).T(0).Dtis("----SS").ChainDiffs({2, 1, 1}).FrameDiffs({1});
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;
}
ScalabilityStructureL3T3Key::~ScalabilityStructureL3T3Key() = default; ScalabilityStructureL3T3Key::~ScalabilityStructureL3T3Key() = default;
FrameDependencyStructure ScalabilityStructureL3T3Key::DependencyStructure() FrameDependencyStructure ScalabilityStructureL3T3Key::DependencyStructure()

View File

@ -109,6 +109,22 @@ class ScalabilityStructureL2T3Key : public ScalabilityStructureKeySvc {
FrameDependencyStructure DependencyStructure() const override; FrameDependencyStructure DependencyStructure() const override;
}; };
class ScalabilityStructureL3T1Key : public ScalabilityStructureKeySvc {
public:
ScalabilityStructureL3T1Key() : ScalabilityStructureKeySvc(3, 1) {}
~ScalabilityStructureL3T1Key() override;
FrameDependencyStructure DependencyStructure() const override;
};
class ScalabilityStructureL3T2Key : public ScalabilityStructureKeySvc {
public:
ScalabilityStructureL3T2Key() : ScalabilityStructureKeySvc(3, 2) {}
~ScalabilityStructureL3T2Key() override;
FrameDependencyStructure DependencyStructure() const override;
};
class ScalabilityStructureL3T3Key : public ScalabilityStructureKeySvc { class ScalabilityStructureL3T3Key : public ScalabilityStructureKeySvc {
public: public:
ScalabilityStructureL3T3Key() : ScalabilityStructureKeySvc(3, 3) {} ScalabilityStructureL3T3Key() : ScalabilityStructureKeySvc(3, 3) {}

View File

@ -371,6 +371,7 @@ INSTANTIATE_TEST_SUITE_P(
SvcTestParam{"L2T1", /*num_temporal_units=*/3}, SvcTestParam{"L2T1", /*num_temporal_units=*/3},
SvcTestParam{"L2T1_KEY", /*num_temporal_units=*/3}, SvcTestParam{"L2T1_KEY", /*num_temporal_units=*/3},
SvcTestParam{"L3T1", /*num_temporal_units=*/3}, SvcTestParam{"L3T1", /*num_temporal_units=*/3},
SvcTestParam{"L3T1_KEY", /*num_temporal_units=*/3},
SvcTestParam{"L3T3", /*num_temporal_units=*/8}, SvcTestParam{"L3T3", /*num_temporal_units=*/8},
SvcTestParam{"S2T1", /*num_temporal_units=*/3}, SvcTestParam{"S2T1", /*num_temporal_units=*/3},
SvcTestParam{"S2T3", /*num_temporal_units=*/8}, SvcTestParam{"S2T3", /*num_temporal_units=*/8},
@ -380,6 +381,8 @@ INSTANTIATE_TEST_SUITE_P(
SvcTestParam{"L2T2_KEY_SHIFT", /*num_temporal_units=*/4}, SvcTestParam{"L2T2_KEY_SHIFT", /*num_temporal_units=*/4},
SvcTestParam{"L2T3", /*num_temporal_units=*/8}, SvcTestParam{"L2T3", /*num_temporal_units=*/8},
SvcTestParam{"L2T3_KEY", /*num_temporal_units=*/8}, SvcTestParam{"L2T3_KEY", /*num_temporal_units=*/8},
SvcTestParam{"L3T2", /*num_temporal_units=*/4},
SvcTestParam{"L3T2_KEY", /*num_temporal_units=*/4},
SvcTestParam{"L3T3_KEY", /*num_temporal_units=*/8}), SvcTestParam{"L3T3_KEY", /*num_temporal_units=*/8}),
[](const testing::TestParamInfo<SvcTestParam>& info) { [](const testing::TestParamInfo<SvcTestParam>& info) {
return info.param.name; return info.param.name;

View File

@ -211,6 +211,9 @@ class PeerConnectionFactoryTest : public ::testing::Test {
webrtc::ScalabilityMode::kL2T3, webrtc::ScalabilityMode::kL2T3,
webrtc::ScalabilityMode::kL2T3_KEY, webrtc::ScalabilityMode::kL2T3_KEY,
webrtc::ScalabilityMode::kL3T1, webrtc::ScalabilityMode::kL3T1,
webrtc::ScalabilityMode::kL3T1_KEY,
webrtc::ScalabilityMode::kL3T2,
webrtc::ScalabilityMode::kL3T2_KEY,
webrtc::ScalabilityMode::kL3T3, webrtc::ScalabilityMode::kL3T3,
webrtc::ScalabilityMode::kL3T3_KEY, webrtc::ScalabilityMode::kL3T3_KEY,
webrtc::ScalabilityMode::kS2T1, webrtc::ScalabilityMode::kS2T1,

View File

@ -337,10 +337,10 @@ INSTANTIATE_TEST_SUITE_P(
// SvcTestParameters{kVp9CodecName, "L2T3_KEY_SHIFT", 2, 3}, // SvcTestParameters{kVp9CodecName, "L2T3_KEY_SHIFT", 2, 3},
SvcTestParameters{kVp9CodecName, "L3T1", 3, 1}, SvcTestParameters{kVp9CodecName, "L3T1", 3, 1},
// SvcTestParameters{kVp9CodecName, "L3T1h", 3, 1}, // SvcTestParameters{kVp9CodecName, "L3T1h", 3, 1},
// SvcTestParameters{kVp9CodecName, "L3T1_KEY", 3, 1}, SvcTestParameters{kVp9CodecName, "L3T1_KEY", 3, 1},
// SvcTestParameters{kVp9CodecName, "L3T2", 3, 2}, SvcTestParameters{kVp9CodecName, "L3T2", 3, 2},
// SvcTestParameters{kVp9CodecName, "L3T2h", 3, 2}, // SvcTestParameters{kVp9CodecName, "L3T2h", 3, 2},
// SvcTestParameters{kVp9CodecName, "L3T2_KEY", 3, 2}, SvcTestParameters{kVp9CodecName, "L3T2_KEY", 3, 2},
// SvcTestParameters{kVp9CodecName, "L3T2_KEY_SHIFT", 3, 2}, // SvcTestParameters{kVp9CodecName, "L3T2_KEY_SHIFT", 3, 2},
SvcTestParameters{kVp9CodecName, "L3T3", 3, 3}, SvcTestParameters{kVp9CodecName, "L3T3", 3, 3},
// SvcTestParameters{kVp9CodecName, "L3T3h", 3, 3}, // SvcTestParameters{kVp9CodecName, "L3T3h", 3, 3},
@ -385,10 +385,10 @@ INSTANTIATE_TEST_SUITE_P(
// SvcTestParameters{kAv1CodecName, "L2T3_KEY_SHIFT", 2, 3}, // SvcTestParameters{kAv1CodecName, "L2T3_KEY_SHIFT", 2, 3},
SvcTestParameters{kAv1CodecName, "L3T1", 3, 1}, SvcTestParameters{kAv1CodecName, "L3T1", 3, 1},
// SvcTestParameters{kAv1CodecName, "L3T1h", 3, 1}, // SvcTestParameters{kAv1CodecName, "L3T1h", 3, 1},
// SvcTestParameters{kAv1CodecName, "L3T1_KEY", 3, 1}, SvcTestParameters{kAv1CodecName, "L3T1_KEY", 3, 1},
// SvcTestParameters{kAv1CodecName, "L3T2", 3, 2}, SvcTestParameters{kAv1CodecName, "L3T2", 3, 2},
// SvcTestParameters{kAv1CodecName, "L3T2h", 3, 2}, // SvcTestParameters{kAv1CodecName, "L3T2h", 3, 2},
// SvcTestParameters{kAv1CodecName, "L3T2_KEY", 3, 2}, SvcTestParameters{kAv1CodecName, "L3T2_KEY", 3, 2},
// SvcTestParameters{kAv1CodecName, "L3T2_KEY_SHIFT", 3, 2}, // SvcTestParameters{kAv1CodecName, "L3T2_KEY_SHIFT", 3, 2},
SvcTestParameters{kAv1CodecName, "L3T3", 3, 3}, SvcTestParameters{kAv1CodecName, "L3T3", 3, 3},
// SvcTestParameters{kAv1CodecName, "L3T3h", 3, 3}, // SvcTestParameters{kAv1CodecName, "L3T3h", 3, 3},

View File

@ -3367,6 +3367,9 @@ INSTANTIATE_TEST_SUITE_P(
{"L2T3", 2, 3, InterLayerPredMode::kOn}, {"L2T3", 2, 3, InterLayerPredMode::kOn},
{"L2T3_KEY", 2, 3, InterLayerPredMode::kOnKeyPic}, {"L2T3_KEY", 2, 3, InterLayerPredMode::kOnKeyPic},
{"L3T1", 3, 1, InterLayerPredMode::kOn}, {"L3T1", 3, 1, InterLayerPredMode::kOn},
{"L3T1_KEY", 3, 1, InterLayerPredMode::kOnKeyPic},
{"L3T2", 3, 2, InterLayerPredMode::kOn},
{"L3T2_KEY", 3, 2, InterLayerPredMode::kOnKeyPic},
{"L3T3", 3, 3, InterLayerPredMode::kOn}, {"L3T3", 3, 3, InterLayerPredMode::kOn},
{"L3T3_KEY", 3, 3, InterLayerPredMode::kOnKeyPic}, {"L3T3_KEY", 3, 3, InterLayerPredMode::kOnKeyPic},
{"S2T1", 2, 1, InterLayerPredMode::kOff}, {"S2T1", 2, 1, InterLayerPredMode::kOff},