Add std/png choose-funcs for filter_distance == 3

wuffs_png_decode_19k_8bpp/clang9          93.4MB/s ± 0%  95.5MB/s ± 0%   +2.26%  (p=0.008 n=5+5)
wuffs_png_decode_40k_24bpp/clang9          115MB/s ± 0%   125MB/s ± 0%   +7.87%  (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/clang9           351MB/s ± 0%   357MB/s ± 0%   +1.71%  (p=0.016 n=4+5)
wuffs_png_decode_552k_32bpp/clang9         156MB/s ± 0%   156MB/s ± 1%     ~     (p=0.690 n=5+5)
wuffs_png_decode_4002k_24bpp/clang9        118MB/s ± 0%   124MB/s ± 1%   +5.12%  (p=0.008 n=5+5)

wuffs_png_decode_filter_1_sub/clang9      1.24GB/s ± 0%  1.25GB/s ± 0%   +0.46%  (p=0.008 n=5+5)
wuffs_png_decode_filter_2_up/clang9       13.4GB/s ± 0%  13.3GB/s ± 1%   -0.65%  (p=0.008 n=5+5)
wuffs_png_decode_filter_3_average/clang9   948MB/s ± 0%   948MB/s ± 0%     ~     (p=0.151 n=5+5)
wuffs_png_decode_filter_4_paeth/clang9     138MB/s ± 0%   138MB/s ± 0%     ~     (p=0.151 n=5+5)

wuffs_png_decode_19k_8bpp/gcc10            100MB/s ± 0%    98MB/s ± 0%   -2.07%  (p=0.008 n=5+5)
wuffs_png_decode_40k_24bpp/gcc10           118MB/s ± 0%   127MB/s ± 0%   +7.39%  (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/gcc10            325MB/s ± 0%   319MB/s ± 0%   -1.92%  (p=0.008 n=5+5)
wuffs_png_decode_552k_32bpp/gcc10          172MB/s ± 0%   171MB/s ± 0%   -0.69%  (p=0.008 n=5+5)
wuffs_png_decode_4002k_24bpp/gcc10         118MB/s ± 0%   126MB/s ± 0%   +6.53%  (p=0.008 n=5+5)

wuffs_png_decode_filter_1_sub/gcc10       1.85GB/s ± 0%  1.84GB/s ± 0%   -0.16%  (p=0.008 n=5+5)
wuffs_png_decode_filter_2_up/gcc10        10.5GB/s ± 0%   8.2GB/s ± 0%  -22.09%  (p=0.008 n=5+5)
wuffs_png_decode_filter_3_average/gcc10   1.01GB/s ± 0%  1.01GB/s ± 0%   +0.18%  (p=0.008 n=5+5)
wuffs_png_decode_filter_4_paeth/gcc10     94.1MB/s ± 0%  94.0MB/s ± 0%     ~     (p=0.690 n=5+5)
This commit is contained in:
Nigel Tao committed 2021-01-07 23:47:55 +11:00
1 parent dcdd7928c1
commit c86add25f7
3 files changed
+371 -1

No files matched your search

+220
View File
@@ -29850,6 +29850,11 @@ wuffs_png__decoder__filter_1__choosy_default(
wuffs_png__decoder* self,
wuffs_base__slice_u8 a_curr);
static wuffs_base__empty_struct
wuffs_png__decoder__filter_1_distance_3_fallback(
wuffs_png__decoder* self,
wuffs_base__slice_u8 a_curr);
static wuffs_base__empty_struct
wuffs_png__decoder__filter_1_distance_4_fallback(
wuffs_png__decoder* self,
@@ -29879,6 +29884,12 @@ wuffs_png__decoder__filter_3__choosy_default(
wuffs_base__slice_u8 a_curr,
wuffs_base__slice_u8 a_prev);
static wuffs_base__empty_struct
wuffs_png__decoder__filter_3_distance_3_fallback(
wuffs_png__decoder* self,
wuffs_base__slice_u8 a_curr,
wuffs_base__slice_u8 a_prev);
static wuffs_base__empty_struct
wuffs_png__decoder__filter_3_distance_4_fallback(
wuffs_png__decoder* self,
@@ -29897,6 +29908,12 @@ wuffs_png__decoder__filter_4__choosy_default(
wuffs_base__slice_u8 a_curr,
wuffs_base__slice_u8 a_prev);
static wuffs_base__empty_struct
wuffs_png__decoder__filter_4_distance_3_fallback(
wuffs_png__decoder* self,
wuffs_base__slice_u8 a_curr,
wuffs_base__slice_u8 a_prev);
static wuffs_base__empty_struct
wuffs_png__decoder__filter_4_distance_4_fallback(
wuffs_png__decoder* self,
@@ -30077,6 +30094,35 @@ wuffs_png__decoder__filter_1__choosy_default(
return wuffs_base__make_empty_struct();
}
// -------- func png.decoder.filter_1_distance_3_fallback
static wuffs_base__empty_struct
wuffs_png__decoder__filter_1_distance_3_fallback(
wuffs_png__decoder* self,
wuffs_base__slice_u8 a_curr) {
wuffs_base__slice_u8 v_c = {0};
uint8_t v_fa0 = 0;
uint8_t v_fa1 = 0;
uint8_t v_fa2 = 0;
{
wuffs_base__slice_u8 i_slice_c = a_curr;
v_c = i_slice_c;
v_c.len = 3;
uint8_t* i_end0_c = i_slice_c.ptr + (i_slice_c.len / 3) * 3;
while (v_c.ptr < i_end0_c) {
v_fa0 += v_c.ptr[0];
v_c.ptr[0] = v_fa0;
v_fa1 += v_c.ptr[1];
v_c.ptr[1] = v_fa1;
v_fa2 += v_c.ptr[2];
v_c.ptr[2] = v_fa2;
v_c.ptr += 3;
}
}
return wuffs_base__make_empty_struct();
}
// -------- func png.decoder.filter_1_distance_4_fallback
static wuffs_base__empty_struct
@@ -30178,6 +30224,60 @@ wuffs_png__decoder__filter_3__choosy_default(
return wuffs_base__make_empty_struct();
}
// -------- func png.decoder.filter_3_distance_3_fallback
static wuffs_base__empty_struct
wuffs_png__decoder__filter_3_distance_3_fallback(
wuffs_png__decoder* self,
wuffs_base__slice_u8 a_curr,
wuffs_base__slice_u8 a_prev) {
wuffs_base__slice_u8 v_c = {0};
wuffs_base__slice_u8 v_p = {0};
uint8_t v_fa0 = 0;
uint8_t v_fa1 = 0;
uint8_t v_fa2 = 0;
if (((uint64_t)(a_prev.len)) == 0) {
{
wuffs_base__slice_u8 i_slice_c = a_curr;
v_c = i_slice_c;
v_c.len = 3;
uint8_t* i_end0_c = i_slice_c.ptr + (i_slice_c.len / 3) * 3;
while (v_c.ptr < i_end0_c) {
v_fa0 = ((v_fa0 / 2) + v_c.ptr[0]);
v_c.ptr[0] = v_fa0;
v_fa1 = ((v_fa1 / 2) + v_c.ptr[1]);
v_c.ptr[1] = v_fa1;
v_fa2 = ((v_fa2 / 2) + v_c.ptr[2]);
v_c.ptr[2] = v_fa2;
v_c.ptr += 3;
}
}
} else {
{
wuffs_base__slice_u8 i_slice_c = a_curr;
v_c = i_slice_c;
wuffs_base__slice_u8 i_slice_p = a_prev;
v_p = i_slice_p;
i_slice_c.len = wuffs_base__u64__min(i_slice_c.len, i_slice_p.len);
v_c.len = 3;
v_p.len = 3;
uint8_t* i_end0_c = i_slice_c.ptr + (i_slice_c.len / 3) * 3;
while (v_c.ptr < i_end0_c) {
v_fa0 = (((uint8_t)(((((uint32_t)(v_fa0)) + ((uint32_t)(v_p.ptr[0]))) / 2))) + v_c.ptr[0]);
v_c.ptr[0] = v_fa0;
v_fa1 = (((uint8_t)(((((uint32_t)(v_fa1)) + ((uint32_t)(v_p.ptr[1]))) / 2))) + v_c.ptr[1]);
v_c.ptr[1] = v_fa1;
v_fa2 = (((uint8_t)(((((uint32_t)(v_fa2)) + ((uint32_t)(v_p.ptr[2]))) / 2))) + v_c.ptr[2]);
v_c.ptr[2] = v_fa2;
v_c.ptr += 3;
v_p.ptr += 3;
}
}
}
return wuffs_base__make_empty_struct();
}
// -------- func png.decoder.filter_3_distance_4_fallback
static wuffs_base__empty_struct
@@ -30300,6 +30400,123 @@ wuffs_png__decoder__filter_4__choosy_default(
return wuffs_base__make_empty_struct();
}
// -------- func png.decoder.filter_4_distance_3_fallback
static wuffs_base__empty_struct
wuffs_png__decoder__filter_4_distance_3_fallback(
wuffs_png__decoder* self,
wuffs_base__slice_u8 a_curr,
wuffs_base__slice_u8 a_prev) {
wuffs_base__slice_u8 v_c = {0};
wuffs_base__slice_u8 v_p = {0};
uint32_t v_fa0 = 0;
uint32_t v_fa1 = 0;
uint32_t v_fa2 = 0;
uint32_t v_fb0 = 0;
uint32_t v_fb1 = 0;
uint32_t v_fb2 = 0;
uint32_t v_fc0 = 0;
uint32_t v_fc1 = 0;
uint32_t v_fc2 = 0;
uint32_t v_pp0 = 0;
uint32_t v_pp1 = 0;
uint32_t v_pp2 = 0;
uint32_t v_pa0 = 0;
uint32_t v_pa1 = 0;
uint32_t v_pa2 = 0;
uint32_t v_pb0 = 0;
uint32_t v_pb1 = 0;
uint32_t v_pb2 = 0;
uint32_t v_pc0 = 0;
uint32_t v_pc1 = 0;
uint32_t v_pc2 = 0;
{
wuffs_base__slice_u8 i_slice_c = a_curr;
v_c = i_slice_c;
wuffs_base__slice_u8 i_slice_p = a_prev;
v_p = i_slice_p;
i_slice_c.len = wuffs_base__u64__min(i_slice_c.len, i_slice_p.len);
v_c.len = 3;
v_p.len = 3;
uint8_t* i_end0_c = i_slice_c.ptr + (i_slice_c.len / 3) * 3;
while (v_c.ptr < i_end0_c) {
v_fb0 = ((uint32_t)(v_p.ptr[0]));
v_pp0 = ((v_fa0 + v_fb0) - v_fc0);
v_pa0 = (v_pp0 - v_fa0);
if (v_pa0 >= 2147483648) {
v_pa0 = (0 - v_pa0);
}
v_pb0 = (v_pp0 - v_fb0);
if (v_pb0 >= 2147483648) {
v_pb0 = (0 - v_pb0);
}
v_pc0 = (v_pp0 - v_fc0);
if (v_pc0 >= 2147483648) {
v_pc0 = (0 - v_pc0);
}
if ((v_pa0 <= v_pb0) && (v_pa0 <= v_pc0)) {
} else if (v_pb0 <= v_pc0) {
v_fa0 = v_fb0;
} else {
v_fa0 = v_fc0;
}
v_c.ptr[0] += ((uint8_t)((v_fa0 & 255)));
v_fa0 = ((uint32_t)(v_c.ptr[0]));
v_fc0 = v_fb0;
v_fb1 = ((uint32_t)(v_p.ptr[1]));
v_pp1 = ((v_fa1 + v_fb1) - v_fc1);
v_pa1 = (v_pp1 - v_fa1);
if (v_pa1 >= 2147483648) {
v_pa1 = (0 - v_pa1);
}
v_pb1 = (v_pp1 - v_fb1);
if (v_pb1 >= 2147483648) {
v_pb1 = (0 - v_pb1);
}
v_pc1 = (v_pp1 - v_fc1);
if (v_pc1 >= 2147483648) {
v_pc1 = (0 - v_pc1);
}
if ((v_pa1 <= v_pb1) && (v_pa1 <= v_pc1)) {
} else if (v_pb1 <= v_pc1) {
v_fa1 = v_fb1;
} else {
v_fa1 = v_fc1;
}
v_c.ptr[1] += ((uint8_t)((v_fa1 & 255)));
v_fa1 = ((uint32_t)(v_c.ptr[1]));
v_fc1 = v_fb1;
v_fb2 = ((uint32_t)(v_p.ptr[2]));
v_pp2 = ((v_fa2 + v_fb2) - v_fc2);
v_pa2 = (v_pp2 - v_fa2);
if (v_pa2 >= 2147483648) {
v_pa2 = (0 - v_pa2);
}
v_pb2 = (v_pp2 - v_fb2);
if (v_pb2 >= 2147483648) {
v_pb2 = (0 - v_pb2);
}
v_pc2 = (v_pp2 - v_fc2);
if (v_pc2 >= 2147483648) {
v_pc2 = (0 - v_pc2);
}
if ((v_pa2 <= v_pb2) && (v_pa2 <= v_pc2)) {
} else if (v_pb2 <= v_pc2) {
v_fa2 = v_fb2;
} else {
v_fa2 = v_fc2;
}
v_c.ptr[2] += ((uint8_t)((v_fa2 & 255)));
v_fa2 = ((uint32_t)(v_c.ptr[2]));
v_fc2 = v_fb2;
v_c.ptr += 3;
v_p.ptr += 3;
}
}
return wuffs_base__make_empty_struct();
}
// -------- func png.decoder.filter_4_distance_4_fallback
static wuffs_base__empty_struct
@@ -30930,6 +31147,9 @@ static wuffs_base__empty_struct
wuffs_png__decoder__choose_filter_implementations(
wuffs_png__decoder* self) {
if (self->private_impl.f_filter_distance == 3) {
self->private_impl.choosy_filter_1 = &wuffs_png__decoder__filter_1_distance_3_fallback;
self->private_impl.choosy_filter_3 = &wuffs_png__decoder__filter_3_distance_3_fallback;
self->private_impl.choosy_filter_4 = &wuffs_png__decoder__filter_4_distance_3_fallback;
} else if (self->private_impl.f_filter_distance == 4) {
self->private_impl.choosy_filter_1 = &wuffs_png__decoder__filter_1_distance_4_fallback;
self->private_impl.choosy_filter_3 = &wuffs_png__decoder__filter_3_distance_4_fallback;