Decode a GIF's loop count

This commit is contained in:
Nigel Tao committed 2018-02-10 17:14:49 +11:00
1 parent ded38a043a
commit 584fc631a8
5 files changed
+636 -60

No files matched your search

+16 -1
View File
@@ -403,6 +403,8 @@ bool do_test_wuffs_gif_decode(const char* filename,
wuffs_gif__status__string(status));
return false;
}
// bricks-dither.gif is a 160 × 120 static (not animated) GIF.
if (wuffs_base__image_config__width(&ic) != 160) {
FAIL("width: got %" PRIu32 ", want 160",
wuffs_base__image_config__width(&ic));
@@ -413,6 +415,11 @@ bool do_test_wuffs_gif_decode(const char* filename,
wuffs_base__image_config__height(&ic));
return false;
}
// TODO: provide a public API for getting num_loops.
if (dec.private_impl.f_num_loops != 1) {
FAIL("num_loops: got %" PRIu32 ", want 1", dec.private_impl.f_num_loops);
return false;
}
}
int num_iters = 0;
@@ -571,7 +578,15 @@ void test_wuffs_gif_decode_animated() {
return;
}
// TODO: check the loop count.
// animated-red-blue.gif's num_loops should be 3. The value explicitly in the
// wire format is 0x0002, but that value means "repeat 2 times after the
// first play", so the total number of loops is 3.
//
// TODO: provide a public API for getting num_loops.
if (dec.private_impl.f_num_loops != 3) {
FAIL("num_loops: got %" PRIu32 ", want 3", dec.private_impl.f_num_loops);
return;
}
// animated-red-blue.gif should have 4 frames.
int i;