mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibGfx/CCITT: Add PDF-specific options for CCITT3 1D
These two options are additions of the PDF specification. They are valid for both 1D and 2D, but let's bail out if we encounter them in a 2D image, as we don't have a test case yet.
This commit is contained in:
parent
6fc59039c4
commit
7730b743db
Notes:
sideshowbarker
2024-07-17 06:29:49 +09:00
Author: https://github.com/LucasChollet
Commit: 7730b743db
Pull-request: https://github.com/SerenityOS/serenity/pull/23628
Issue: https://github.com/SerenityOS/serenity/issues/23623
Reviewed-by: https://github.com/nico ✅
2 changed files with 22 additions and 1 deletions
|
@ -596,13 +596,19 @@ ErrorOr<ByteBuffer> decode_ccitt_group3(ReadonlyBytes bytes, u32 image_width, u3
|
|||
// NOTE: For whatever reason, the last EOL doesn't seem to be included
|
||||
|
||||
for (u32 i = 0; i < image_height; ++i) {
|
||||
TRY(read_eol(*bit_stream, options.use_fill_bits));
|
||||
if (options.require_end_of_line == Group3Options::RequireEndOfLine::Yes)
|
||||
TRY(read_eol(*bit_stream, options.use_fill_bits));
|
||||
TRY(decode_single_ccitt3_1d_line(*bit_stream, *decoded_bits, image_width));
|
||||
if (options.encoded_byte_aligned == Group3Options::EncodedByteAligned::Yes)
|
||||
bit_stream->align_to_byte_boundary();
|
||||
}
|
||||
|
||||
return decoded_bytes;
|
||||
}
|
||||
|
||||
if (options.require_end_of_line == Group3Options::RequireEndOfLine::No || options.encoded_byte_aligned == Group3Options::EncodedByteAligned::Yes)
|
||||
return Error::from_string_literal("CCITTDecoder: Unsupported option for CCITT3 2D decoding");
|
||||
|
||||
TRY(decode_single_ccitt3_2d_block(*bit_stream, *decoded_bits, image_width, image_height, options.use_fill_bits));
|
||||
return decoded_bytes;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue