// Copyright 2024 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Implementation of a PGO test for the decoder and encoder #include "testing/gtest/include/gtest/gtest.h" #include "third_party/libvpx/source/libvpx/test/codec_factory.h" #include "third_party/libvpx/source/libvpx/test/i420_video_source.h" #include "third_party/libvpx/source/libvpx/test/util.h" #include "third_party/libvpx/source/libvpx/test/webm_video_source.h" #include "third_party/libvpx/source/libvpx/vpx/vpx_codec.h" #include "third_party/libvpx/source/libvpx/vpx_ports/vpx_timer.h" #include "third_party/libvpx/source/libvpx/vpx_util/vpx_pthread.h" namespace { make_tuple; constexpr int kMaxPsnr = …; constexpr double kUsecsInSec = …; constexpr vpx_rational kTimebase = …; /** * Test vectors: * Parameter ID 0 - video file name * Parameter ID 1 - number of threads */ DecodePerfParam; const DecodePerfParam kVP9DecodePerfVectors[] = …; /** * Class for obtaining video frames from memory. * * The class is used to pass frames from the decoder to the encoder. * Using an in-memory source allows to exercise the encoder on embedded * devices with limited storage space, where storing large YUV files * is not feasible. */ class InMemoryVideoSource : public ::libvpx_test::VideoSource { … }; THREADFN EncoderThreadAdapter(void* obj); class VP9M2MEncoder : public ::libvpx_test::EncoderTest { … }; THREADFN EncoderThreadAdapter(void* obj) { … } class DecodeEncodePerfTest : public ::testing::TestWithParam<DecodePerfParam> { … }; // In-memory decode and encode test for Profile Guided Optimizations // // This performance test is designed to exercise the decoder and encoder // and generate a compilation profile for the decoder and encoder. // Contrary to the name we don't really care to measure the actual test case // performance, but rather to hit as many code paths as possible. // The decoder and encoder run on separate threads, but the frames are // synchronized instead of using a buffer queue. // TODO(crbug.com/chromium/325103518): introduce noise to the decoded frames. TEST_P(DecodeEncodePerfTest, PerfTest) { … } INSTANTIATE_TEST_SUITE_P(…); } // namespace