From 6a6976816f506ed6862688cf1546b8b83170c399 Mon Sep 17 00:00:00 2001 From: Hirokazu Honda Date: Thu, 14 Apr 2022 09:19:12 +0000 Subject: [PATCH] media/gpu/vea_perf_tests: Change the way of computing the bitrate deviation This CL changes the way of computing the bitrate deviation for temporal layer encoding. It compares with the sums of bitrates of the temporal layers in the same spatial layer. The value represents more clearly the bitrate deviation of streams received by a decoder. Bug: b:220225711 Test: video_encode_accelerator_perf_tests Change-Id: I1ae86eb448e737d3bb6d8f57f21166982f9c092f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3583588 Reviewed-by: Miguel Casas-Sanchez Commit-Queue: Hirokazu Honda Cr-Commit-Position: refs/heads/main@{#992455} --- media/gpu/video_encode_accelerator_perf_tests.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/media/gpu/video_encode_accelerator_perf_tests.cc b/media/gpu/video_encode_accelerator_perf_tests.cc index a315da47792a04..d92634ee276671 100644 --- a/media/gpu/video_encode_accelerator_perf_tests.cc +++ b/media/gpu/video_encode_accelerator_perf_tests.cc @@ -419,7 +419,8 @@ void BitstreamQualityMetrics::WriteToConsole( uint32_t actual_bitrate) const { const auto default_ssize = std::cout.precision(); std::cout << "[ Result " << svc_text << "]" << std::endl; - std::cout << "Bitrate: " << actual_bitrate << std::endl; + std::cout << "Bitrate: " << actual_bitrate << " (target: " << target_bitrate + << ")" << std::endl; std::cout << "Bitrate deviation: " << std::fixed << std::setprecision(2) << (actual_bitrate * 100.0 / target_bitrate) - 100.0 << " %" << std::endl; @@ -459,7 +460,7 @@ void BitstreamQualityMetrics::WriteToFile( metrics.SetKey("Bitrate", base::Value(base::checked_cast(actual_bitrate))); metrics.SetKey( - "Bitrate deviation", + "BitrateDeviation", base::Value((actual_bitrate * 100.0 / target_bitrate) - 100.0)); metrics.SetKey("SSIMAverage", base::Value(ssim_stats.avg)); metrics.SetKey("PSNRAverage", base::Value(psnr_stats.avg)); @@ -709,9 +710,12 @@ TEST_F(VideoEncoderTest, MeasureProducedBitstreamQuality) { actual_bitrate = stats.Bitrate(); } else { CHECK(spatial_idx && temporal_idx); - target_bitrate = - g_env->Bitrate().GetBitrateBps(*spatial_idx, *temporal_idx); - actual_bitrate = stats.LayerBitrate(*spatial_idx, *temporal_idx); + // Target and actual bitrates in temporal layer encoding are the sum of + // bitrates of the temporal layers in the spatial layer. + for (size_t tid = 0; tid <= *temporal_idx; ++tid) { + target_bitrate += g_env->Bitrate().GetBitrateBps(*spatial_idx, tid); + actual_bitrate += stats.LayerBitrate(*spatial_idx, tid); + } } metrics.Output(target_bitrate, actual_bitrate);