Have convert-to-nia output valid NIA on bad frames

This commit is contained in:
Nigel Tao committed 2021-11-23 15:24:58 +11:00
1 parent 15285a6ab9
commit e53497abe3
2 files changed
+14 -12

No files matched your search

+8 -6
View File
@@ -525,9 +525,6 @@ convert_frames() {
return "main: animation frame duration overflow"; return "main: animation frame duration overflow";
} }
total_duration += duration; total_duration += duration;
if (!g_flags.first_frame_only) {
print_nia_duration(total_duration);
}
if (wuffs_base__frame_config__index(&g_frame_config) == 0) { if (wuffs_base__frame_config__index(&g_frame_config) == 0) {
fill_rectangle( fill_rectangle(
@@ -561,14 +558,19 @@ convert_frames() {
TRY(read_more_src()); TRY(read_more_src());
} }
if (!g_flags.first_frame_only) {
print_nia_duration(total_duration);
}
print_nie_frame(); print_nie_frame();
if (!g_flags.first_frame_only) {
print_nia_padding();
}
if (df_status.repr != NULL) { if (df_status.repr != NULL) {
return wuffs_base__status__message(&df_status); return wuffs_base__status__message(&df_status);
} else if (g_flags.first_frame_only) { } else if (g_flags.first_frame_only) {
return NULL; return NULL;
} }
print_nia_padding();
switch (wuffs_base__frame_config__disposal(&g_frame_config)) { switch (wuffs_base__frame_config__disposal(&g_frame_config)) {
case WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND: { case WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND: {
@@ -605,11 +607,11 @@ main1(int argc, char** argv) {
if (!g_flags.first_frame_only) { if (!g_flags.first_frame_only) {
print_nix_header(0x41AFC36E); // "nïA" as a u32le. print_nix_header(0x41AFC36E); // "nïA" as a u32le.
} }
TRY(convert_frames()); const char* ret = convert_frames();
if (!g_flags.first_frame_only) { if (!g_flags.first_frame_only) {
print_nia_footer(); print_nia_footer();
} }
return NULL; return ret;
} }
int // int //
+6 -6
View File
@@ -14,13 +14,13 @@ fdcc644f test/data/artificial-gif/metadata-full.gif
a1a9b56d test/data/artificial-gif/multiple-graphic-controls.gif a1a9b56d test/data/artificial-gif/multiple-graphic-controls.gif
47c877fd test/data/artificial-gif/multiple-loop-counts.gif 47c877fd test/data/artificial-gif/multiple-loop-counts.gif
ba6e48f8 test/data/artificial-gif/no-frames.gif ba6e48f8 test/data/artificial-gif/no-frames.gif
6ec818c3 test/data/artificial-gif/pixel-data-none.gif f33b9bc1 test/data/artificial-gif/pixel-data-none.gif
5e57adb2 test/data/artificial-gif/pixel-data-not-enough.gif ac9d76d8 test/data/artificial-gif/pixel-data-not-enough.gif
3e29f88a test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif 2342e3fc test/data/artificial-gif/pixel-data-too-much-bad-lzw.gif
3e29f88a test/data/artificial-gif/pixel-data-too-much-good-lzw.gif 2342e3fc test/data/artificial-gif/pixel-data-too-much-good-lzw.gif
39a71dce test/data/artificial-gif/small-frame-interlaced.gif 39a71dce test/data/artificial-gif/small-frame-interlaced.gif
beaec397 test/data/artificial-gif/transparent-index.gif beaec397 test/data/artificial-gif/transparent-index.gif
6ec818c3 test/data/artificial-gif/zero-width-frame.gif f33b9bc1 test/data/artificial-gif/zero-width-frame.gif
0564b364 test/data/artificial-png/apng-skip-idat.png 0564b364 test/data/artificial-png/apng-skip-idat.png
e08a7cc8 test/data/artificial-png/key-value-pairs.png e08a7cc8 test/data/artificial-png/key-value-pairs.png
076cb375 test/data/bricks-color.bmp 076cb375 test/data/bricks-color.bmp
@@ -57,7 +57,7 @@ b727da8b test/data/hibiscus.regular.gif
dcbb225a test/data/hippopotamus.bmp dcbb225a test/data/hippopotamus.bmp
ed4b78fc test/data/hippopotamus.interlaced.gif ed4b78fc test/data/hippopotamus.interlaced.gif
dcbb225a test/data/hippopotamus.interlaced.png dcbb225a test/data/hippopotamus.interlaced.png
a80781a1 test/data/hippopotamus.interlaced.truncated.gif 45bf0281 test/data/hippopotamus.interlaced.truncated.gif
d3bbed27 test/data/hippopotamus.masked-with-muybridge.gif d3bbed27 test/data/hippopotamus.masked-with-muybridge.gif
7e6acf01 test/data/hippopotamus.masked-with-muybridge.png 7e6acf01 test/data/hippopotamus.masked-with-muybridge.png
dcbb225a test/data/hippopotamus.nie dcbb225a test/data/hippopotamus.nie