Fix rate allocation between temporal layers in SVC.
Bitrate of three temporal layers as fraction of total bitrate after fix: 0.54, 0.16, 0.30 before fix: 0.54, 0.30, 0.16 Bug: none Change-Id: I8134abc19d5d6723b7a959196ca9c1635026eadc Reviewed-on: https://webrtc-review.googlesource.com/66060 Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Michael Horowitz <mhoro@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22726}
This commit is contained in:
committed by
Commit Bot
parent
f26abf827d
commit
571e6c9105
@ -95,9 +95,24 @@ BitrateAllocation SvcRateAllocator::GetAllocation(uint32_t total_bitrate_bps,
|
||||
SplitBitrate(num_temporal_layers, spatial_layer_bitrate_bps[sl_idx],
|
||||
kTemporalLayeringRateScalingFactor);
|
||||
|
||||
for (size_t tl_idx = 0; tl_idx < num_temporal_layers; ++tl_idx) {
|
||||
bitrate_allocation.SetBitrate(sl_idx, num_temporal_layers - tl_idx - 1,
|
||||
temporal_layer_bitrate_bps[tl_idx]);
|
||||
// Distribute rate across temporal layers. Allocate more bits to lower
|
||||
// layers since they are used for prediction of higher layers and their
|
||||
// references are far apart.
|
||||
if (num_temporal_layers == 1) {
|
||||
bitrate_allocation.SetBitrate(sl_idx, 0, temporal_layer_bitrate_bps[0]);
|
||||
} else if (num_temporal_layers == 2) {
|
||||
bitrate_allocation.SetBitrate(sl_idx, 0, temporal_layer_bitrate_bps[1]);
|
||||
bitrate_allocation.SetBitrate(sl_idx, 1, temporal_layer_bitrate_bps[0]);
|
||||
} else {
|
||||
RTC_CHECK_EQ(num_temporal_layers, 3);
|
||||
// In case of three temporal layers the high layer has two frames and the
|
||||
// middle layer has one frame within GOP (in between two consecutive low
|
||||
// layer frames). Thus high layer requires more bits (comparing pure
|
||||
// bitrate of layer, excluding bitrate of base layers) to keep quality on
|
||||
// par with lower layers.
|
||||
bitrate_allocation.SetBitrate(sl_idx, 0, temporal_layer_bitrate_bps[2]);
|
||||
bitrate_allocation.SetBitrate(sl_idx, 1, temporal_layer_bitrate_bps[0]);
|
||||
bitrate_allocation.SetBitrate(sl_idx, 2, temporal_layer_bitrate_bps[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user