webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest_parameterized.cc
Sergey Silkin 3be2a55e7f Reland "Updated analysis in videoprocessor."
This is a reland of 1880c7162b
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}
2018-01-18 08:37:27 +00:00

113 lines
3.7 KiB
C++

/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "modules/video_coding/codecs/test/videoprocessor_integrationtest.h"
#include "test/testsupport/fileutils.h"
namespace webrtc {
namespace test {
namespace {
// Loop variables.
const size_t kBitrates[] = {500};
const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8};
const bool kHwCodec[] = {false};
// Codec settings.
const int kNumTemporalLayers = 1;
const bool kResilienceOn = kNumTemporalLayers > 1;
const bool kDenoisingOn = false;
const bool kErrorConcealmentOn = false;
const bool kSpatialResizeOn = false;
const bool kFrameDropperOn = false;
// Test settings.
const bool kUseSingleCore = false;
const bool kMeasureCpu = false;
const VisualizationParams kVisualizationParams = {
false, // save_encoded_ivf
false, // save_decoded_y4m
};
const int kNumFrames = 30;
} // namespace
// Tests for plotting statistics from logs.
class VideoProcessorIntegrationTestParameterized
: public VideoProcessorIntegrationTest,
public ::testing::WithParamInterface<
::testing::tuple<size_t, VideoCodecType, bool>> {
protected:
VideoProcessorIntegrationTestParameterized()
: bitrate_(::testing::get<0>(GetParam())),
codec_type_(::testing::get<1>(GetParam())),
hw_codec_(::testing::get<2>(GetParam())) {}
~VideoProcessorIntegrationTestParameterized() override = default;
void RunTest(size_t width,
size_t height,
size_t framerate,
const std::string& filename) {
config_.filename = filename;
config_.input_filename = ResourcePath(filename, "yuv");
config_.output_filename =
TempFilename(OutputPath(), "plot_videoprocessor_integrationtest");
config_.use_single_core = kUseSingleCore;
config_.measure_cpu = kMeasureCpu;
config_.hw_encoder = hw_codec_;
config_.hw_decoder = hw_codec_;
config_.num_frames = kNumFrames;
config_.SetCodecSettings(codec_type_, kNumTemporalLayers,
kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn,
kSpatialResizeOn, kResilienceOn, width, height);
std::vector<RateProfile> rate_profiles = {
{bitrate_, framerate, kNumFrames}};
ProcessFramesAndMaybeVerify(rate_profiles, nullptr, nullptr, nullptr,
&kVisualizationParams);
}
const size_t bitrate_;
const VideoCodecType codec_type_;
const bool hw_codec_;
};
INSTANTIATE_TEST_CASE_P(CodecSettings,
VideoProcessorIntegrationTestParameterized,
::testing::Combine(::testing::ValuesIn(kBitrates),
::testing::ValuesIn(kVideoCodecType),
::testing::ValuesIn(kHwCodec)));
TEST_P(VideoProcessorIntegrationTestParameterized, Process_128x96_30fps) {
RunTest(128, 96, 30, "foreman_128x96");
}
TEST_P(VideoProcessorIntegrationTestParameterized, Process_160x120_30fps) {
RunTest(160, 120, 30, "foreman_160x120");
}
TEST_P(VideoProcessorIntegrationTestParameterized, Process_176x144_30fps) {
RunTest(176, 144, 30, "foreman_176x144");
}
TEST_P(VideoProcessorIntegrationTestParameterized, Process_320x240_30fps) {
RunTest(320, 240, 30, "foreman_320x240");
}
TEST_P(VideoProcessorIntegrationTestParameterized, Process_352x288_30fps) {
RunTest(352, 288, 30, "foreman_cif");
}
} // namespace test
} // namespace webrtc