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

LibGfx/JPEG: Store previous DC values in i16

Forgotten child of cfaa5120.
This commit is contained in:
Lucas CHOLLET 2023-04-28 22:47:05 -04:00 committed by Andreas Kling
parent a08b91e63e
commit 66108d102e

View file

@ -250,7 +250,7 @@ struct JPEGLoadingContext {
u16 dc_restart_interval { 0 };
HashMap<u8, HuffmanTableSpec> dc_tables;
HashMap<u8, HuffmanTableSpec> ac_tables;
Array<i32, 4> previous_dc_values {};
Array<i16, 4> previous_dc_values {};
MacroblockMeta mblock_meta;
OwnPtr<FixedMemoryStream> stream;
@ -366,7 +366,7 @@ static ErrorOr<void> add_dc(JPEGLoadingContext& context, Macroblock& macroblock,
}
// DC coefficients are encoded as the difference between previous and current DC values.
i32 dc_diff = TRY(read_huffman_bits(scan.huffman_stream, dc_length));
i16 dc_diff = TRY(read_huffman_bits(scan.huffman_stream, dc_length));
// If MSB in diff is 0, the difference is -ve. Otherwise +ve.
if (dc_length != 0 && dc_diff < (1 << (dc_length - 1)))