Embed FrameDependencyTemplate builder helpers directly into the struct
Bug: None Change-Id: I4c13bdabd08dd6a6011cb534c765c1dd09f218d1 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176843 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31500}
This commit is contained in:
committed by
Commit Bot
parent
f4a9991cce
commit
24263f4ffb
@ -608,58 +608,52 @@ FrameDependencyStructure DefaultTemporalLayers::GetTemplateStructure(
|
||||
FrameDependencyStructure template_structure;
|
||||
template_structure.num_decode_targets = num_layers;
|
||||
|
||||
using Builder = GenericFrameInfo::Builder;
|
||||
switch (num_layers) {
|
||||
case 1: {
|
||||
template_structure.templates = {
|
||||
Builder().T(0).Dtis("S").Build(),
|
||||
Builder().T(0).Dtis("S").Fdiffs({1}).Build(),
|
||||
};
|
||||
template_structure.templates.resize(2);
|
||||
template_structure.templates[0].T(0).Dtis("S");
|
||||
template_structure.templates[1].T(0).Dtis("S").FrameDiffs({1});
|
||||
return template_structure;
|
||||
}
|
||||
case 2: {
|
||||
template_structure.templates = {
|
||||
Builder().T(0).Dtis("SS").Build(),
|
||||
Builder().T(0).Dtis("SS").Fdiffs({2}).Build(),
|
||||
Builder().T(0).Dtis("SR").Fdiffs({2}).Build(),
|
||||
Builder().T(1).Dtis("-S").Fdiffs({1}).Build(),
|
||||
Builder().T(1).Dtis("-D").Fdiffs({1, 2}).Build(),
|
||||
};
|
||||
template_structure.templates.resize(5);
|
||||
template_structure.templates[0].T(0).Dtis("SS");
|
||||
template_structure.templates[1].T(0).Dtis("SS").FrameDiffs({2});
|
||||
template_structure.templates[2].T(0).Dtis("SR").FrameDiffs({2});
|
||||
template_structure.templates[3].T(1).Dtis("-S").FrameDiffs({1});
|
||||
template_structure.templates[4].T(1).Dtis("-D").FrameDiffs({2, 1});
|
||||
return template_structure;
|
||||
}
|
||||
case 3: {
|
||||
if (field_trial::IsEnabled("WebRTC-UseShortVP8TL3Pattern")) {
|
||||
template_structure.templates = {
|
||||
Builder().T(0).Dtis("SSS").Build(),
|
||||
Builder().T(0).Dtis("SSS").Fdiffs({4}).Build(),
|
||||
Builder().T(1).Dtis("-DR").Fdiffs({2}).Build(),
|
||||
Builder().T(2).Dtis("--S").Fdiffs({1}).Build(),
|
||||
Builder().T(2).Dtis("--D").Fdiffs({1, 2}).Build(),
|
||||
};
|
||||
template_structure.templates.resize(5);
|
||||
template_structure.templates[0].T(0).Dtis("SSS");
|
||||
template_structure.templates[1].T(0).Dtis("SSS").FrameDiffs({4});
|
||||
template_structure.templates[2].T(1).Dtis("-DR").FrameDiffs({2});
|
||||
template_structure.templates[3].T(2).Dtis("--S").FrameDiffs({1});
|
||||
template_structure.templates[4].T(2).Dtis("--D").FrameDiffs({2, 1});
|
||||
} else {
|
||||
template_structure.templates = {
|
||||
Builder().T(0).Dtis("SSS").Build(),
|
||||
Builder().T(0).Dtis("SSS").Fdiffs({4}).Build(),
|
||||
Builder().T(0).Dtis("SRR").Fdiffs({4}).Build(),
|
||||
Builder().T(1).Dtis("-SS").Fdiffs({2}).Build(),
|
||||
Builder().T(1).Dtis("-DS").Fdiffs({2, 4}).Build(),
|
||||
Builder().T(2).Dtis("--D").Fdiffs({1}).Build(),
|
||||
Builder().T(2).Dtis("--D").Fdiffs({1, 3}).Build(),
|
||||
};
|
||||
template_structure.templates.resize(7);
|
||||
template_structure.templates[0].T(0).Dtis("SSS");
|
||||
template_structure.templates[1].T(0).Dtis("SSS").FrameDiffs({4});
|
||||
template_structure.templates[2].T(0).Dtis("SRR").FrameDiffs({4});
|
||||
template_structure.templates[3].T(1).Dtis("-SS").FrameDiffs({2});
|
||||
template_structure.templates[4].T(1).Dtis("-DS").FrameDiffs({4, 2});
|
||||
template_structure.templates[5].T(2).Dtis("--D").FrameDiffs({1});
|
||||
template_structure.templates[6].T(2).Dtis("--D").FrameDiffs({3, 1});
|
||||
}
|
||||
return template_structure;
|
||||
}
|
||||
case 4: {
|
||||
template_structure.templates = {
|
||||
Builder().T(0).Dtis("SSSS").Build(),
|
||||
Builder().T(0).Dtis("SSSS").Fdiffs({8}).Build(),
|
||||
Builder().T(1).Dtis("-SRR").Fdiffs({4}).Build(),
|
||||
Builder().T(1).Dtis("-SRR").Fdiffs({4, 8}).Build(),
|
||||
Builder().T(2).Dtis("--SR").Fdiffs({2}).Build(),
|
||||
Builder().T(2).Dtis("--SR").Fdiffs({2, 4}).Build(),
|
||||
Builder().T(3).Dtis("---D").Fdiffs({1}).Build(),
|
||||
Builder().T(3).Dtis("---D").Fdiffs({1, 3}).Build(),
|
||||
};
|
||||
template_structure.templates.resize(8);
|
||||
template_structure.templates[0].T(0).Dtis("SSSS");
|
||||
template_structure.templates[1].T(0).Dtis("SSSS").FrameDiffs({8});
|
||||
template_structure.templates[2].T(1).Dtis("-SRR").FrameDiffs({4});
|
||||
template_structure.templates[3].T(1).Dtis("-SRR").FrameDiffs({4, 8});
|
||||
template_structure.templates[4].T(2).Dtis("--SR").FrameDiffs({2});
|
||||
template_structure.templates[5].T(2).Dtis("--SR").FrameDiffs({2, 4});
|
||||
template_structure.templates[6].T(3).Dtis("---D").FrameDiffs({1});
|
||||
template_structure.templates[7].T(3).Dtis("---D").FrameDiffs({1, 3});
|
||||
return template_structure;
|
||||
}
|
||||
default:
|
||||
|
||||
@ -75,7 +75,7 @@ class DefaultTemporalLayers final : public Vp8FrameBufferController {
|
||||
DependencyInfo(absl::string_view indication_symbols,
|
||||
Vp8FrameConfig frame_config)
|
||||
: decode_target_indications(
|
||||
GenericFrameInfo::DecodeTargetInfo(indication_symbols)),
|
||||
webrtc_impl::StringToDecodeTargetIndications(indication_symbols)),
|
||||
frame_config(frame_config) {}
|
||||
|
||||
absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications;
|
||||
|
||||
@ -36,6 +36,7 @@ constexpr int kMinTimeBetweenSyncs = kOneSecond90Khz * 2;
|
||||
constexpr int kMaxTimeBetweenSyncs = kOneSecond90Khz * 4;
|
||||
constexpr int kQpDeltaThresholdForSync = 8;
|
||||
constexpr int kMinBitrateKbpsForQpBoost = 500;
|
||||
constexpr auto kSwitch = DecodeTargetIndication::kSwitch;
|
||||
} // namespace
|
||||
|
||||
const double ScreenshareLayers::kMaxTL0FpsReduction = 2.5;
|
||||
@ -319,8 +320,7 @@ void ScreenshareLayers::OnEncodeDone(size_t stream_index,
|
||||
if (number_of_temporal_layers_ == 1) {
|
||||
vp8_info.temporalIdx = kNoTemporalIdx;
|
||||
vp8_info.layerSync = false;
|
||||
generic_frame_info.decode_target_indications =
|
||||
GenericFrameInfo::DecodeTargetInfo("S");
|
||||
generic_frame_info.decode_target_indications = {kSwitch};
|
||||
generic_frame_info.encoder_buffers.emplace_back(
|
||||
0, /*referenced=*/!is_keyframe, /*updated=*/true);
|
||||
} else {
|
||||
@ -344,8 +344,7 @@ void ScreenshareLayers::OnEncodeDone(size_t stream_index,
|
||||
active_layer_ = 1;
|
||||
info->template_structure =
|
||||
GetTemplateStructure(number_of_temporal_layers_);
|
||||
generic_frame_info.decode_target_indications =
|
||||
GenericFrameInfo::DecodeTargetInfo("SS");
|
||||
generic_frame_info.decode_target_indications = {kSwitch, kSwitch};
|
||||
} else if (active_layer_ >= 0 && layers_[active_layer_].state ==
|
||||
TemporalLayer::State::kKeyFrame) {
|
||||
layers_[active_layer_].state = TemporalLayer::State::kNormal;
|
||||
@ -429,21 +428,18 @@ FrameDependencyStructure ScreenshareLayers::GetTemplateStructure(
|
||||
FrameDependencyStructure template_structure;
|
||||
template_structure.num_decode_targets = num_layers;
|
||||
|
||||
using Builder = GenericFrameInfo::Builder;
|
||||
switch (num_layers) {
|
||||
case 1: {
|
||||
template_structure.templates = {
|
||||
Builder().T(0).Dtis("S").Build(),
|
||||
Builder().T(0).Dtis("S").Fdiffs({1}).Build(),
|
||||
};
|
||||
template_structure.templates.resize(2);
|
||||
template_structure.templates[0].T(0).Dtis("S");
|
||||
template_structure.templates[1].T(0).Dtis("S").FrameDiffs({1});
|
||||
return template_structure;
|
||||
}
|
||||
case 2: {
|
||||
template_structure.templates = {
|
||||
Builder().T(0).Dtis("SS").Build(),
|
||||
Builder().T(0).Dtis("SS").Fdiffs({1}).Build(),
|
||||
Builder().T(1).Dtis("-S").Fdiffs({1}).Build(),
|
||||
};
|
||||
template_structure.templates.resize(3);
|
||||
template_structure.templates[0].T(0).Dtis("SS");
|
||||
template_structure.templates[1].T(0).Dtis("SS").FrameDiffs({1});
|
||||
template_structure.templates[2].T(1).Dtis("-S").FrameDiffs({1});
|
||||
return template_structure;
|
||||
}
|
||||
default:
|
||||
|
||||
@ -78,7 +78,7 @@ class ScreenshareLayers final : public Vp8FrameBufferController {
|
||||
DependencyInfo(absl::string_view indication_symbols,
|
||||
Vp8FrameConfig frame_config)
|
||||
: decode_target_indications(
|
||||
GenericFrameInfo::DecodeTargetInfo(indication_symbols)),
|
||||
webrtc_impl::StringToDecodeTargetIndications(indication_symbols)),
|
||||
frame_config(frame_config) {}
|
||||
|
||||
absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications;
|
||||
|
||||
Reference in New Issue
Block a user