#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/vp9_svc_layers.h"
#include <algorithm>
#include <array>
#include <map>
#include <optional>
#include <vector>
#include "base/containers/contains.h"
#include "base/logging.h"
#include "media/gpu/vp9_picture.h"
#include "media/gpu/vp9_reference_frame_vector.h"
#include "media/parsers/vp9_parser.h"
#include "media/video/video_encode_accelerator.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
namespace {
constexpr gfx::Size kDefaultEncodeSize(1280, 720);
constexpr int kSpatialLayerResolutionDenom[] = …;
gfx::Size GetDefaultSVCResolution(size_t spatial_index) { … }
std::vector<gfx::Size> GetDefaultSVCResolutions(size_t num_spatial_layers) { … }
VP9SVCLayers::Config GetDefaultSVCLayers2Config(
size_t num_spatial_layers,
size_t num_temporal_layers,
SVCInterLayerPredMode inter_layer_pred) { … }
uint8_t GetTemporalIndex(size_t num_temporal_layers, size_t frame_num) { … }
struct Vp9MetadataAndFrameNum { … };
void VerifyReferenceFrame(const Vp9Metadata& metadata,
size_t frame_num,
const Vp9MetadataAndFrameNum& ref_frame,
SVCInterLayerPredMode inter_layer_pred) { … }
void VerifykSVCFrame(
const VP9SVCLayers::PictureParam& picture_param,
const Vp9Metadata& metadata,
const std::array<Vp9MetadataAndFrameNum, kVp9NumRefFrames>& ref_frames,
size_t frame_num,
size_t num_spatial_layers,
size_t expected_begin_active_layer,
size_t expected_end_active_layer) { … }
void VerifySmodeFrame(
const VP9SVCLayers::PictureParam& picture_param,
const Vp9Metadata& metadata,
const std::array<Vp9MetadataAndFrameNum, kVp9NumRefFrames>& ref_frames,
size_t frame_num,
size_t num_spatial_layers,
size_t expected_begin_active_layer,
size_t expected_end_active_layer) { … }
}
class VP9SVCLayersTest
: public ::testing::TestWithParam<
::testing::tuple<size_t, size_t, SVCInterLayerPredMode>> { … };
TEST_P(VP9SVCLayersTest, VerifyMetadata) { … }
TEST_P(VP9SVCLayersTest, VerifyMetadataMultipleTimes) { … }
INSTANTIATE_TEST_SUITE_P(…);
}