Tests/JPEG2000: Add spec example as test case
This tests reading JPEG2000 codestreams that aren't embedded in the ISOBMFF wrapper. It's also useful for debugging bitstream internals, since the spec lists expected output for many internal intermediate results.
This commit is contained in:
parent
0c935f8f42
commit
3568215790
1 changed files with 24 additions and 0 deletions
|
|
@ -580,6 +580,30 @@ TEST_CASE(test_jpeg_malformed_frame)
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_jpeg2000_spec_annex_j_10)
|
||||
{
|
||||
// J.10 An example of decoding showing intermediate steps
|
||||
// clang-format off
|
||||
constexpr Array data = to_array<u8>({
|
||||
0xFF, 0x4F, 0xFF, 0x51, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x01, 0xFF, 0x5C, 0x00,
|
||||
0x07, 0x40, 0x40, 0x48, 0x48, 0x50, 0xFF, 0x52, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01,
|
||||
0x04, 0x04, 0x00, 0x01, 0xFF, 0x90, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x01,
|
||||
0xFF, 0x93, 0xC7, 0xd4, 0x0C, 0x01, 0x8F, 0x0D, 0xC8, 0x75, 0x5D, 0xC0, 0x7C, 0x21, 0x80, 0x0F,
|
||||
0xB1, 0x76, 0xFF, 0xD9,
|
||||
});
|
||||
// clang-format on
|
||||
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::JPEG2000ImageDecoderPlugin::create(data));
|
||||
EXPECT_EQ(plugin_decoder->size(), Gfx::IntSize(1, 9));
|
||||
|
||||
// FIXME: Do something with this.
|
||||
// For now, this is useful for debugging:
|
||||
// `Build/lagom/bin/TestImageDecoder test_jpeg2000_spec_annex_j_10` prints internal state with JPEG2000_DEBUG=1.
|
||||
(void)plugin_decoder->frame(0);
|
||||
}
|
||||
|
||||
TEST_CASE(test_jpeg2000_simple)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("jpeg2000/simple.jp2"sv)));
|
||||
|
|
|
|||
Loading…
Reference in a new issue