mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-14 05:22:24 +00:00
LibGfx/JPEG2000: Read COD on tile headers too
I haven't seen this in the wild yet, but it is allowed per spec and easy to do.
This commit is contained in:
parent
65eb7699f4
commit
3735f2cbed
Notes:
sideshowbarker
2024-07-17 05:02:35 +09:00
Author: https://github.com/nico
Commit: 3735f2cbed
Pull-request: https://github.com/SerenityOS/serenity/pull/24107
1 changed files with 6 additions and 1 deletions
|
@ -459,6 +459,7 @@ struct TilePartData {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TileData {
|
struct TileData {
|
||||||
|
Optional<CodingStyleDefault> cod;
|
||||||
Optional<QuantizationDefault> qcd;
|
Optional<QuantizationDefault> qcd;
|
||||||
Vector<QuantizationComponent> qccs;
|
Vector<QuantizationComponent> qccs;
|
||||||
Vector<TilePartData> tile_parts;
|
Vector<TilePartData> tile_parts;
|
||||||
|
@ -652,7 +653,11 @@ static ErrorOr<void> parse_codestream_tile_header(JPEG2000LoadingContext& contex
|
||||||
case J2K_PLT:
|
case J2K_PLT:
|
||||||
case J2K_COM: {
|
case J2K_COM: {
|
||||||
auto marker = TRY(read_marker_at_cursor(context));
|
auto marker = TRY(read_marker_at_cursor(context));
|
||||||
if (marker.marker == J2K_QCD) {
|
if (marker.marker == J2K_COD) {
|
||||||
|
if (tile.cod.has_value())
|
||||||
|
return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Multiple COD markers in tile header");
|
||||||
|
tile.cod = TRY(read_coding_style_default(marker.data.value()));
|
||||||
|
} else if (marker.marker == J2K_QCD) {
|
||||||
if (tile.qcd.has_value())
|
if (tile.qcd.has_value())
|
||||||
return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Multiple QCD markers in tile header");
|
return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Multiple QCD markers in tile header");
|
||||||
tile.qcd = TRY(read_quantization_default(marker.data.value()));
|
tile.qcd = TRY(read_quantization_default(marker.data.value()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue