webrtc_m130/modules/video_coding/codecs/test/videocodec_test_parameterized.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

102 lines
3.4 KiB
C++
Raw Normal View History

/*
* 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 "api/test/create_videocodec_test_fixture.h"
#include "test/gtest.h"
#include "test/testsupport/fileutils.h"
namespace webrtc {
namespace test {
Reland of Add optional visualization file writers to VideoProcessor tests. (patchset #1 id:1 of https://codereview.webrtc.org/2708103002/ ) Reason for revert: Necessary calls were "protected" by RTC_DCHECKs, that were optimized away in some release builds. Replacing the RTC_DCHECKs with EXPECTs. Original issue's description: > Revert of Add optional visualization file writers to VideoProcessor tests. (patchset #4 id:220001 of https://codereview.webrtc.org/2700493006/ ) > > Reason for revert: > Breaks downstream project. > > Original issue's description: > > Add optional visualization file writers to VideoProcessor tests. > > > > The purpose of this visualization CL is to add the ability to record > > video at the source, after encode, and after decode, in the VideoProcessor > > tests. These output files can then be replayed and used as a subjective > > complement to the objective metric plots given by the existing Python > > plotting script. > > > > BUG=webrtc:6634 > > > > Review-Url: https://codereview.webrtc.org/2700493006 > > Cr-Commit-Position: refs/heads/master@{#16738} > > Committed: https://chromium.googlesource.com/external/webrtc/+/872104ac41d7764f8676c9ea55555210bea4605c > > TBR=asapersson@webrtc.org,sprang@webrtc.org,kjellander@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6634 > > Review-Url: https://codereview.webrtc.org/2708103002 > Cr-Commit-Position: refs/heads/master@{#16745} > Committed: https://chromium.googlesource.com/external/webrtc/+/2a8135a1741761bd6de52163c0dc35f6eff7c8eb TBR=asapersson@webrtc.org,sprang@webrtc.org,kjellander@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true BUG=webrtc:6634 Review-Url: https://codereview.webrtc.org/2706123003 Cr-Commit-Position: refs/heads/master@{#16769}
2017-02-22 01:26:59 -08:00
namespace {
// Loop variables.
const size_t kBitrates[] = {500};
const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8};
const bool kHwCodec[] = {false};
// Codec settings.
const int kNumSpatialLayers = 1;
const int kNumTemporalLayers = 1;
const bool kDenoisingOn = false;
const bool kSpatialResizeOn = false;
const bool kFrameDropperOn = false;
// Test settings.
const bool kUseSingleCore = false;
const bool kMeasureCpu = false;
const int kNumFrames = 30;
} // namespace
// Tests for plotting statistics from logs.
class VideoCodecTestParameterized
: public ::testing::Test,
public ::testing::WithParamInterface<
::testing::tuple<size_t, VideoCodecType, bool>> {
protected:
VideoCodecTestParameterized()
: bitrate_(::testing::get<0>(GetParam())),
codec_type_(::testing::get<1>(GetParam())),
hw_codec_(::testing::get<2>(GetParam())) {}
~VideoCodecTestParameterized() override = default;
void RunTest(size_t width,
size_t height,
size_t framerate,
const std::string& filename) {
VideoCodecTestFixture::Config config;
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;
const size_t num_simulcast_streams =
codec_type_ == kVideoCodecVP8 ? kNumSpatialLayers : 1;
const size_t num_spatial_layers =
codec_type_ == kVideoCodecVP9 ? kNumSpatialLayers : 1;
const std::string codec_name = CodecTypeToPayloadString(codec_type_);
config.SetCodecSettings(codec_name, num_simulcast_streams,
num_spatial_layers, kNumTemporalLayers,
kDenoisingOn, kFrameDropperOn, kSpatialResizeOn,
width, height);
std::vector<RateProfile> rate_profiles = {
{bitrate_, framerate, kNumFrames}};
fixture_ = CreateVideoCodecTestFixture(config);
fixture_->RunTest(rate_profiles, nullptr, nullptr, nullptr);
}
std::unique_ptr<VideoCodecTestFixture> fixture_;
const size_t bitrate_;
const VideoCodecType codec_type_;
const bool hw_codec_;
};
INSTANTIATE_TEST_CASE_P(CodecSettings,
VideoCodecTestParameterized,
::testing::Combine(::testing::ValuesIn(kBitrates),
::testing::ValuesIn(kVideoCodecType),
::testing::ValuesIn(kHwCodec)));
TEST_P(VideoCodecTestParameterized, Foreman_352x288_30) {
RunTest(352, 288, 30, "foreman_cif");
}
TEST_P(VideoCodecTestParameterized, DISABLED_FourPeople_1280x720_30) {
RunTest(1280, 720, 30, "FourPeople_1280x720_30");
}
} // namespace test
} // namespace webrtc