chromium/media/gpu/test/video_encoder/video_encoder_test_environment.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "media/gpu/test/video_encoder/video_encoder_test_environment.h"

#include <iterator>
#include <utility>

#include "base/containers/flat_set.h"
#include "base/ranges/algorithm.h"
#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "build/chromeos_buildflags.h"
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "media/base/bitrate.h"
#include "media/base/media_switches.h"
#include "media/gpu/buildflags.h"
#include "media/gpu/gpu_video_encode_accelerator_helpers.h"
#include "media/gpu/macros.h"
#include "media/gpu/test/raw_video.h"

namespace media {
namespace test {
namespace {
struct CodecParamToProfile {} kCodecParamToProfile[] =;

struct SVCConfig {} kSVCModeParamToSVCConfig[] =;

uint32_t GetDefaultTargetBitrate(const VideoCodec codec,
                                 const gfx::Size& resolution,
                                 const uint32_t framerate,
                                 bool validation) {}

constexpr int kSpatialLayersResolutionScaleDenom[][3] =;

VideoBitrateAllocation CreateBitrateAllocation(
    const VideoCodec codec,
    const gfx::Size& resolution,
    uint32_t frame_rate,
    std::optional<uint32_t> encode_bitrate,
    size_t num_spatial_layers,
    size_t num_temporal_layers,
    bool is_vbr,
    bool validation) {}

std::vector<VideoEncodeAccelerator::Config::SpatialLayer>
GetDefaultSpatialLayers(const VideoBitrateAllocation& bitrate,
                        const gfx::Size& resolution,
                        uint32_t frame_rate,
                        size_t num_spatial_layers,
                        size_t num_temporal_layers) {}

}  // namespace

// static
VideoEncoderTestEnvironment* VideoEncoderTestEnvironment::Create(
    TestType test_type,
    const base::FilePath& video_path,
    const base::FilePath& video_metadata_path,
    const base::FilePath& output_folder,
    const std::string& codec,
    const std::string& svc_mode,
    VideoEncodeAccelerator::Config::ContentType content_type,
    bool save_output_bitstream,
    std::optional<uint32_t> encode_bitrate,
    Bitrate::Mode bitrate_mode,
    bool reverse,
    const FrameOutputConfig& frame_output_config,
    const std::vector<base::test::FeatureRef>& enabled_features,
    const std::vector<base::test::FeatureRef>& disabled_features) {}

VideoEncoderTestEnvironment::VideoEncoderTestEnvironment(
    TestType test_type,
    std::unique_ptr<media::test::RawVideo> video,
    const base::FilePath& output_folder,
    const base::FilePath& output_bitstream_file_base_name,
    VideoCodecProfile profile,
    SVCInterLayerPredMode inter_layer_pred_mode,
    size_t num_spatial_layers,
    size_t num_temporal_layers,
    VideoEncodeAccelerator::Config::ContentType content_type,
    const VideoBitrateAllocation& bitrate,
    bool save_output_bitstream,
    bool reverse,
    const FrameOutputConfig& frame_output_config,
    const std::vector<base::test::FeatureRef>& enabled_features,
    const std::vector<base::test::FeatureRef>& disabled_features)
    :{}

VideoEncoderTestEnvironment::~VideoEncoderTestEnvironment() = default;

media::test::RawVideo* VideoEncoderTestEnvironment::Video() const {}

media::test::RawVideo* VideoEncoderTestEnvironment::GenerateNV12Video() {}

VideoEncoderTestEnvironment::TestType VideoEncoderTestEnvironment::RunTestType()
    const {}

const base::FilePath& VideoEncoderTestEnvironment::OutputFolder() const {}

VideoCodecProfile VideoEncoderTestEnvironment::Profile() const {}

const std::vector<VideoEncodeAccelerator::Config::SpatialLayer>&
VideoEncoderTestEnvironment::SpatialLayers() const {}

SVCInterLayerPredMode VideoEncoderTestEnvironment::InterLayerPredMode() const {}

VideoEncodeAccelerator::Config::ContentType
VideoEncoderTestEnvironment::ContentType() const {}

const VideoBitrateAllocation& VideoEncoderTestEnvironment::BitrateAllocation()
    const {}

bool VideoEncoderTestEnvironment::SaveOutputBitstream() const {}

base::FilePath VideoEncoderTestEnvironment::OutputFilePath(
    const VideoCodec& codec,
    bool svc_enable,
    int spatial_idx,
    int temporal_idx) const {}

bool VideoEncoderTestEnvironment::Reverse() const {}

const FrameOutputConfig& VideoEncoderTestEnvironment::ImageOutputConfig()
    const {}

gpu::GpuMemoryBufferFactory*
VideoEncoderTestEnvironment::GetGpuMemoryBufferFactory() const {}
}  // namespace test
}  // namespace media