mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Add std/png decoder.filter_1_distance_4_arm_neon
On a Raspberry Pi 4 (32-bit armv7l) with -march=native and -mfpu=neon
("native" means "armv8-a+crc+simd"):
wuffs_png_decode_filt_1_dist_4/clang9 1.09GB/s ± 1% 1.42GB/s ± 0% +30.50% (p=0.008 n=5+5)
wuffs_png_decode_filt_1_dist_4/gcc8 859MB/s ± 0% 891MB/s ± 0% +3.66% (p=0.008 n=5+5)
This commit is contained in:
1 parent
84f3592dbe
commit
435330494e
10 files changed
+187
-3
No files matched your search
@@ -0,0 +1,46 @@
|
||||
// Copyright 2021 The Wuffs Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// --------
|
||||
|
||||
// Compared to libpng's ARM NEON implementation, this implementation cannot
|
||||
// assume that the row pointers are 16-byte aligned. libpng allocates its own
|
||||
// buffers, Wuffs code cannot call malloc and instead uses whatever buffers it
|
||||
// is given. Wuffs also uncompresses the entire zlib stream into a continuous
|
||||
// array. Rows are therefore not necessarily padded to alignment boundaries,
|
||||
// especially considering the one additional filter byte per row.
|
||||
//
|
||||
// Wuffs' "cpu_arch >= arm_neon" requires __ARM_FEATURE_UNALIGNED but still, we
|
||||
// can't e.g. cast a uint8_t* to a uint32_t* without proving alignment.
|
||||
|
||||
// --------
|
||||
|
||||
// Filter 1: Sub.
|
||||
|
||||
pri func decoder.filter_1_distance_4_arm_neon!(curr: slice base.u8),
|
||||
choose cpu_arch >= arm_neon,
|
||||
{
|
||||
var c : slice base.u8
|
||||
var fa : base.arm_neon_64
|
||||
var fx : base.arm_neon_64
|
||||
|
||||
fa = fa.create_vdup_n_u32(a: 0)
|
||||
|
||||
iterate (c = args.curr)(length: 4, advance: 4, unroll: 2) {
|
||||
fx = fx.create_vdup_n_u32(a: c.peek_u32le())
|
||||
fx = fx.vadd_u8(b: fa)
|
||||
c.poke_u32le!(a: fx.vget_lane_u32(b: 0))
|
||||
fa = fx
|
||||
}
|
||||
}
|
||||
@@ -380,6 +380,7 @@ pri func decoder.choose_filter_implementations!() {
|
||||
filter_4_distance_3_fallback]
|
||||
} else if this.filter_distance == 4 {
|
||||
choose filter_1 = [
|
||||
filter_1_distance_4_arm_neon,
|
||||
filter_1_distance_4_sse42,
|
||||
filter_1_distance_4_fallback]
|
||||
choose filter_3 = [
|
||||
|
||||
Reference in new issue
Block a user