Hoist subslice out of std/png filter_and_swizzle

On an Intel NUC (Comet Lake, BXNUC10i5FNKPA):

name                                                      old speed      new speed      delta

wuffs_png_decode_image_19k_8bpp/clang9                     274MB/s ± 0%   273MB/s ± 0%  -0.25%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang9                    309MB/s ± 0%   308MB/s ± 0%  -0.22%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang9                     985MB/s ± 0%   982MB/s ± 0%  -0.29%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   846MB/s ± 0%   841MB/s ± 0%  -0.56%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   812MB/s ± 0%   808MB/s ± 0%  -0.55%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang9                  320MB/s ± 0%   320MB/s ± 0%  -0.15%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc10                      263MB/s ± 0%   276MB/s ± 0%  +5.00%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc10                     328MB/s ± 0%   333MB/s ± 0%  +1.49%  (p=0.016 n=5+4)
wuffs_png_decode_image_77k_8bpp/gcc10                      950MB/s ± 0%   976MB/s ± 0%  +2.78%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc10    865MB/s ± 0%   912MB/s ± 0%  +5.45%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc10    825MB/s ± 0%   868MB/s ± 0%  +5.19%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc10                   336MB/s ± 0%   341MB/s ± 0%  +1.37%  (p=0.008 n=5+5)
This commit is contained in:
Nigel Tao committed 2021-11-15 10:43:55 +11:00
1 parent 962a515dd2
commit 8f1adea523
2 files changed
+42 -16

No files matched your search

+20 -8
View File
@@ -40585,17 +40585,29 @@ wuffs_png__decoder__filter_and_swizzle__choosy_default(
v_dst_bytes_per_row1 = (((uint64_t)(self->private_impl.f_frame_rect_x1)) * v_dst_bytes_per_pixel);
v_dst_palette = wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024));
v_tab = wuffs_base__pixel_buffer__plane(a_dst, 0);
if (v_dst_bytes_per_row1 < ((uint64_t)(v_tab.width))) {
v_tab = wuffs_base__table_u8__subtable_ij(v_tab,
0,
0,
v_dst_bytes_per_row1,
((uint64_t)(v_tab.height)));
}
if (v_dst_bytes_per_row0 < ((uint64_t)(v_tab.width))) {
v_tab = wuffs_base__table_u8__subtable_ij(v_tab,
v_dst_bytes_per_row0,
0,
((uint64_t)(v_tab.width)),
((uint64_t)(v_tab.height)));
} else {
v_tab = wuffs_base__table_u8__subtable_ij(v_tab,
0,
0,
0,
0);
}
v_y = self->private_impl.f_frame_rect_y0;
while (v_y < self->private_impl.f_frame_rect_y1) {
v_dst = wuffs_base__table_u8__row(v_tab, v_y);
if (v_dst_bytes_per_row1 < ((uint64_t)(v_dst.len))) {
v_dst = wuffs_base__slice_u8__subslice_j(v_dst, v_dst_bytes_per_row1);
}
if (v_dst_bytes_per_row0 < ((uint64_t)(v_dst.len))) {
v_dst = wuffs_base__slice_u8__subslice_i(v_dst, v_dst_bytes_per_row0);
} else {
v_dst = wuffs_base__utility__empty_slice_u8();
}
if (1 > ((uint64_t)(a_workbuf.len))) {
return wuffs_base__make_status(wuffs_png__error__internal_error_inconsistent_workbuf_length);
}