mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
LibGfx/JPEG: More support for scans with a single component
Introduced in2c98eff
, support for non-interleaved scans was not working for frames with a number of MCU per line or column that is odd. Indeed, the decoder assumed that they have scans that include a fabricated MCU like scans with multiple components. This patch makes the decoder handle images with a number of MCU per line or column that is odd. To do so, as in the current decoder state we do not know if components are interleaved at allocation time, we skip over falsely-created macroblocks when filling them. As stated in2c98eff
, this is probably not a good solution and a whole refactor will be welcome. It also comes with a test that open a square image with a side of 600px, meaning 75 MCUs.
This commit is contained in:
parent
b820f9ffbd
commit
3f9c5af553
3 changed files with 24 additions and 1 deletions
|
@ -134,6 +134,17 @@ TEST_CASE(test_jpeg_sof2_spectral_selection)
|
|||
EXPECT_EQ(frame.image->size(), Gfx::IntSize(592, 800));
|
||||
}
|
||||
|
||||
TEST_CASE(test_jpeg_sof0_several_scans_odd_number_mcu)
|
||||
{
|
||||
auto file = MUST(Core::MappedFile::map(TEST_INPUT("several_scans_odd_number_mcu.jpg"sv)));
|
||||
EXPECT(Gfx::JPEGImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = MUST(Gfx::JPEGImageDecoderPlugin::create(file->bytes()));
|
||||
EXPECT(plugin_decoder->initialize());
|
||||
|
||||
auto frame = MUST(plugin_decoder->frame(0));
|
||||
EXPECT_EQ(frame.image->size(), Gfx::IntSize(600, 600));
|
||||
}
|
||||
|
||||
TEST_CASE(test_pbm)
|
||||
{
|
||||
auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.pbm"sv)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue