1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:07:34 +00:00

LibGfx/TIFF+CCITT: Clarify naming of compression type 2

Type 2 <=> One-dimensional Group3, customized for TIFF
Type 3 <=> Two-dimensional Group3, uses the original 1D internally
Type 4 <=> Two-dimensional Group4

So let's clarify that this is not Group3 1D but the TIFF variant, which
is called `CCITTRLE` in libtiff. So let's stick with this name to avoid
confusion.
This commit is contained in:
Lucas CHOLLET 2024-01-15 00:46:10 -05:00 committed by Andreas Kling
parent 9b50b5793b
commit edffdc35a9
6 changed files with 9 additions and 9 deletions

View file

@ -281,17 +281,17 @@ private:
TRY(loop_over_pixels(move(identity)));
break;
}
case Compression::CCITT: {
case Compression::CCITTRLE: {
TRY(ensure_tags_are_correct_for_ccitt());
ByteBuffer decoded_bytes {};
auto decode_ccitt_1D_strip = [&](u32 num_bytes) -> ErrorOr<ReadonlyBytes> {
auto decode_ccitt_rle_strip = [&](u32 num_bytes) -> ErrorOr<ReadonlyBytes> {
auto const encoded_bytes = TRY(m_stream->read_in_place<u8 const>(num_bytes));
decoded_bytes = TRY(CCITT::decode_ccitt3_1d(encoded_bytes, *m_metadata.image_width(), *m_metadata.rows_per_strip()));
decoded_bytes = TRY(CCITT::decode_ccitt_rle(encoded_bytes, *m_metadata.image_width(), *m_metadata.rows_per_strip()));
return decoded_bytes;
};
TRY(loop_over_pixels(move(decode_ccitt_1D_strip)));
TRY(loop_over_pixels(move(decode_ccitt_rle_strip)));
break;
}
case Compression::LZW: {