Migrate VideoCodecTestFixture on new perf metrics logging API
Bug: b/246095034 Change-Id: I312f2643e4c84cdfa3e8fef7078a2decbbfef978 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276629 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Commit-Queue: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38217}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
c228575baf
commit
dab4cea30d
@ -958,6 +958,8 @@ if (rtc_include_tests) {
|
||||
":webrtc_vp9_helpers",
|
||||
"../../api:array_view",
|
||||
"../../api:videocodec_test_fixture_api",
|
||||
"../../api/test/metrics:global_metrics_logger_and_exporter",
|
||||
"../../api/test/metrics:metric",
|
||||
"../../api/test/video:function_video_factory",
|
||||
"../../api/transport:field_trial_based_config",
|
||||
"../../api/video:video_bitrate_allocation",
|
||||
@ -984,7 +986,6 @@ if (rtc_include_tests) {
|
||||
"../../rtc_base:timeutils",
|
||||
"../../system_wrappers",
|
||||
"../../test:fileutils",
|
||||
"../../test:perf_test",
|
||||
"../../test:test_support",
|
||||
"../../test:video_test_common",
|
||||
"../../test:video_test_support",
|
||||
|
@ -21,8 +21,11 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/str_replace.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
|
||||
#include "api/test/metrics/metric.h"
|
||||
#include "api/transport/field_trial_based_config.h"
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
#include "api/video_codecs/h264_profile_level_id.h"
|
||||
@ -57,15 +60,14 @@
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/file_utils.h"
|
||||
#include "test/testsupport/frame_writer.h"
|
||||
#include "test/testsupport/perf_test.h"
|
||||
#include "test/video_codec_settings.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
namespace {
|
||||
|
||||
using VideoStatistics = VideoCodecTestStats::VideoStatistics;
|
||||
|
||||
namespace {
|
||||
const int kBaseKeyFrameInterval = 3000;
|
||||
const double kBitratePriority = 1.0;
|
||||
const int kDefaultMaxFramerateFps = 30;
|
||||
@ -542,33 +544,63 @@ void VideoCodecTestFixtureImpl::AnalyzeAllFrames(
|
||||
rtc::SimpleStringBuilder modifier(modifier_buf);
|
||||
modifier << "_r" << rate_profile_idx << "_sl" << layer_stat.spatial_idx;
|
||||
|
||||
auto PrintResultHelper = [&modifier, this](const std::string& measurement,
|
||||
double value,
|
||||
const std::string& units) {
|
||||
PrintResult(measurement, modifier.str(), config_.test_name, value,
|
||||
units, /*important=*/false);
|
||||
auto PrintResultHelper = [&modifier, this](
|
||||
absl::string_view measurement, double value,
|
||||
Unit unit,
|
||||
absl::string_view non_standard_unit_suffix,
|
||||
ImprovementDirection improvement_direction) {
|
||||
rtc::StringBuilder metric_name(measurement);
|
||||
metric_name << modifier.str() << non_standard_unit_suffix;
|
||||
GetGlobalMetricsLogger()->LogSingleValueMetric(
|
||||
metric_name.str(), config_.test_name, value, unit,
|
||||
improvement_direction);
|
||||
};
|
||||
|
||||
if (layer_stat.temporal_idx == config_.NumberOfTemporalLayers() - 1) {
|
||||
PrintResultHelper("enc_speed", layer_stat.enc_speed_fps, "fps");
|
||||
PrintResultHelper("enc_speed", layer_stat.enc_speed_fps,
|
||||
Unit::kUnitless, /*non_standard_unit_suffix=*/"_fps",
|
||||
ImprovementDirection::kBiggerIsBetter);
|
||||
PrintResultHelper("avg_key_frame_size",
|
||||
layer_stat.avg_key_frame_size_bytes, "bytes");
|
||||
layer_stat.avg_key_frame_size_bytes, Unit::kBytes,
|
||||
/*non_standard_unit_suffix=*/"",
|
||||
ImprovementDirection::kNeitherIsBetter);
|
||||
PrintResultHelper("num_key_frames", layer_stat.num_key_frames,
|
||||
"frames");
|
||||
Unit::kCount,
|
||||
/*non_standard_unit_suffix=*/"",
|
||||
ImprovementDirection::kNeitherIsBetter);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
modifier << "tl" << layer_stat.temporal_idx;
|
||||
PrintResultHelper("dec_speed", layer_stat.dec_speed_fps, "fps");
|
||||
PrintResultHelper("dec_speed", layer_stat.dec_speed_fps, Unit::kUnitless,
|
||||
/*non_standard_unit_suffix=*/"_fps",
|
||||
ImprovementDirection::kBiggerIsBetter);
|
||||
PrintResultHelper("avg_delta_frame_size",
|
||||
layer_stat.avg_delta_frame_size_bytes, "bytes");
|
||||
PrintResultHelper("bitrate", layer_stat.bitrate_kbps, "kbps");
|
||||
PrintResultHelper("framerate", layer_stat.framerate_fps, "fps");
|
||||
PrintResultHelper("avg_psnr_y", layer_stat.avg_psnr_y, "dB");
|
||||
PrintResultHelper("avg_psnr_u", layer_stat.avg_psnr_u, "dB");
|
||||
PrintResultHelper("avg_psnr_v", layer_stat.avg_psnr_v, "dB");
|
||||
PrintResultHelper("min_psnr_yuv", layer_stat.min_psnr, "dB");
|
||||
PrintResultHelper("avg_qp", layer_stat.avg_qp, "");
|
||||
layer_stat.avg_delta_frame_size_bytes, Unit::kBytes,
|
||||
/*non_standard_unit_suffix=*/"",
|
||||
ImprovementDirection::kNeitherIsBetter);
|
||||
PrintResultHelper("bitrate", layer_stat.bitrate_kbps,
|
||||
Unit::kKilobitsPerSecond,
|
||||
/*non_standard_unit_suffix=*/"",
|
||||
ImprovementDirection::kNeitherIsBetter);
|
||||
PrintResultHelper("framerate", layer_stat.framerate_fps, Unit::kUnitless,
|
||||
/*non_standard_unit_suffix=*/"_fps",
|
||||
ImprovementDirection::kNeitherIsBetter);
|
||||
PrintResultHelper("avg_psnr_y", layer_stat.avg_psnr_y, Unit::kUnitless,
|
||||
/*non_standard_unit_suffix=*/"_dB",
|
||||
ImprovementDirection::kBiggerIsBetter);
|
||||
PrintResultHelper("avg_psnr_u", layer_stat.avg_psnr_u, Unit::kUnitless,
|
||||
/*non_standard_unit_suffix=*/"_dB",
|
||||
ImprovementDirection::kBiggerIsBetter);
|
||||
PrintResultHelper("avg_psnr_v", layer_stat.avg_psnr_v, Unit::kUnitless,
|
||||
/*non_standard_unit_suffix=*/"_dB",
|
||||
ImprovementDirection::kBiggerIsBetter);
|
||||
PrintResultHelper("min_psnr_yuv", layer_stat.min_psnr, Unit::kUnitless,
|
||||
/*non_standard_unit_suffix=*/"_dB",
|
||||
ImprovementDirection::kBiggerIsBetter);
|
||||
PrintResultHelper("avg_qp", layer_stat.avg_qp, Unit::kUnitless,
|
||||
/*non_standard_unit_suffix=*/"",
|
||||
ImprovementDirection::kSmallerIsBetter);
|
||||
printf("\n");
|
||||
if (layer_stat.temporal_idx == config_.NumberOfTemporalLayers() - 1) {
|
||||
printf("\n");
|
||||
|
Reference in New Issue
Block a user