#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/test/video_encoder/decoder_buffer_validator.h"
#include <set>
#include <vector>
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "build/buildflag.h"
#include "media/base/decoder_buffer.h"
#include "media/gpu/buildflags.h"
#include "media/gpu/h264_decoder.h"
#include "media/gpu/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
namespace test {
namespace {
int VideoCodecProfileToH264ProfileIDC(VideoCodecProfile profile) { … }
int VideoCodecProfileToVP9Profile(VideoCodecProfile profile) { … }
}
std::unique_ptr<DecoderBufferValidator> DecoderBufferValidator::Create(
VideoCodecProfile profile,
const gfx::Rect& visible_rect,
size_t num_spatial_layers,
size_t num_temporal_layers,
SVCInterLayerPredMode inter_layer_pred) { … }
DecoderBufferValidator::DecoderBufferValidator(const gfx::Rect& visible_rect,
size_t num_temporal_layers)
: … { … }
DecoderBufferValidator::~DecoderBufferValidator() = default;
void DecoderBufferValidator::ProcessBitstream(
scoped_refptr<BitstreamRef> bitstream,
size_t frame_index) { … }
bool DecoderBufferValidator::WaitUntilDone() { … }
H264Validator::H264Validator(VideoCodecProfile profile,
const gfx::Rect& visible_rect,
size_t num_temporal_layers,
std::optional<uint8_t> level)
: … { … }
H264Validator::~H264Validator() = default;
bool H264Validator::Validate(const DecoderBuffer* buffer,
const BitstreamBufferMetadata& metadata) { … }
bool H264Validator::IsNewPicture(const H264SliceHeader& slice_hdr) { … }
bool H264Validator::UpdateCurrentPicture(const H264SliceHeader& slice_hdr) { … }
VP8Validator::VP8Validator(const gfx::Rect& visible_rect,
size_t num_temporal_layers)
: … { … }
VP8Validator::~VP8Validator() = default;
bool VP8Validator::Validate(const DecoderBuffer* buffer,
const BitstreamBufferMetadata& metadata) { … }
VP9Validator::VP9Validator(VideoCodecProfile profile,
const gfx::Rect& visible_rect,
size_t max_num_spatial_layers,
size_t num_temporal_layers,
SVCInterLayerPredMode inter_layer_pred)
: … { … }
VP9Validator::~VP9Validator() = default;
bool VP9Validator::Validate(const DecoderBuffer* buffer,
const BitstreamBufferMetadata& metadata) { … }
bool VP9Validator::ValidateVanillaStream(
const DecoderBuffer& decoder_buffer,
const BitstreamBufferMetadata& metadata,
const Vp9FrameHeader& header) { … }
bool VP9Validator::ValidateSVCStream(const DecoderBuffer& decoder_buffer,
const BitstreamBufferMetadata& metadata,
const Vp9FrameHeader& header) { … }
bool VP9Validator::ValidateSmodeStream(const DecoderBuffer& decoder_buffer,
const BitstreamBufferMetadata& metadata,
const Vp9FrameHeader& header) { … }
AV1Validator::AV1Validator(const gfx::Rect& visible_rect)
: … { … }
bool AV1Validator::Validate(const DecoderBuffer* buffer,
const BitstreamBufferMetadata& metadata) { … }
}
}