2022-09-25 18:24:07 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2024-06-10 15:04:03 -05:00
|
|
|
#include <LibMedia/Video/VP9/Decoder.h>
|
2022-09-25 18:24:07 -05:00
|
|
|
|
2024-06-19 23:04:25 -05:00
|
|
|
#include "TestMediaCommon.h"
|
2022-11-11 17:14:27 -06:00
|
|
|
|
2024-06-19 23:04:25 -05:00
|
|
|
static NonnullOwnPtr<Media::VideoDecoder> make_decoder(Media::Matroska::SampleIterator const&)
|
|
|
|
{
|
|
|
|
return make<Media::Video::VP9::Decoder>();
|
2022-10-01 17:28:37 -05:00
|
|
|
}
|
2022-09-25 18:24:07 -05:00
|
|
|
|
2022-10-01 17:28:37 -05:00
|
|
|
TEST_CASE(webm_in_vp9)
|
|
|
|
{
|
2024-06-19 23:04:25 -05:00
|
|
|
decode_video("./vp9_in_webm.webm"sv, 25, make_decoder);
|
2022-10-01 17:28:37 -05:00
|
|
|
}
|
|
|
|
|
2023-05-01 08:48:51 -05:00
|
|
|
TEST_CASE(vp9_oob_blocks)
|
|
|
|
{
|
2024-06-19 23:04:25 -05:00
|
|
|
decode_video("./vp9_oob_blocks.webm"sv, 240, make_decoder);
|
2023-05-01 08:48:51 -05:00
|
|
|
}
|
|
|
|
|
2023-10-21 23:22:32 +01:00
|
|
|
TEST_CASE(vp9_malformed_frame)
|
|
|
|
{
|
|
|
|
Array test_inputs = {
|
|
|
|
"./oss-fuzz-testcase-52630.vp9"sv,
|
|
|
|
"./oss-fuzz-testcase-53977.vp9"sv,
|
|
|
|
"./oss-fuzz-testcase-62054.vp9"sv,
|
|
|
|
"./oss-fuzz-testcase-63182.vp9"sv
|
|
|
|
};
|
|
|
|
|
|
|
|
for (auto test_input : test_inputs) {
|
|
|
|
auto file = MUST(Core::MappedFile::map(test_input));
|
2024-06-10 15:04:03 -05:00
|
|
|
Media::Video::VP9::Decoder vp9_decoder;
|
2024-06-19 18:29:12 -05:00
|
|
|
auto maybe_decoder_error = vp9_decoder.receive_sample(Duration::zero(), file->bytes());
|
2023-10-21 23:22:32 +01:00
|
|
|
EXPECT(maybe_decoder_error.is_error());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-01 17:28:37 -05:00
|
|
|
BENCHMARK_CASE(vp9_4k)
|
|
|
|
{
|
2024-06-19 23:04:25 -05:00
|
|
|
decode_video("./vp9_4k.webm"sv, 2, make_decoder);
|
2022-09-25 18:24:07 -05:00
|
|
|
}
|
2023-01-30 17:22:41 -06:00
|
|
|
|
|
|
|
BENCHMARK_CASE(vp9_clamp_reference_mvs)
|
|
|
|
{
|
2024-06-19 23:04:25 -05:00
|
|
|
decode_video("./vp9_clamp_reference_mvs.webm"sv, 92, make_decoder);
|
2023-01-30 17:22:41 -06:00
|
|
|
}
|