> ImageIO's GIF decoder didn't decode interlaced images correctly when the > height was 2-4 pixels. > > For a tall gif (over 8px tall), interlacing is supposed to deliver pixels as > follows: > Pass 1: rows 0, 8, 16, etc > Pass 2: rows 4, 12, 20, etc > Pass 3: rows 2, 6, 10, etc. > Pass 4: rows 1, 3, 5, etc. > > But for a short gif (4px or less), we were computing the wrong value for > `streamY` and screwing up the order rows were delivered. > > With this PR: we immediately move on to the appropriate interlacing pass so > `streamY` makes sense. > > For example, here is some sample output from the attached test before this > proposed change: > > Failure #7; 3x2 > Original image: > [ffff3333, ffffff66, ff33cc33] > [ffcc33ff, ffcc9933, ff663333] > Decoded image: > [ffff3333, ffffff66, ff33cc33] > [ff000000, ff000000, ff000000] > > Failure #8; 3x3 > Original image: > [ffff3333, ffffff66, ff33cc33] > [ffcc33ff, ffcc9933, ff663333] > [ff99ff66, ff00ccff, ffcc3366] > Decoded image: > [ffff3333, ffffff66, ff33cc33] > [ff000000, ff000000, ff000000] > [ffcc33ff, ffcc9933, ff663333] > > Failure #9; 3x4 > Original image: > [ffff3333, ffffff66, ff33cc33] > [ffcc33ff, ffcc9933, ff663333] > [ff99ff66, ff00ccff, ffcc3366] > [ffff9966, ff666633, ff33cccc] > Decoded image: > [ffff3333, ffffff66, ff33cc33] > [ffff9966, ff666633, ff33cccc] > [ffcc33ff, ffcc9933, ff663333] > [ff000000, ff000000, ff000000] > > > In each case: you can observe the first row is correct. One row is left > black. And the remaining rows are not in the correct order. (But each > non-black row in the decoded IS in the original image somewhere.) > > This test is broadly written so it tests thousands of possible width/height > combinations. > > I successfully ran every test in the /jdk/test/jdk/javax/imageio/plugins/gif/ > directory on my Mac. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Jeremy Wood has updated the pull request incrementally with one additional commit since the last revision: 8395707: trivial comment change ------------- Changes: - all: https://git.openjdk.org/jdk/pull/33787/files - new: https://git.openjdk.org/jdk/pull/33787/files/1fa6186a..832bd3e2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=33787&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33787&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/33787.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33787/head:pull/33787 PR: https://git.openjdk.org/jdk/pull/33787
