OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 namespace { // See Sk4px.h | 8 namespace { // See Sk4px.h |
9 | 9 |
10 inline Sk4px Sk4px::DupPMColor(SkPMColor px) { return Sk16b((uint8x16_t)vdupq_n_
u32(px)); } | 10 inline Sk4px Sk4px::DupPMColor(SkPMColor px) { return Sk16b((uint8x16_t)vdupq_n_
u32(px)); } |
(...skipping 22 matching lines...) Expand all Loading... |
33 inline Sk4px::Wide Sk4px::widenLo() const { | 33 inline Sk4px::Wide Sk4px::widenLo() const { |
34 return Sk16h(vmovl_u8(vget_low_u8 (this->fVec)), | 34 return Sk16h(vmovl_u8(vget_low_u8 (this->fVec)), |
35 vmovl_u8(vget_high_u8(this->fVec))); | 35 vmovl_u8(vget_high_u8(this->fVec))); |
36 } | 36 } |
37 | 37 |
38 inline Sk4px::Wide Sk4px::widenHi() const { | 38 inline Sk4px::Wide Sk4px::widenHi() const { |
39 return Sk16h(vshll_n_u8(vget_low_u8 (this->fVec), 8), | 39 return Sk16h(vshll_n_u8(vget_low_u8 (this->fVec), 8), |
40 vshll_n_u8(vget_high_u8(this->fVec), 8)); | 40 vshll_n_u8(vget_high_u8(this->fVec), 8)); |
41 } | 41 } |
42 | 42 |
| 43 inline Sk4px::Wide Sk4px::widenLoHi() const { |
| 44 auto zipped = vzipq_u8(this->fVec, this->fVec); |
| 45 return Sk16h((uint16x8_t)zipped.val[0], |
| 46 (uint16x8_t)zipped.val[1]); |
| 47 } |
| 48 |
43 inline Sk4px::Wide Sk4px::mulWiden(const Sk16b& other) const { | 49 inline Sk4px::Wide Sk4px::mulWiden(const Sk16b& other) const { |
44 return Sk16h(vmull_u8(vget_low_u8 (this->fVec), vget_low_u8 (other.fVec)), | 50 return Sk16h(vmull_u8(vget_low_u8 (this->fVec), vget_low_u8 (other.fVec)), |
45 vmull_u8(vget_high_u8(this->fVec), vget_high_u8(other.fVec))); | 51 vmull_u8(vget_high_u8(this->fVec), vget_high_u8(other.fVec))); |
46 } | 52 } |
47 | 53 |
48 inline Sk4px Sk4px::Wide::addNarrowHi(const Sk16h& other) const { | 54 inline Sk4px Sk4px::Wide::addNarrowHi(const Sk16h& other) const { |
49 const Sk4px::Wide o(other); // Should be no code, but allows us to access f
Lo, fHi. | 55 const Sk4px::Wide o(other); // Should be no code, but allows us to access f
Lo, fHi. |
50 return Sk16b(vcombine_u8(vaddhn_u16(this->fLo.fVec, o.fLo.fVec), | 56 return Sk16b(vcombine_u8(vaddhn_u16(this->fLo.fVec, o.fLo.fVec), |
51 vaddhn_u16(this->fHi.fVec, o.fHi.fVec))); | 57 vaddhn_u16(this->fHi.fVec, o.fHi.fVec))); |
52 } | 58 } |
(...skipping 25 matching lines...) Expand all Loading... |
78 return Sk16b(vandq_u8(this->fVec, (uint8x16_t)vdupq_n_u32(0xFF << SK_A32_SHI
FT))); | 84 return Sk16b(vandq_u8(this->fVec, (uint8x16_t)vdupq_n_u32(0xFF << SK_A32_SHI
FT))); |
79 } | 85 } |
80 | 86 |
81 inline Sk4px Sk4px::zeroAlphas() const { | 87 inline Sk4px Sk4px::zeroAlphas() const { |
82 // vbic(a,b) == a & ~b | 88 // vbic(a,b) == a & ~b |
83 return Sk16b(vbicq_u8(this->fVec, (uint8x16_t)vdupq_n_u32(0xFF << SK_A32_SHI
FT))); | 89 return Sk16b(vbicq_u8(this->fVec, (uint8x16_t)vdupq_n_u32(0xFF << SK_A32_SHI
FT))); |
84 } | 90 } |
85 | 91 |
86 } // namespace | 92 } // namespace |
87 | 93 |
OLD | NEW |