diff options
author | Bruce Lai <bruce.lai@sifive.com> | 2023-06-15 04:56:58 -0700 |
---|---|---|
committer | libyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-06-15 23:45:24 +0000 |
commit | 04821d1e7d60845525e8db55c7bcd41ef5be9406 (patch) | |
tree | 46b29e13d76928a8423b346d085eda3eb215e4bb /source/row_rvv.cc | |
parent | 552571e8b24b2619c39ec176e6cb8e75d3e7fdd3 (diff) | |
download | libyuv-04821d1e7d60845525e8db55c7bcd41ef5be9406.tar.gz |
[RVV] Enable ARGBExtractAlphaRow/ARGBCopyYToAlphaRow
* Run on SiFive internal FPGA:
TestARGBExtractAlpha(~3.2x vs scalar)
TestARGBCopyYToAlpha(~1.6x vs scalar)
Change-Id: I36525c67e8ac3f71ea9d1a58c7dc15a4009d9da1
Signed-off-by: Bruce Lai <bruce.lai@sifive.com>
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4617955
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/row_rvv.cc')
-rw-r--r-- | source/row_rvv.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/row_rvv.cc b/source/row_rvv.cc index 27e91a3b..a79560c7 100644 --- a/source/row_rvv.cc +++ b/source/row_rvv.cc @@ -948,6 +948,35 @@ void ARGBAttenuateRow_RVV(const uint8_t* src_argb, } while (w > 0); } +void ARGBExtractAlphaRow_RVV(const uint8_t* src_argb, + uint8_t* dst_a, + int width) { + size_t w = (size_t)width; + do { + size_t vl = __riscv_vsetvl_e8m2(w); + vuint8m2_t v_b, v_g, v_r, v_a; + __riscv_vlseg4e8_v_u8m2(&v_r, &v_g, &v_b, &v_a, src_argb, vl); + __riscv_vse8_v_u8m2(dst_a, v_a, vl); + w -= vl; + src_argb += vl * 4; + dst_a += vl; + } while (w > 0); +} + +void ARGBCopyYToAlphaRow_RVV(const uint8_t* src, uint8_t* dst, int width) { + size_t w = (size_t)width; + const ptrdiff_t dst_stride = 4; + dst += 3; + do { + size_t vl = __riscv_vsetvl_e8m8(w); + vuint8m8_t v_a = __riscv_vle8_v_u8m8(src, vl); + __riscv_vsse8_v_u8m8(dst, dst_stride, v_a, vl); + w -= vl; + src += vl; + dst += vl * dst_stride; + } while (w > 0); +} + #ifdef __cplusplus } // extern "C" } // namespace libyuv |