From 3c3e6fc2fafed84d20ef9d91eedd0b4ed6a27f73 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Mon, 28 May 2018 19:58:15 +1000 Subject: [PATCH] Decode std/gif to an image_buffer, not io_buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is about correctness, not performance, as an image_buffer supports decoding to a frame_rect whose top-left corner isn't (0, 0). For the record, though: name old speed new speed delta wuffs_gif_decode_1k_bw/clang 318MB/s ± 1% 307MB/s ± 2% -3.37% (p=0.000 n=48+48) wuffs_gif_decode_1k_color/clang 140MB/s ± 0% 137MB/s ± 1% -2.18% (p=0.000 n=46+46) wuffs_gif_decode_10k/clang 128MB/s ± 0% 125MB/s ± 2% -1.95% (p=0.000 n=39+46) wuffs_gif_decode_100k/clang 120MB/s ± 0% 119MB/s ± 1% -1.36% (p=0.000 n=45+47) wuffs_gif_decode_1000k/clang 122MB/s ± 0% 121MB/s ± 1% -1.35% (p=0.000 n=44+49) wuffs_gif_decode_1k_bw/gcc 329MB/s ± 2% 320MB/s ± 1% -2.97% (p=0.000 n=48+48) wuffs_gif_decode_1k_color/gcc 160MB/s ± 1% 156MB/s ± 1% -2.50% (p=0.000 n=44+46) wuffs_gif_decode_10k/gcc 144MB/s ± 1% 141MB/s ± 1% -2.30% (p=0.000 n=45+44) wuffs_gif_decode_100k/gcc 128MB/s ± 1% 126MB/s ± 1% -1.43% (p=0.000 n=46+45) wuffs_gif_decode_1000k/gcc 131MB/s ± 1% 129MB/s ± 1% -1.44% (p=0.000 n=48+46) --- gen/c/std/gif.c | 2 +- std/gif/decode_gif.wuffs | 2 +- test/c/std/gif.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gen/c/std/gif.c b/gen/c/std/gif.c index 2f7bff89..050aca38 100644 --- a/gen/c/std/gif.c +++ b/gen/c/std/gif.c @@ -3437,7 +3437,7 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id_part1( } wuffs_gif__lzw_decoder__set_literal_width(&self->private_impl.f_lzw, ((uint32_t)(v_lw))); - v_write_to_ib_instead_of_w = false; + v_write_to_ib_instead_of_w = true; self->private_impl.f_previous_lzw_decode_ended_abruptly = true; while (true) { { diff --git a/std/gif/decode_gif.wuffs b/std/gif/decode_gif.wuffs index bd79023a..c77ed4dc 100644 --- a/std/gif/decode_gif.wuffs +++ b/std/gif/decode_gif.wuffs @@ -422,7 +422,7 @@ pri func decoder.decode_id_part1?(ib ptr base.image_buffer, dst base.io_writer, // TODO: delete the write_to_ib_instead_of_w hack. It should always be // true. - var write_to_ib_instead_of_w base.bool = false + var write_to_ib_instead_of_w base.bool = true this.previous_lzw_decode_ended_abruptly = true while true { diff --git a/test/c/std/gif.c b/test/c/std/gif.c index d9fa45d9..824d0e1c 100644 --- a/test/c/std/gif.c +++ b/test/c/std/gif.c @@ -356,7 +356,7 @@ void bench_wuffs_lzw_decode_100k() { // ---------------- GIF Tests // TODO: delete this. -const bool write_to_ib_instead_of_w = false; +const bool write_to_ib_instead_of_w = true; const char* wuffs_gif_decode(wuffs_base__io_buffer* dst, wuffs_base__io_buffer* src) {