Revert "Updated analysis in videoprocessor."

This reverts commit 1880c7162bd3637c433f9421c798808cd6eacaf7.

Reason for revert: breaks internal tests

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,asapersson@webrtc.org,sprang@webrtc.org,stefan@webrtc.org,ssilkin@webrtc.org

Change-Id: Id0b7d387bbba02e71637b229aeed6f6cf012af46
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8524
Reviewed-on: https://webrtc-review.googlesource.com/40220
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21656}
This commit is contained in:
Sergey Silkin
2018-01-17 13:15:57 +00:00
committed by Commit Bot
parent 53d877c0f8
commit 18bc3e19c4
20 changed files with 916 additions and 741 deletions

View File

@ -27,36 +27,34 @@ 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 # spatial layers : "
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 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;
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;
@ -67,27 +65,26 @@ std::string CodecSpecificToString(const webrtc::VideoCodec& codec) {
} // namespace
void TestConfig::SetCodecSettings(VideoCodecType codec_type,
size_t num_temporal_layers,
int num_temporal_layers,
bool error_concealment_on,
bool denoising_on,
bool frame_dropper_on,
bool spatial_resize_on,
bool resilience_on,
size_t width,
size_t height) {
int width,
int 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 = static_cast<uint16_t>(width);
codec_settings.height = static_cast<uint16_t>(height);
codec_settings.width = width;
codec_settings.height = height;
switch (codec_settings.codecType) {
case kVideoCodecVP8:
codec_settings.VP8()->resilience =
resilience_on ? kResilientStream : kResilienceOff;
codec_settings.VP8()->numberOfTemporalLayers =
static_cast<uint8_t>(num_temporal_layers);
codec_settings.VP8()->numberOfTemporalLayers = num_temporal_layers;
codec_settings.VP8()->denoisingOn = denoising_on;
codec_settings.VP8()->errorConcealmentOn = error_concealment_on;
codec_settings.VP8()->automaticResizeOn = spatial_resize_on;
@ -96,8 +93,7 @@ void TestConfig::SetCodecSettings(VideoCodecType codec_type,
break;
case kVideoCodecVP9:
codec_settings.VP9()->resilienceOn = resilience_on;
codec_settings.VP9()->numberOfTemporalLayers =
static_cast<uint8_t>(num_temporal_layers);
codec_settings.VP9()->numberOfTemporalLayers = num_temporal_layers;
codec_settings.VP9()->denoisingOn = denoising_on;
codec_settings.VP9()->frameDroppingOn = frame_dropper_on;
codec_settings.VP9()->keyFrameInterval = kBaseKeyFrameInterval;
@ -113,11 +109,11 @@ void TestConfig::SetCodecSettings(VideoCodecType codec_type,
}
}
size_t TestConfig::NumberOfCores() const {
int TestConfig::NumberOfCores() const {
return use_single_core ? 1 : CpuInfo::DetectNumberOfCores();
}
size_t TestConfig::NumberOfTemporalLayers() const {
int TestConfig::NumberOfTemporalLayers() const {
if (codec_settings.codecType == kVideoCodecVP8) {
return codec_settings.VP8().numberOfTemporalLayers;
} else if (codec_settings.codecType == kVideoCodecVP9) {
@ -127,16 +123,8 @@ size_t TestConfig::NumberOfTemporalLayers() const {
}
}
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;
int TestConfig::TemporalLayerForFrame(int frame_idx) const {
int tl = -1;
switch (NumberOfTemporalLayers()) {
case 1:
tl = 0;
@ -165,7 +153,7 @@ size_t TestConfig::TemporalLayerForFrame(size_t frame_idx) const {
return tl;
}
std::vector<FrameType> TestConfig::FrameTypeForFrame(size_t frame_idx) const {
std::vector<FrameType> TestConfig::FrameTypeForFrame(int frame_idx) const {
if (keyframe_interval > 0 && (frame_idx % keyframe_interval == 0)) {
return {kVideoFrameKey};
}
@ -175,19 +163,17 @@ std::vector<FrameType> TestConfig::FrameTypeForFrame(size_t 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 # simulcast streams : "
<< static_cast<int>(codec_settings.numberOfSimulcastStreams);
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 << " specific: ";
ss << CodecSpecificToString(codec_settings);
return ss.str();