Skip to content

Commit

Permalink
LibGfx/JPEG2000: Do not run bit depth conversion for 8 bpp channels
Browse files Browse the repository at this point in the history
I missed to do this in SerenityOS#25734.

No behavior change, just an optimization.
  • Loading branch information
nico committed Mar 2, 2025
1 parent 13dd9d2 commit 742d9d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Userland/Libraries/LibGfx/ImageFormats/JPEG2000Loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,9 @@ static ErrorOr<void> convert_to_bitmap(JPEG2000LoadingContext& context)
if (context.siz.components[component_index].is_signed())
return Error::from_string_literal("JPEG2000ImageDecoderPlugin: Only unsigned components supported yet");

if (context.siz.components[component_index].bit_depth() == 8)
continue;

// > 16bpp currently overflow the u16s internal to decode_code_block().
if (context.siz.components[component_index].bit_depth() > 16)
return Error::from_string_literal("JPEG2000ImageDecoderPlugin: More than 16 bits per component not supported yet");
Expand Down

0 comments on commit 742d9d6

Please sign in to comment.