Reland "Updated analysis in videoprocessor."

This is a reland of 1880c7162bd3637c433f9421c798808cd6eacaf7
Original change's description:
> Updated analysis in videoprocessor.
>
> - Run analysis after all frames are processed. Before part of it was
> done at bitrate change points;
> - Analysis is done for whole stream as well as for each rate update
> interval;
> - Changed units from number of frames to time units for some metrics
> and thresholds. E.g. 'num frames to hit tagret bitrate' is changed to
> 'time to reach target bitrate, sec';
> - Changed data type of FrameStatistic::max_nalu_length (renamed to
> max_nalu_size_bytes) from rtc::Optional to size_t. There it no need to
> use such advanced data type in such low level data structure.
>
> Bug: webrtc:8524
> Change-Id: Ic9f6eab5b15ee12a80324b1f9c101de1bf3c702f
> Reviewed-on: https://webrtc-review.googlesource.com/31901
> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
> Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> Reviewed-by: Åsa Persson <asapersson@webrtc.org>
> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#21653}

TBR=brandtr@webrtc.org, stefan@webrtc.org

Bug: webrtc:8524
Change-Id: Ie0ad7790689422ffa61da294967fc492a13b75ae
Reviewed-on: https://webrtc-review.googlesource.com/40202
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21668}
This commit is contained in:
Sergey Silkin
2018-01-17 15:11:44 +01:00
committed by Commit Bot
parent e2a931886f
commit 3be2a55e7f
20 changed files with 735 additions and 908 deletions

View File

