History

lavu/riscv: count bytes rather than words for bswap32

This removes the dependency on Zba at essentially zero cost.

Rémi Denis-Courmont committed 2 years ago

Commit bd0c3ed1 parent 5171baa5 files · +13 −13Browse files

Unified · Split

5 files
  1. libavcodec/riscv/bswapdsp_init.c +4 −4
  2. libavcodec/riscv/bswapdsp_rvb.S +2 −1
  3. libavutil/riscv/bswap_rvb.S +5 −5
  4. libswscale/riscv/rgb2rgb.c +1 −1
  5. libswscale/riscv/rgb2rgb_rvb.S +1 −2
libavcodec/riscv/bswapdsp_init.c+4−4
@@ -33,15 +33,15 @@ av_cold void ff_bswapdsp_init_riscv(BswapDSPContext *c) · 32 unmodified lines
3333 #if HAVE_RV
3434 int flags = av_get_cpu_flags();
3535
36− if (flags & AV_CPU_FLAG_RVB_ADDR) {
3736 #if (__riscv_xlen >= 64)
38− if (flags & AV_CPU_FLAG_RVB_BASIC)
39− c->bswap_buf = ff_bswap32_buf_rvb;
37+ if (flags & AV_CPU_FLAG_RVB_BASIC)
38+ c->bswap_buf = ff_bswap32_buf_rvb;
4039 #endif
4140 #if HAVE_RVV
41+ if (flags & AV_CPU_FLAG_RVB_ADDR) {
4242 if (flags & AV_CPU_FLAG_RVV_I32)
4343 c->bswap16_buf = ff_bswap16_buf_rvv;
44−#endif
4544 }
4645 #endif
46+#endif
4747 }
libavcodec/riscv/bswapdsp_rvb.S+2−1
@@ -23,8 +23,9 @@ · 22 unmodified lines
2323 #include "libavutil/riscv/bswap_rvb.S"
2424
2525 #if (__riscv_xlen >= 64)
26−func ff_bswap32_buf_rvb, zba, zbb
26+func ff_bswap32_buf_rvb, zbb
2727 lpad 0
28+ slli a2, a2, 2
2829 bswap32_rvb a0, a1, a2
2930 endfunc
3031 #endif
libavutil/riscv/bswap_rvb.S+5−5
@@ -20,21 +20,21 @@ · 19 unmodified lines
2020
2121 #if (__riscv_xlen >= 64)
2222 .macro bswap32_rvb out, in, count
23− andi t0, \count, 4
23+ andi t0, \count, 1
2424 beqz t0, 1f
2525 /* Align input to 64-bit */
2626 lwu t0, (\in)
2727 addi \out, \out, 4
2828 rev8 t0, t0
29− addi \count, \count, -1
29+ addi \count, \count, -4
3030 srli t0, t0, __riscv_xlen - 32
3131 addi \in, \in, 4
3232 sw t0, -4(\out)
3333 1:
34− andi t3, \count, -2
35− sh2add \count, \count, \out
34+ andi t3, \count, -8
35+ add \count, \count, \out
3636 beqz t3, 3f
37− sh2add t3, t3, \out
37+ add t3, t3, \out
3838 2: /* 2 elements (64 bits) at a time on a 64-bit boundary */
3939 ld t0, (\in)
4040 addi \out, \out, 8
libswscale/riscv/rgb2rgb.c+1−1
@@ -46,7 +46,7 @@ av_cold void rgb2rgb_init_riscv(void) · 45 unmodified lines
4646 int flags = av_get_cpu_flags();
4747
4848 #if (__riscv_xlen == 64)
49− if ((flags & AV_CPU_FLAG_RVB_BASIC) && (flags & AV_CPU_FLAG_RVB_ADDR))
49+ if (flags & AV_CPU_FLAG_RVB_BASIC)
5050 shuffle_bytes_3210 = ff_shuffle_bytes_3210_rvb;
5151 #endif
5252 #if HAVE_RVV
libswscale/riscv/rgb2rgb_rvb.S+1−2
@@ -23,9 +23,8 @@ · 22 unmodified lines
2323 #include "libavutil/riscv/bswap_rvb.S"
2424
2525 #if (__riscv_xlen >= 64)
26−func ff_shuffle_bytes_3210_rvb, zba, zbb
26+func ff_shuffle_bytes_3210_rvb, zbb
2727 lpad 0
28− srli a2, a2, 2
2928 bswap32_rvb a1, a0, a2
3029 endfunc
3130 #endif

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