mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
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:
parent
c63d66e32f
commit
05c8ad4e91
|
@ -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 {};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue