History

lavc/aacpsdsp: rework R-V V add_squares

Segmented loads may be slower than not. So this advantageously uses a unit-strided load and narrowing shifts instead. Before: ps_add_squares_c: 60757.7 ps_add_squares_rvv_f32: 22242.5 After: ps_add_squares_c: 60516.0 ps_add_squares_rvv_i64: 17067.7

Rémi Denis-Courmont committed 3 years ago

Commit eb508701 parent ab78d222 files · +8 −4Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/riscv/aacpsdsp_init.c +2 −1
  2. libavcodec/riscv/aacpsdsp_rvv.S +6 −3
libavcodec/riscv/aacpsdsp_init.c+2−1
@@ -46,7 +46,8 @@ av_cold void ff_psdsp_init_riscv(PSDSPContext *c) · 45 unmodified lines
4646 c->hybrid_analysis = ff_ps_hybrid_analysis_rvv;
4747
4848 if (flags & AV_CPU_FLAG_RVB_ADDR) {
49− c->add_squares = ff_ps_add_squares_rvv;
49+ if (flags & AV_CPU_FLAG_RVV_I64)
50+ c->add_squares = ff_ps_add_squares_rvv;
5051 c->mul_pair_single = ff_ps_mul_pair_single_rvv;
5152 c->stereo_interpolate[0] = ff_ps_stereo_interpolate_rvv;
5253 }
libavcodec/riscv/aacpsdsp_rvv.S+6−3
@@ -1,5 +1,5 @@
11 /*
2− * Copyright © 2022 Rémi Denis-Courmont.
2+ * Copyright © 2022-2023 Rémi Denis-Courmont.
33 *
44 * This file is part of FFmpeg.
55 *
@@ -20,13 +20,16 @@ · 14 unmodified lines
2020
2121 #include "libavutil/riscv/asm.S"
2222
23−func ff_ps_add_squares_rvv, zve32f
23+func ff_ps_add_squares_rvv, zve64f
24+ li t1, 32
2425 1:
2526 vsetvli t0, a2, e32, m4, ta, ma
26− vlseg2e32.v v24, (a1)
27+ vle64.v v8, (a1)
2728 sub a2, a2, t0
29+ vnsrl.wx v24, v8, zero
2830 vle32.v v16, (a0)
2931 sh3add a1, t0, a1
32+ vnsrl.wx v28, v8, t1
3033 vfmacc.vv v16, v24, v24
3134 vfmacc.vv v16, v28, v28
3235 vse32.v v16, (a0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t