mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 00:47:28 +01:00
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:
1 parent
962a515dd2
commit
8f1adea523
2 files changed
+42
-16
No files matched your search
@@ -42,18 +42,32 @@ pri func decoder.filter_and_swizzle!(dst: ptr base.pixel_buffer, workbuf: slice
|
||||
dst_palette = args.dst.palette_or_else(fallback: this.dst_palette[..])
|
||||
tab = args.dst.plane(p: 0)
|
||||
|
||||
if dst_bytes_per_row1 < tab.width() {
|
||||
tab = tab.subtable(
|
||||
min_incl_x: 0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: dst_bytes_per_row1,
|
||||
max_incl_y: tab.height())
|
||||
}
|
||||
|
||||
if dst_bytes_per_row0 < tab.width() {
|
||||
tab = tab.subtable(
|
||||
min_incl_x: dst_bytes_per_row0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: tab.width(),
|
||||
max_incl_y: tab.height())
|
||||
} else {
|
||||
tab = tab.subtable(
|
||||
min_incl_x: 0,
|
||||
min_incl_y: 0,
|
||||
max_incl_x: 0,
|
||||
max_incl_y: 0)
|
||||
}
|
||||
|
||||
y = this.frame_rect_y0
|
||||
while y < this.frame_rect_y1 {
|
||||
assert y < 0x00FF_FFFF via "a < b: a < c; c <= b"(c: this.frame_rect_y1)
|
||||
dst = tab.row(y: y)
|
||||
if dst_bytes_per_row1 < dst.length() {
|
||||
dst = dst[.. dst_bytes_per_row1]
|
||||
}
|
||||
if dst_bytes_per_row0 < dst.length() {
|
||||
dst = dst[dst_bytes_per_row0 ..]
|
||||
} else {
|
||||
dst = this.util.empty_slice_u8()
|
||||
}
|
||||
|
||||
if 1 > args.workbuf.length() {
|
||||
return "#internal error: inconsistent workbuf length"
|
||||
|
||||
Reference in new issue
Block a user