2017-02-10 01:37:17 -08:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-05-04 11:56:55 +02:00
|
|
|
#include "api/test/create_videocodec_test_fixture.h"
|
|
|
|
|
#include "test/gtest.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "test/testsupport/fileutils.h"
|
2017-09-04 03:03:40 -07:00
|
|
|
|
2017-02-10 01:37:17 -08:00
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
2017-02-22 01:26:59 -08:00
|
|
|
|
2017-02-10 01:37:17 -08:00
|
|
|
namespace {
|
2017-08-14 01:06:16 -07:00
|
|
|
|
|
|
|
|
// Loop variables.
|
2018-01-17 15:11:44 +01:00
|
|
|
const size_t kBitrates[] = {500};
|
2017-08-14 01:06:16 -07:00
|
|
|
const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8};
|
|
|
|
|
const bool kHwCodec[] = {false};
|
|
|
|
|
|
|
|
|
|
// Codec settings.
|
2018-02-01 13:25:17 +01:00
|
|
|
const int kNumSpatialLayers = 1;
|
2017-06-29 05:13:27 -07:00
|
|
|
const int kNumTemporalLayers = 1;
|
2017-02-10 01:37:17 -08:00
|
|
|
const bool kDenoisingOn = false;
|
|
|
|
|
const bool kSpatialResizeOn = false;
|
2017-08-14 01:06:16 -07:00
|
|
|
const bool kFrameDropperOn = false;
|
2017-02-10 01:37:17 -08:00
|
|
|
|
2017-03-10 04:20:10 -08:00
|
|
|
// Test settings.
|
2017-09-04 03:03:40 -07:00
|
|
|
const bool kUseSingleCore = false;
|
2017-10-19 12:14:09 +02:00
|
|
|
const bool kMeasureCpu = false;
|
2017-09-07 07:50:06 -07:00
|
|
|
const int kNumFrames = 30;
|
2017-02-10 01:37:17 -08:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
// Tests for plotting statistics from logs.
|
2018-05-15 10:56:06 +02:00
|
|
|
class VideoCodecTestParameterized
|
2018-05-04 11:56:55 +02:00
|
|
|
: public ::testing::Test,
|
2017-02-13 01:37:57 -08:00
|
|
|
public ::testing::WithParamInterface<
|
2018-01-17 15:11:44 +01:00
|
|
|
::testing::tuple<size_t, VideoCodecType, bool>> {
|
2017-02-10 01:37:17 -08:00
|
|
|
protected:
|
2018-05-15 10:56:06 +02:00
|
|
|
VideoCodecTestParameterized()
|
2017-02-10 01:37:17 -08:00
|
|
|
: bitrate_(::testing::get<0>(GetParam())),
|
2017-08-14 01:06:16 -07:00
|
|
|
codec_type_(::testing::get<1>(GetParam())),
|
|
|
|
|
hw_codec_(::testing::get<2>(GetParam())) {}
|
2018-05-15 10:56:06 +02:00
|
|
|
~VideoCodecTestParameterized() override = default;
|
2017-08-14 01:06:16 -07:00
|
|
|
|
2018-01-17 15:11:44 +01:00
|
|
|
void RunTest(size_t width,
|
|
|
|
|
size_t height,
|
|
|
|
|
size_t framerate,
|
2017-08-14 01:06:16 -07:00
|
|
|
const std::string& filename) {
|
2018-05-22 13:34:14 +02:00
|
|
|
VideoCodecTestFixture::Config config;
|
2018-05-04 11:56:55 +02:00
|
|
|
config.filename = filename;
|
|
|
|
|
config.filepath = ResourcePath(filename, "yuv");
|
|
|
|
|
config.use_single_core = kUseSingleCore;
|
|
|
|
|
config.measure_cpu = kMeasureCpu;
|
|
|
|
|
config.hw_encoder = hw_codec_;
|
|
|
|
|
config.hw_decoder = hw_codec_;
|
|
|
|
|
config.num_frames = kNumFrames;
|
2018-02-01 13:25:17 +01:00
|
|
|
|
|
|
|
|
const size_t num_simulcast_streams =
|
|
|
|
|
codec_type_ == kVideoCodecVP8 ? kNumSpatialLayers : 1;
|
|
|
|
|
const size_t num_spatial_layers =
|
|
|
|
|
codec_type_ == kVideoCodecVP9 ? kNumSpatialLayers : 1;
|
|
|
|
|
|
2018-04-13 14:25:22 +02:00
|
|
|
const std::string codec_name = CodecTypeToPayloadString(codec_type_);
|
2018-05-04 11:56:55 +02:00
|
|
|
config.SetCodecSettings(codec_name, num_simulcast_streams,
|
|
|
|
|
num_spatial_layers, kNumTemporalLayers,
|
|
|
|
|
kDenoisingOn, kFrameDropperOn, kSpatialResizeOn,
|
|
|
|
|
width, height);
|
2017-08-25 04:33:49 -07:00
|
|
|
|
2017-10-12 13:53:58 +02:00
|
|
|
std::vector<RateProfile> rate_profiles = {
|
2018-01-17 15:11:44 +01:00
|
|
|
{bitrate_, framerate, kNumFrames}};
|
2017-03-10 05:34:01 -08:00
|
|
|
|
2018-05-04 11:56:55 +02:00
|
|
|
fixture_ = CreateVideoCodecTestFixture(config);
|
2018-05-25 11:58:44 +02:00
|
|
|
fixture_->RunTest(rate_profiles, nullptr, nullptr, nullptr);
|
2017-02-10 01:37:17 -08:00
|
|
|
}
|
2018-05-04 11:56:55 +02:00
|
|
|
std::unique_ptr<VideoCodecTestFixture> fixture_;
|
2018-01-17 15:11:44 +01:00
|
|
|
const size_t bitrate_;
|
2017-02-13 01:37:57 -08:00
|
|
|
const VideoCodecType codec_type_;
|
2017-08-14 01:06:16 -07:00
|
|
|
const bool hw_codec_;
|
2017-02-10 01:37:17 -08:00
|
|
|
};
|
|
|
|
|
|
2017-09-07 07:50:06 -07:00
|
|
|
INSTANTIATE_TEST_CASE_P(CodecSettings,
|
2018-05-15 10:56:06 +02:00
|
|
|
VideoCodecTestParameterized,
|
2017-09-07 07:50:06 -07:00
|
|
|
::testing::Combine(::testing::ValuesIn(kBitrates),
|
|
|
|
|
::testing::ValuesIn(kVideoCodecType),
|
|
|
|
|
::testing::ValuesIn(kHwCodec)));
|
2017-02-10 01:37:17 -08:00
|
|
|
|
2018-05-15 10:56:06 +02:00
|
|
|
TEST_P(VideoCodecTestParameterized, Foreman_352x288_30) {
|
2017-08-14 01:06:16 -07:00
|
|
|
RunTest(352, 288, 30, "foreman_cif");
|
2017-02-10 01:37:17 -08:00
|
|
|
}
|
|
|
|
|
|
2018-05-15 10:56:06 +02:00
|
|
|
TEST_P(VideoCodecTestParameterized, DISABLED_FourPeople_1280x720_30) {
|
2018-02-20 09:48:26 +01:00
|
|
|
RunTest(1280, 720, 30, "FourPeople_1280x720_30");
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-10 01:37:17 -08:00
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|