mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 08:47:28 +01:00
Delete image_buffer linearization optimization
It helps at small image sizes, but it doesn't help at all for larger images. The extra code is probably not worth it. Numbers below, old is with the optimization, new is without. name old speed new speed delta wuffs_gif_decode_1k_bw/clang 307MB/s ± 2% 286MB/s ± 0% -6.84% (p=0.000 n=48+42) wuffs_gif_decode_1k_color/clang 137MB/s ± 1% 134MB/s ± 0% -2.36% (p=0.000 n=46+44) wuffs_gif_decode_10k/clang 125MB/s ± 2% 125MB/s ± 0% ~ (p=0.617 n=46+45) wuffs_gif_decode_100k/clang 119MB/s ± 1% 119MB/s ± 0% ~ (p=0.827 n=47+43) wuffs_gif_decode_1000k/clang 121MB/s ± 1% 121MB/s ± 1% +0.31% (p=0.022 n=49+46) wuffs_gif_decode_1k_bw/gcc 320MB/s ± 1% 304MB/s ± 1% -4.77% (p=0.000 n=48+46) wuffs_gif_decode_1k_color/gcc 156MB/s ± 1% 153MB/s ± 1% -2.08% (p=0.000 n=46+49) wuffs_gif_decode_10k/gcc 141MB/s ± 1% 141MB/s ± 0% -0.06% (p=0.012 n=44+46) wuffs_gif_decode_100k/gcc 126MB/s ± 1% 127MB/s ± 0% +0.76% (p=0.000 n=45+42) wuffs_gif_decode_1000k/gcc 129MB/s ± 1% 130MB/s ± 1% +0.89% (p=0.000 n=46+44)
This commit is contained in:
1 parent
3c3e6fc2fa
commit
c723329263
2 files changed
-116
No files matched your search
@@ -3626,74 +3626,12 @@ static wuffs_gif__status wuffs_gif__decoder__copy_to_image_buffer(
|
||||
uint32_t v_n;
|
||||
uint32_t v_new_ri;
|
||||
wuffs_base__table_u8 v_tab;
|
||||
uint64_t v_i;
|
||||
|
||||
v_dst = ((wuffs_base__slice_u8){});
|
||||
v_src = ((wuffs_base__slice_u8){});
|
||||
v_n = 0;
|
||||
v_new_ri = 0;
|
||||
v_tab = wuffs_base__image_buffer__plane(a_ib, 0);
|
||||
if (!self->private_impl.f_interlace &&
|
||||
(((uint64_t)(v_tab.width)) == ((uint64_t)(v_tab.stride))) &&
|
||||
(self->private_impl.f_dst_x0 == 0) &&
|
||||
(((uint64_t)(self->private_impl.f_dst_x1)) ==
|
||||
((uint64_t)(v_tab.width))) &&
|
||||
(((uint64_t)(self->private_impl.f_dst_y1)) <=
|
||||
((uint64_t)(v_tab.height)))) {
|
||||
if (self->private_impl.f_uncompressed_ri >
|
||||
self->private_impl.f_uncompressed_wi) {
|
||||
status = WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_RI_WI;
|
||||
goto exit;
|
||||
}
|
||||
v_src = wuffs_base__slice_u8__subslice_ij(
|
||||
((wuffs_base__slice_u8){.ptr = self->private_impl.f_uncompressed,
|
||||
.len = 4096}),
|
||||
self->private_impl.f_uncompressed_ri,
|
||||
self->private_impl.f_uncompressed_wi);
|
||||
if (self->private_impl.f_dst_y >= self->private_impl.f_dst_y1) {
|
||||
status = WUFFS_GIF__ERROR_TOO_MUCH_PIXEL_DATA;
|
||||
goto exit;
|
||||
}
|
||||
v_i = 0;
|
||||
v_dst = wuffs_base__table_u8__linearize(v_tab);
|
||||
v_i = (((uint64_t)(self->private_impl.f_dst_y1)) *
|
||||
((uint64_t)(self->private_impl.f_dst_x1)));
|
||||
if (v_i < ((uint64_t)(v_dst.len))) {
|
||||
v_dst = wuffs_base__slice_u8__subslice_j(v_dst, v_i);
|
||||
}
|
||||
v_i = ((((uint64_t)(self->private_impl.f_dst_y)) *
|
||||
((uint64_t)(self->private_impl.f_dst_x1))) +
|
||||
((uint64_t)(self->private_impl.f_dst_x)));
|
||||
if (v_i < ((uint64_t)(v_dst.len))) {
|
||||
v_dst = wuffs_base__slice_u8__subslice_i(v_dst, v_i);
|
||||
v_n = ((uint32_t)(
|
||||
(wuffs_base__slice_u8__copy_from_slice(v_dst, v_src) & 4294967295)));
|
||||
v_new_ri =
|
||||
wuffs_base__u32__sat_add(self->private_impl.f_uncompressed_ri, v_n);
|
||||
self->private_impl.f_uncompressed_ri =
|
||||
wuffs_base__u32__min(v_new_ri, 4096);
|
||||
wuffs_base__u64__sat_add_indirect(&v_i, ((uint64_t)(v_n)));
|
||||
if (((uint64_t)(v_tab.width)) <= 0) {
|
||||
status = WUFFS_GIF__ERROR_TOO_MUCH_PIXEL_DATA;
|
||||
goto exit;
|
||||
}
|
||||
self->private_impl.f_dst_x =
|
||||
((uint32_t)(((v_i % ((uint64_t)(v_tab.width))) & 4294967295)));
|
||||
self->private_impl.f_dst_y =
|
||||
((uint32_t)(((v_i / ((uint64_t)(v_tab.width))) & 4294967295)));
|
||||
}
|
||||
if (self->private_impl.f_uncompressed_ri ==
|
||||
self->private_impl.f_uncompressed_wi) {
|
||||
self->private_impl.f_uncompressed_ri = 0;
|
||||
self->private_impl.f_uncompressed_wi = 0;
|
||||
} else if (self->private_impl.f_uncompressed_ri >
|
||||
self->private_impl.f_uncompressed_wi) {
|
||||
status = WUFFS_GIF__ERROR_INTERNAL_ERROR_INCONSISTENT_RI_WI;
|
||||
goto exit;
|
||||
}
|
||||
status = WUFFS_GIF__STATUS_OK;
|
||||
goto ok;
|
||||
}
|
||||
label_0_continue:;
|
||||
while (self->private_impl.f_uncompressed_wi >
|
||||
self->private_impl.f_uncompressed_ri) {
|
||||
@@ -3767,9 +3705,6 @@ label_0_continue:;
|
||||
label_0_break:;
|
||||
self->private_impl.f_uncompressed_ri = 0;
|
||||
self->private_impl.f_uncompressed_wi = 0;
|
||||
|
||||
goto ok;
|
||||
ok:
|
||||
goto exit;
|
||||
exit:
|
||||
return status;
|
||||
|
||||
Reference in new issue
Block a user