diff --git a/Userland/Libraries/LibGfx/JPEGLoader.cpp b/Userland/Libraries/LibGfx/JPEGLoader.cpp index 5145ac6b0f..f34b837f6c 100644 --- a/Userland/Libraries/LibGfx/JPEGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPEGLoader.cpp @@ -202,6 +202,12 @@ struct Scan { u8 successive_approximation {}; HuffmanStreamState huffman_stream; + + // See the note on Figure B.4 - Scan header syntax + bool are_components_interleaved() const + { + return components.size() != 1; + } }; struct JPEGLoadingContext { @@ -399,7 +405,11 @@ static ErrorOr build_macroblocks(JPEGLoadingContext& context, Vector read_start_of_frame(AK::SeekableStream& stream, JPEGLoading component.vsample_factor = subsample_factors & 0x0F; if (i == 0) { - // If there is only a single component, i.e. grayscale, the macroblocks will not be interleaved, even if - // the horizontal or vertical sample factor is larger than 1. - if (component_count == 1) { - component.hsample_factor = 1; - component.vsample_factor = 1; - } // By convention, downsampling is applied only on chroma components. So we should // hope to see the maximum sampling factor in the luma component. if (!validate_luma_and_modify_context(component, context)) {