Enable Codec_GifInterlacedTruncated test for Wuffs

A recent update to the Wuffs version that Skia uses means that the test
now passes.

While the old third_party/gif implementation and the Wuffs
implementation now both replicate interlaced rows (what the old
implementation calls a "Haeberli hack"), and the
Codec_GifInterlacedTruncated test passes either way, the exact
replication algorithm is different. In general, pixel-by-pixel output
may be different for the same (truncated) input.

For example, the old implementation only processed input on block
boundaries. If the truncation happened within a block, the old
implementation produces no output for that partial block but the Wuffs
implementation does.

Also, the old implementation used the interlaced row as the *center* of
the extrapolation (the 'broad brush'); Wuffs uses it as the *top* of the
extrapolation. There are subjective arguments (e.g. 'Venetian blinds',
'fat bottom rows') for either behavior. In any case, it isn't covered by
the GIF spec.

Bug: skia:8235
Bug: skia:8766
Change-Id: Ia8d8b1007006697498e47ec6bba7be7d81be10c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243596
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
This commit is contained in:
Nigel Tao 2019-09-24 21:09:28 +10:00 committed by Skia Commit-Bot
parent 5f12eaa6c2
commit d48f13b26a

View File

@ -238,7 +238,6 @@ DEF_TEST(Gif, reporter) {
// "libgif warning [interlace DGifGetLine]"
}
#ifndef SK_HAS_WUFFS_LIBRARY
DEF_TEST(Codec_GifInterlacedTruncated, r) {
// Check that gInterlacedGIF is exactly 102 bytes long, and that the final
// 30 bytes, in the half-open range [72, 102), consists of 0x1b (indicating
@ -254,11 +253,12 @@ DEF_TEST(Codec_GifInterlacedTruncated, r) {
// We want to test the GIF codec's output on some (but not all) of the
// LZW-compressed data. As is, there is only one block of LZW-compressed
// data, 27 bytes long. Some GIF implementations output intermediate rows
// only on block boundaries, so truncating to a prefix of gInterlacedGIF
// isn't enough. We also have to modify the block size down from 0x1b so
// that the edited version still contains a complete block. In this case,
// it's a block of 10 bytes.
// data, 27 bytes long. Wuffs can output partial results from a partial
// block, but some other GIF implementations output intermediate rows only
// on block boundaries, so truncating to a prefix of gInterlacedGIF isn't
// enough. We also have to modify the block size down from 0x1b so that the
// edited version still contains a complete block. In this case, it's a
// block of 10 bytes.
unsigned char data[83];
memcpy(data, gInterlacedGIF, sizeof(data));
data[72] = sizeof(data) - 73;
@ -283,7 +283,6 @@ DEF_TEST(Codec_GifInterlacedTruncated, r) {
// transparent black (zero).
REPORTER_ASSERT(r, bm.getColor(0, 7) != 0);
}
#endif
// Regression test for decoding a gif image with sampleSize of 4, which was
// previously crashing.