mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00

Encoded frames are preserved and decoded after all layers are encoded. Each spatial layer is decoded with separate decoder. For quality evaluation of lowres layers original input frame is downscaled with bilinear interpolation. Encoded and decoded frames are dumped into separate files. For async codecs encoded frames are passed to decoder in encode callback, as before. Bug: webrtc:8524 Change-Id: Idb0c92c7274c1915cff9a011a2794f1cf4bc8cb1 Reviewed-on: https://webrtc-review.googlesource.com/43381 Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21844}
121 lines
4.1 KiB
C++
121 lines
4.1 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 kNumSpatialLayers = 1;
|
|
const int kNumTemporalLayers = 1;
|
|
const bool kResilienceOn = kNumSpatialLayers > 1 || 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;
|
|
|
|
const size_t num_simulcast_streams =
|
|
codec_type_ == kVideoCodecVP8 ? kNumSpatialLayers : 1;
|
|
const size_t num_spatial_layers =
|
|
codec_type_ == kVideoCodecVP9 ? kNumSpatialLayers : 1;
|
|
|
|
config_.SetCodecSettings(codec_type_, num_simulcast_streams,
|
|
num_spatial_layers, 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
|