Roll dst_palette into the pixel_swizzler struct

This commit will soon be followed by a rollback, but it is committed
anyway so that we can refer to these numbers in the git log.

name                                        old speed      new speed      delta

wuffs_gif_decode_1k_bw/clang5                286MB/s ± 1%   251MB/s ± 0%  -12.11%  (p=0.000 n=10+9)
wuffs_gif_decode_1k_color_full_init/clang5  96.0MB/s ± 0%  88.9MB/s ± 0%   -7.35%  (p=0.000 n=10+10)
wuffs_gif_decode_1k_color_part_init/clang5   119MB/s ± 0%   108MB/s ± 0%   -9.06%  (p=0.000 n=10+8)
wuffs_gif_decode_10k_bgra/clang5             469MB/s ± 1%   438MB/s ± 0%   -6.50%  (p=0.000 n=10+8)
wuffs_gif_decode_10k_indexed/clang5          125MB/s ± 1%   117MB/s ± 1%   -6.78%  (p=0.000 n=9+9)
wuffs_gif_decode_20k/clang5                  153MB/s ± 0%   139MB/s ± 0%   -9.40%  (p=0.000 n=9+9)
wuffs_gif_decode_100k_artificial/clang5      324MB/s ± 0%   304MB/s ± 0%   -6.22%  (p=0.000 n=10+9)
wuffs_gif_decode_100k_realistic/clang5       139MB/s ± 1%   125MB/s ± 1%   -9.69%  (p=0.000 n=9+10)
wuffs_gif_decode_1000k_full_init/clang5      141MB/s ± 0%   126MB/s ± 0%  -10.40%  (p=0.000 n=10+10)
wuffs_gif_decode_1000k_part_init/clang5      141MB/s ± 1%   126MB/s ± 0%  -10.50%  (p=0.000 n=10+8)
wuffs_gif_decode_anim_screencap/clang5       655MB/s ± 0%   617MB/s ± 1%   -5.91%  (p=0.000 n=9+9)

wuffs_gif_decode_1k_bw/gcc7                  299MB/s ± 0%   295MB/s ± 0%   -1.18%  (p=0.000 n=10+8)
wuffs_gif_decode_1k_color_full_init/gcc7    85.2MB/s ± 1%  88.2MB/s ± 0%   +3.58%  (p=0.000 n=10+10)
wuffs_gif_decode_1k_color_part_init/gcc7     104MB/s ± 0%   103MB/s ± 0%   -0.39%  (p=0.001 n=9+10)
wuffs_gif_decode_10k_bgra/gcc7               349MB/s ± 2%   352MB/s ± 0%   +0.77%  (p=0.000 n=9+10)
wuffs_gif_decode_10k_indexed/gcc7            106MB/s ± 0%   106MB/s ± 2%     ~     (p=0.762 n=8+10)
wuffs_gif_decode_20k/gcc7                    133MB/s ± 0%   133MB/s ± 0%     ~     (p=0.258 n=9+9)
wuffs_gif_decode_100k_artificial/gcc7        302MB/s ± 0%   301MB/s ± 1%   -0.41%  (p=0.035 n=10+10)
wuffs_gif_decode_100k_realistic/gcc7         118MB/s ± 1%   118MB/s ± 1%     ~     (p=0.095 n=9+10)
wuffs_gif_decode_1000k_full_init/gcc7        120MB/s ± 1%   119MB/s ± 0%   -0.34%  (p=0.007 n=10+10)
wuffs_gif_decode_1000k_part_init/gcc7        119MB/s ± 1%   119MB/s ± 1%     ~     (p=0.138 n=10+10)
wuffs_gif_decode_anim_screencap/gcc7         640MB/s ± 0%   640MB/s ± 0%     ~     (p=0.905 n=9+10)
This commit is contained in:
Nigel Tao committed 2020-05-26 14:07:30 +10:00
1 parent 3afdd91acb
commit 2d8ec9ace9
9 files changed
+236 -310

No files matched your search

-2
View File
@@ -341,7 +341,6 @@ pri func decoder.swizzle!(dst: ptr base.pixel_buffer, src: slice base.u8) base.s
if i < dst.length() {
this.swizzler.swizzle_interleaved!(
dst: dst[i ..],
dst_palette: this.util.empty_slice_u8(),
src: this.stash[.. this.num_stashed])
this.dst_x ~sat+= 1
}
@@ -377,7 +376,6 @@ pri func decoder.swizzle!(dst: ptr base.pixel_buffer, src: slice base.u8) base.s
if i < dst.length() {
n = this.swizzler.swizzle_interleaved!(
dst: dst[i ..],
dst_palette: this.util.empty_slice_u8(),
src: args.src)
this.dst_x ~sat+= (n & 0xFFFF_FFFF) as base.u32
n = (n & 0xFFFF_FFFF) * (src_bytes_per_pixel as base.u64)
+2 -11
View File
@@ -137,8 +137,6 @@ pub struct decoder? implements base.image_decoder(
// palettes[0] and palettes[1] are the Global and Local Color Table.
palettes : array[2] array[4 * 256] base.u8,
// dst_palette is the swizzled color table.
dst_palette : array[4 * 256] base.u8,
lzw : lzw.decoder,
//#WHEN PREPROC101 decode_config.wuffs
@@ -821,7 +819,6 @@ pri func decoder.decode_id_part1?(dst: ptr base.pixel_buffer, src: base.io_reade
var num_palette_entries : base.u32[..= 256]
var i : base.u32
var argb : base.u32
var dst_palette : slice base.u8
var status : base.status
var lw : base.u8
@@ -873,16 +870,11 @@ pri func decoder.decode_id_part1?(dst: ptr base.pixel_buffer, src: base.io_reade
this.palettes[1][(4 * (this.gc_transparent_index as base.u32)) + 3] = 0x00
}
dst_palette = args.dst.palette()
if dst_palette.length() == 0 {
dst_palette = this.dst_palette[..]
}
// TODO: a Wuffs (not just C) name for the
// WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_BINARY magic pixfmt constant.
status = this.swizzler.prepare!(
dst_pixfmt: args.dst.pixel_format(),
dst_palette: dst_palette,
dst_palette: args.dst.palette(),
src_pixfmt: this.util.make_pixel_format(repr: 0x8304_0008),
src_palette: this.palettes[which_palette][..],
blend: args.blend)
@@ -1074,8 +1066,7 @@ pri func decoder.copy_to_image_buffer!(pb: ptr base.pixel_buffer, src: slice bas
} else {
dst = dst[i ..]
}
n = this.swizzler.swizzle_interleaved!(
dst: dst, dst_palette: this.dst_palette[..], src: src)
n = this.swizzler.swizzle_interleaved!(dst: dst, src: src)
src_ri ~sat+= n
this.dst_x ~sat+= (n & 0xFFFF_FFFF) as base.u32
+1 -2
View File
@@ -212,8 +212,7 @@ pub func decoder.decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reader,
// v_c <<= 1;
c = (((c as base.u32) << 1) & 0xFF) as base.u8
this.swizzler.swizzle_interleaved!(
dst: dst, dst_palette: this.util.empty_slice_u8(), src: src[..])
this.swizzler.swizzle_interleaved!(dst: dst, src: src[..])
if dst_bytes_per_pixel <= dst.length() {
dst = dst[dst_bytes_per_pixel ..]