#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/av1_decoder.h"
#include <string.h>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/containers/span.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "media/base/decoder_buffer.h"
#include "media/base/test_data_util.h"
#include "media/ffmpeg/ffmpeg_common.h"
#include "media/ffmpeg/scoped_av_packet.h"
#include "media/filters/ffmpeg_demuxer.h"
#include "media/filters/in_memory_url_protocol.h"
#include "media/gpu/av1_picture.h"
#include "media/media_buildflags.h"
#include "media/parsers/ivf_parser.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libgav1/src/src/obu_parser.h"
#include "third_party/libgav1/src/src/utils/constants.h"
#include "third_party/libgav1/src/src/utils/types.h"
_;
DoAll;
Return;
SaveArg;
namespace media {
namespace {
class FakeAV1Picture : public AV1Picture { … };
bool IsYUV420(int8_t subsampling_x, int8_t subsampling_y, bool is_monochrome) { … }
MATCHER_P(SameAV1PictureInstance, av1_picture, "") { … }
MATCHER_P2(MatchesFrameSizeAndRenderSize, frame_size, render_size, "") { … }
MATCHER_P4(MatchesFrameHeader,
frame_size,
render_size,
show_existing_frame,
show_frame,
"") { … }
MATCHER_P4(MatchesYUV420SequenceHeader,
profile,
bitdepth,
max_frame_size,
film_grain_params_present,
"") { … }
MATCHER(NonEmptyTileBuffers, "") { … }
MATCHER_P(MatchesFrameData, decoder_buffer, "") { … }
class MockAV1Accelerator : public AV1Decoder::AV1Accelerator { … };
}
class AV1DecoderTest : public ::testing::Test { … };
void AV1DecoderTest::SetUp() { … }
std::vector<AcceleratedVideoDecoder::DecodeResult> AV1DecoderTest::Decode(
scoped_refptr<DecoderBuffer> buffer) { … }
const libgav1::DecoderState* AV1DecoderTest::GetDecoderState() const { … }
AV1ReferenceFrameVector& AV1DecoderTest::GetReferenceFrames() const { … }
void AV1DecoderTest::Reset() { … }
scoped_refptr<DecoderBuffer> AV1DecoderTest::ReadDecoderBuffer(
const std::string& fname) { … }
std::vector<scoped_refptr<DecoderBuffer>> AV1DecoderTest::ReadIVF(
const std::string& fname) { … }
std::vector<scoped_refptr<DecoderBuffer>> AV1DecoderTest::ReadWebm(
const std::string& fname) { … }
TEST_F(AV1DecoderTest, DecodeInvalidOBU) { … }
TEST_F(AV1DecoderTest, DecodeEmptyOBU) { … }
TEST_F(AV1DecoderTest, DecodeOneIFrame) { … }
TEST_F(AV1DecoderTest, DecodeSimpleStream) { … }
TEST_F(AV1DecoderTest, DecodeShowExistingPictureStream) { … }
TEST_F(AV1DecoderTest, Decode10bitStream) { … }
TEST_F(AV1DecoderTest, DecodeTemporalLayerStream) { … }
TEST_F(AV1DecoderTest, DecodeSVCStream) { … }
TEST_F(AV1DecoderTest, DenyDecodeNonYUV420) { … }
TEST_F(AV1DecoderTest, DecodeFilmGrain) { … }
TEST_F(AV1DecoderTest, ConfigChange) { … }
TEST_F(AV1DecoderTest, Reset) { … }
TEST_F(AV1DecoderTest, ResetAndConfigChange) { … }
TEST_F(AV1DecoderTest, InconsistentReferenceFrameState) { … }
TEST_F(AV1DecoderTest, TryAgainSubmitDecode) { … }
TEST_F(AV1DecoderTest, DecodeWithFrameSizeChange) { … }
}