mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-26 18:09:45 +00:00
...and add a test case that shows why it's incorrect.
If one dimension is 2^n + 1 and the other side is just 1, then the
topmost node will have 2^n x 1 and 1 x 1 children. The first child will
have n levels of children. The 1 x 1 child could end immediately, or it
could require that it also has n levels of (all 1 x 1) children. The
spec isn't clear on which of the two alternatives should happen. We
currently have n levels of 1 x 1 blocks.
This test case shows that a VERIFY we had was incorrect, so remove it.
The alternative implementation is to keep the VERIFY and to add a
if (x_count == 1 && y_count == 1)
level = 0;
to the top of TagTreeNode::create(). Then we don't have multiple levels
of 1 x 1 nodes, and we need to read fewer bits.
The images in the spec suggest that all nodes should have the same
number of levels, so go with that interpretation for now. Once we can
actually decode images, we'll hopefully see which of the two
interpretations is correct.
(The removed VERIFY() is hit when decoding
Tests/LibGfx/test-inputs/jpeg2000/buggie-gray.jpf in a local branch that
has some image decoding implemented. That file contains a packet with
1x3 code-blocks, which hits this case.)
|
||
|---|---|---|
| .. | ||
| ISOBMFF | ||
| BMPLoader.cpp | ||
| BMPLoader.h | ||
| BMPWriter.cpp | ||
| BMPWriter.h | ||
| BooleanDecoder.cpp | ||
| BooleanDecoder.h | ||
| CCITTDecoder.cpp | ||
| CCITTDecoder.h | ||
| DDSLoader.cpp | ||
| DDSLoader.h | ||
| ExifOrientedBitmap.h | ||
| GIFLoader.cpp | ||
| GIFLoader.h | ||
| ICOLoader.cpp | ||
| ICOLoader.h | ||
| ILBMLoader.cpp | ||
| ILBMLoader.h | ||
| ImageDecoder.cpp | ||
| ImageDecoder.h | ||
| JBIG2Loader.cpp | ||
| JBIG2Loader.h | ||
| JPEG2000Loader.cpp | ||
| JPEG2000Loader.h | ||
| JPEGLoader.cpp | ||
| JPEGLoader.h | ||
| JPEGShared.h | ||
| JPEGWriter.cpp | ||
| JPEGWriter.h | ||
| JPEGWriterTables.h | ||
| JPEGXLLoader.cpp | ||
| JPEGXLLoader.h | ||
| PAMLoader.cpp | ||
| PAMLoader.h | ||
| PBMLoader.cpp | ||
| PBMLoader.h | ||
| PGMLoader.cpp | ||
| PGMLoader.h | ||
| PNGLoader.cpp | ||
| PNGLoader.h | ||
| PNGShared.h | ||
| PNGWriter.cpp | ||
| PNGWriter.h | ||
| PortableFormatWriter.cpp | ||
| PortableFormatWriter.h | ||
| PortableImageLoaderCommon.h | ||
| PortableImageMapLoader.h | ||
| PPMLoader.cpp | ||
| PPMLoader.h | ||
| QMArithmeticDecoder.cpp | ||
| QMArithmeticDecoder.h | ||
| QOILoader.cpp | ||
| QOILoader.h | ||
| QOIWriter.cpp | ||
| QOIWriter.h | ||
| TGALoader.cpp | ||
| TGALoader.h | ||
| TIFFLoader.cpp | ||
| TIFFLoader.h | ||
| TinyVGLoader.cpp | ||
| TinyVGLoader.h | ||
| WebPLoader.cpp | ||
| WebPLoader.h | ||
| WebPLoaderLossless.cpp | ||
| WebPLoaderLossless.h | ||
| WebPLoaderLossy.cpp | ||
| WebPLoaderLossy.h | ||
| WebPLoaderLossyTables.h | ||