LibGfx/JPEG: Write quantization tables in the zigzag ordering

This is clearly something I missed during the first implementation. The
specification is crystal clear about it: "The quantization elements
shall be specified in zig-zag scan order."

This patch fixes the weird behavior we had when using the quantization
table.
This commit is contained in:
Lucas CHOLLET 2023-07-01 23:56:23 -04:00 committed by Jelle Raaijmakers
parent c63d66e32f
commit 05c8ad4e91

View file

@ -398,8 +398,8 @@ ErrorOr<void> add_quantization_table(Stream& stream, QuantizationTable const& ta
// Pq and Tq
TRY(stream.write_value<u8>((0 << 4) | table.id));
for (auto coefficient : table.table)
TRY(stream.write_value<u8>(coefficient));
for (u8 i = 0; i < 64; ++i)
TRY(stream.write_value<u8>(table.table[zigzag_map[i]]));
return {};
}