| // 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. |
| |
| // -------- |
| |
| // Filter 1: Sub. |
| |
| pri func decoder.filter_1_distance_4_sse128!(curr: slice base.u8), |
| choose cpu_arch >= sse128, |
| { |
| var c : slice base.u8 |
| var x32 : base.u32 |
| var x128 : base.sse128_i |
| var a128 : base.sse128_i |
| |
| iterate (c = args.curr)(length: 4, advance: 4, unroll: 1) { |
| x32 = ((c[0] as base.u32) << 0x00) | |
| ((c[1] as base.u32) << 0x08) | |
| ((c[2] as base.u32) << 0x10) | |
| ((c[3] as base.u32) << 0x18) |
| x128.load_u32!(a: x32) |
| |
| x128 = x128._mm_add_epi8!(b: a128) |
| a128 = x128 |
| |
| x32 = x128.truncate_u32() |
| c[0] = (0xFF & (x32 >> 0x00)) as base.u8 |
| c[1] = (0xFF & (x32 >> 0x08)) as base.u8 |
| c[2] = (0xFF & (x32 >> 0x10)) as base.u8 |
| c[3] = (0xFF & (x32 >> 0x18)) as base.u8 |
| } |
| } |