@ -27,34 +27,36 @@ std::string CodecSpecificToString(const webrtc::VideoCodec& codec) {
std::stringstream ss;
switch (codec.codecType) {
case kVideoCodecVP8:
ss << "\n Complexity : " << codec.VP8().complexity;
ss << "\n Resilience : " << codec.VP8().resilience;
ss << "\n # temporal layers : "
ss << "\n Complexity : " << codec.VP8().complexity;
ss << "\n Resilience : " << codec.VP8().resilience;
ss << "\n # temporal layers : "
<< static_cast<int>(codec.VP8().numberOfTemporalLayers);
ss << "\n Denoising : " << codec.VP8().denoisingOn;
ss << "\n Error concealment : " << codec.VP8().errorConcealmentOn;
ss << "\n Automatic resize : " << codec.VP8().automaticResizeOn;
ss << "\n Frame dropping : " << codec.VP8().frameDroppingOn;
ss << "\n Key frame interval: " << codec.VP8().keyFrameInterval;
ss << "\n Denoising : " << codec.VP8().denoisingOn;
ss << "\n Error concealment : " << codec.VP8().errorConcealmentOn;
ss << "\n Automatic resize : " << codec.VP8().automaticResizeOn;
ss << "\n Frame dropping : " << codec.VP8().frameDroppingOn;
ss << "\n Key frame interval : " << codec.VP8().keyFrameInterval;
break;
case kVideoCodecVP9:
ss << "\n Complexity : " << codec.VP9().complexity;
ss << "\n Resilience : " << codec.VP9().resilienceOn;
ss << "\n # temporal layers : "
ss << "\n Complexity : " << codec.VP9().complexity;
ss << "\n Resilience : " << codec.VP9().resilienceOn;
ss << "\n # temporal layers : "
<< static_cast<int>(codec.VP9().numberOfTemporalLayers);
ss << "\n Denoising : " << codec.VP9().denoisingOn;
ss << "\n Frame dropping : " << codec.VP9().frameDroppingOn;
ss << "\n Key frame interval: " << codec.VP9().keyFrameInterval;
ss << "\n Adaptive QP mode : " << codec.VP9().adaptiveQpMode;
ss << "\n Automatic resize : " << codec.VP9().automaticResizeOn;
ss << "\n # spatial layers : "
ss << "\n # spatial layers : "
<< static_cast<int>(codec.VP9().numberOfSpatialLayers);
ss << "\n Flexible mode : " << codec.VP9().flexibleMode;
ss << "\n Denoising : " << codec.VP9().denoisingOn;
ss << "\n Frame dropping : " << codec.VP9().frameDroppingOn;
ss << "\n Key frame interval : " << codec.VP9().keyFrameInterval;
ss << "\n Adaptive QP mode : " << codec.VP9().adaptiveQpMode;
ss << "\n Automatic resize : " << codec.VP9().automaticResizeOn;
ss << "\n # spatial layers : "
<< static_cast<int>(codec.VP9().numberOfSpatialLayers);
ss << "\n Flexible mode : " << codec.VP9().flexibleMode;
break;
case kVideoCodecH264:
ss << "\n Frame dropping : " << codec.H264().frameDroppingOn;
ss << "\n Key frame interval: " << codec.H264().keyFrameInterval;
ss << "\n Profile : " << codec.H264().profile;
ss << "\n Frame dropping : " << codec.H264().frameDroppingOn;
ss << "\n Key frame interval : " << codec.H264().keyFrameInterval;
ss << "\n Profile : " << codec.H264().profile;
break;
default:
break;
@ -65,26 +67,27 @@ std::string CodecSpecificToString(const webrtc::VideoCodec& codec) {
} // namespace
void TestConfig::SetCodecSettings(VideoCodecType codec_type,
int num_temporal_layers,
size_t num_temporal_layers,
bool error_concealment_on,
bool denoising_on,
bool frame_dropper_on,
bool spatial_resize_on,
bool resilience_on,
int width,
int height) {
size_t width,
size_t height) {
webrtc::test::CodecSettings(codec_type, &codec_settings);
// TODO(brandtr): Move the setting of |width| and |height| to the tests, and
// DCHECK that they are set before initializing the codec instead.
codec_settings.width = width;
codec_settings.height = height;
codec_settings.width = static_cast<uint16_t>(width);
codec_settings.height = static_cast<uint16_t>(height);
switch (codec_settings.codecType) {
case kVideoCodecVP8:
codec_settings.VP8()->resilience =
resilience_on ? kResilientStream : kResilienceOff;
codec_settings.VP8()->numberOfTemporalLayers = num_temporal_layers;
codec_settings.VP8()->numberOfTemporalLayers =
static_cast<uint8_t>(num_temporal_layers);
codec_settings.VP8()->denoisingOn = denoising_on;
codec_settings.VP8()->errorConcealmentOn = error_concealment_on;
codec_settings.VP8()->automaticResizeOn = spatial_resize_on;
@ -93,7 +96,8 @@ void TestConfig::SetCodecSettings(VideoCodecType codec_type,
break;
case kVideoCodecVP9:
codec_settings.VP9()->resilienceOn = resilience_on;
codec_settings.VP9()->numberOfTemporalLayers = num_temporal_layers;
codec_settings.VP9()->numberOfTemporalLayers =
static_cast<uint8_t>(num_temporal_layers);
codec_settings.VP9()->denoisingOn = denoising_on;
codec_settings.VP9()->frameDroppingOn = frame_dropper_on;
codec_settings.VP9()->keyFrameInterval = kBaseKeyFrameInterval;
@ -109,11 +113,11 @@ void TestConfig::SetCodecSettings(VideoCodecType codec_type,
}
}
int TestConfig::NumberOfCores() const {
size_t TestConfig::NumberOfCores() const {
return use_single_core ? 1 : CpuInfo::DetectNumberOfCores();
}
int TestConfig::NumberOfTemporalLayers() const {
size_t TestConfig::NumberOfTemporalLayers() const {
if (codec_settings.codecType == kVideoCodecVP8) {
return codec_settings.VP8().numberOfTemporalLayers;
} else if (codec_settings.codecType == kVideoCodecVP9) {
@ -123,8 +127,16 @@ int TestConfig::NumberOfTemporalLayers() const {
}
}
int TestConfig::TemporalLayerForFrame(int frame_idx) const {
int tl = -1;
size_t TestConfig::NumberOfSpatialLayers() const {
if (codec_settings.codecType == kVideoCodecVP9) {
return codec_settings.VP9().numberOfSpatialLayers;
} else {
return 1;
}
}
size_t TestConfig::TemporalLayerForFrame(size_t frame_idx) const {
size_t tl = 0;
switch (NumberOfTemporalLayers()) {
case 1:
tl = 0;
@ -153,7 +165,7 @@ int TestConfig::TemporalLayerForFrame(int frame_idx) const {
return tl;
}
std::vector<FrameType> TestConfig::FrameTypeForFrame(int frame_idx) const {
std::vector<FrameType> TestConfig::FrameTypeForFrame(size_t frame_idx) const {
if (keyframe_interval > 0 && (frame_idx % keyframe_interval == 0)) {
return {kVideoFrameKey};
}
@ -163,17 +175,19 @@ std::vector<FrameType> TestConfig::FrameTypeForFrame(int frame_idx) const {
std::string TestConfig::ToString() const {
std::string codec_type = CodecTypeToPayloadString(codec_settings.codecType);
std::stringstream ss;
ss << "\n Filename : " << filename;
ss << "\n # CPU cores used : " << NumberOfCores();
ss << "\n Filename : " << filename;
ss << "\n # CPU cores used : " << NumberOfCores();
ss << "\n General:";
ss << "\n Codec type : " << codec_type;
ss << "\n Start bitrate : " << codec_settings.startBitrate << " kbps";
ss << "\n Max bitrate : " << codec_settings.maxBitrate << " kbps";
ss << "\n Min bitrate : " << codec_settings.minBitrate << " kbps";
ss << "\n Width : " << codec_settings.width;
ss << "\n Height : " << codec_settings.height;
ss << "\n Max frame rate : " << codec_settings.maxFramerate;
ss << "\n QPmax : " << codec_settings.qpMax;
ss << "\n Codec type : " << codec_type;
ss << "\n Start bitrate : " << codec_settings.startBitrate << " kbps";
ss << "\n Max bitrate : " << codec_settings.maxBitrate << " kbps";
ss << "\n Min bitrate : " << codec_settings.minBitrate << " kbps";
ss << "\n Width : " << codec_settings.width;
ss << "\n Height : " << codec_settings.height;
ss << "\n Max frame rate : " << codec_settings.maxFramerate;
ss << "\n QPmax : " << codec_settings.qpMax;
ss << "\n # simulcast streams : "
<< static_cast<int>(codec_settings.numberOfSimulcastStreams);
ss << "\n " << codec_type << " specific: ";
ss << CodecSpecificToString(codec_settings);
return ss.str();