In other words: only consider coefficient of the current scan when
adding coefficients to a macroblock. Information about which
coefficients are present in the stream are passed through the spectral
information in the context.
In progressive mode, this functions will need to be called multiple time
on the same macroblocks, so it shouldn't create the vector every
time it's called.
This means that we should read markers in a loop instead of quiting on
the first scan. This is useless for now as `SOF0` frames only have one
scan, but this is a step forward `SOF2` support.
As a JPEG file can contain multiples scans, we should return from
`scan_huffman_stream` on all new markers (except restart markers) and
not only `JPEG_EOI`.
Miscellaneous and tables segments can also be placed between scans,
placing this code in a function will allow us to avoid duplication when
we get there.
Rename "reset_marker" to "restart_marker" as described by the spec. It
also concerns disambiguate the situation as the DRI was also called a
reset marker.
Restart markers are supposed to be applied every restart interval.
However, in these loops macroblocks are counted taking the luma sampling
factor into consideration. Meaning that we need to correct this factor
when testing if we should reset the DC.
Also, the decoder was discarding the first byte of every scan with a set
restart interval, as `0 % n == 0` is always true.
The patch also contains modifications on several classes, functions or
files that are related to the `JPGLoader`.
Renaming include:
- JPGLoader{.h, .cpp}
- JPGImageDecoderPlugin
- JPGLoadingContext
- JPG_DEBUG
- decode_jpg
- FuzzJPGLoader.cpp
- Few string literals or texts
2023-02-18 23:56:24 +01:00
Renamed from Userland/Libraries/LibGfx/JPGLoader.cpp (Browse further)