From b54500ec3211f0f0e74894a210ed488f6a34e002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CMichael?= Date: Mon, 14 May 2018 08:35:00 -0500 Subject: [PATCH] VP9 SVC minimum bit rate thresholds too low for 720p Changed minimum bit rate threshold formula to raise the minimum bit rate at which 720p video is presented in VP9 SVC to ensure that the video quality for VP9 SVC is the same or better than VP8 SIM. The minimum bit rate threshold values for lower resolutions remain largely unchanged. Also changed maximum bit rate threshold formula to lower the maximum bit rate for low resolutions (e.g., 180p) in order to ensure higher frame rates when downlink bit rates are very low (e.g., < 100 kbps). Bug: webrtc:9242 Change-Id: I8f9c76c9188b98f3fd40a608551b576b0c3b8f34 Reviewed-on: https://webrtc-review.googlesource.com/75244 Commit-Queue: Michael Horowitz Reviewed-by: Stefan Holmer Cr-Commit-Position: refs/heads/master@{#23218} --- modules/video_coding/codecs/vp9/svc_config.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/video_coding/codecs/vp9/svc_config.cc b/modules/video_coding/codecs/vp9/svc_config.cc index 2935dd1571..ac6b4e5883 100644 --- a/modules/video_coding/codecs/vp9/svc_config.cc +++ b/modules/video_coding/codecs/vp9/svc_config.cc @@ -18,6 +18,10 @@ namespace webrtc { +namespace { +const int kMinVp9SvcBitrateKbps = 30; // Lowest VP9 video rate in kbps. +} // namespace + std::vector GetSvcConfig(size_t input_width, size_t input_height, size_t num_spatial_layers, @@ -45,16 +49,19 @@ std::vector GetSvcConfig(size_t input_width, spatial_layer.height = input_height >> (num_spatial_layers - sl_idx - 1); spatial_layer.numberOfTemporalLayers = num_temporal_layers; - // minBitrate and maxBitrate formulas were derived to fit VP9 - // subjective-quality data for bit rate below which video quality is - // unacceptable and above which additional bits do not provide benefit. + // minBitrate and maxBitrate formulas were derived from + // subjective-quality data to determing bit rates below which video + // quality is unacceptable and above which additional bits do not provide + // benefit. The formulas express rate in units of kbps. + // TODO(ssilkin): Add to the comment PSNR/SSIM we get at encoding certain // video to min/max bitrate specified by those formulas. const size_t num_pixels = spatial_layer.width * spatial_layer.height; - spatial_layer.minBitrate = - static_cast(360 * std::sqrt(num_pixels) / 1000); + const int min_bitrate = + static_cast((600. * std::sqrt(num_pixels) - 95000.) / 1000.); + spatial_layer.minBitrate = std::max(min_bitrate, kMinVp9SvcBitrateKbps); spatial_layer.maxBitrate = - static_cast((1.5 * num_pixels + 75 * 1000) / 1000); + static_cast((1.6 * num_pixels + 50 * 1000) / 1000); spatial_layer.targetBitrate = (spatial_layer.maxBitrate + spatial_layer.minBitrate) / 2;