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
33#if HAVE_RV33#if HAVE_RV
34 int flags = av_get_cpu_flags();34 int flags = av_get_cpu_flags();
35 35
36 if (flags & AV_CPU_FLAG_RVB_ADDR) {
37#if (__riscv_xlen >= 64)36#if (__riscv_xlen >= 64)
38 if (flags & AV_CPU_FLAG_RVB_BASIC)37 if (flags & AV_CPU_FLAG_RVB_BASIC)
39 c->bswap_buf = ff_bswap32_buf_rvb;38 c->bswap_buf = ff_bswap32_buf_rvb;
40#endif39#endif
41#if HAVE_RVV40#if HAVE_RVV
41 if (flags & AV_CPU_FLAG_RVB_ADDR) {
42 if (flags & AV_CPU_FLAG_RVV_I32)42 if (flags & AV_CPU_FLAG_RVV_I32)
43 c->bswap16_buf = ff_bswap16_buf_rvv;43 c->bswap16_buf = ff_bswap16_buf_rvv;
44#endif
45 }44 }
46#endif45#endif
46#endif
47}47}
libavcodec/riscv/bswapdsp_rvb.S+2−1
@@ -23,8 +23,9 @@ · 22 unmodified lines
23#include "libavutil/riscv/bswap_rvb.S"23#include "libavutil/riscv/bswap_rvb.S"
24 24
25#if (__riscv_xlen >= 64)25#if (__riscv_xlen >= 64)
26func ff_bswap32_buf_rvb, zba, zbb26func ff_bswap32_buf_rvb, zbb
27 lpad 027 lpad 0
28 slli a2, a2, 2
28 bswap32_rvb a0, a1, a229 bswap32_rvb a0, a1, a2
29endfunc30endfunc
30#endif31#endif
libavutil/riscv/bswap_rvb.S+5−5
@@ -20,21 +20,21 @@ · 19 unmodified lines
20 20
21#if (__riscv_xlen >= 64)21#if (__riscv_xlen >= 64)
22 .macro bswap32_rvb out, in, count22 .macro bswap32_rvb out, in, count
23 andi t0, \count, 423 andi t0, \count, 1
24 beqz t0, 1f24 beqz t0, 1f
25 /* Align input to 64-bit */25 /* Align input to 64-bit */
26 lwu t0, (\in)26 lwu t0, (\in)
27 addi \out, \out, 427 addi \out, \out, 4
28 rev8 t0, t028 rev8 t0, t0
29 addi \count, \count, -129 addi \count, \count, -4
30 srli t0, t0, __riscv_xlen - 3230 srli t0, t0, __riscv_xlen - 32
31 addi \in, \in, 431 addi \in, \in, 4
32 sw t0, -4(\out)32 sw t0, -4(\out)
331:331:
34 andi t3, \count, -234 andi t3, \count, -8
35 sh2add \count, \count, \out35 add \count, \count, \out
36 beqz t3, 3f36 beqz t3, 3f
37 sh2add t3, t3, \out37 add t3, t3, \out
382: /* 2 elements (64 bits) at a time on a 64-bit boundary */382: /* 2 elements (64 bits) at a time on a 64-bit boundary */
39 ld t0, (\in)39 ld t0, (\in)
40 addi \out, \out, 840 addi \out, \out, 8
libswscale/riscv/rgb2rgb.c+1−1
@@ -46,7 +46,7 @@ av_cold void rgb2rgb_init_riscv(void) · 45 unmodified lines
46 int flags = av_get_cpu_flags();46 int flags = av_get_cpu_flags();
47 47
48#if (__riscv_xlen == 64)48#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)
50 shuffle_bytes_3210 = ff_shuffle_bytes_3210_rvb;50 shuffle_bytes_3210 = ff_shuffle_bytes_3210_rvb;
51#endif51#endif
52#if HAVE_RVV52#if HAVE_RVV
libswscale/riscv/rgb2rgb_rvb.S+1−2
@@ -23,9 +23,8 @@ · 22 unmodified lines
23#include "libavutil/riscv/bswap_rvb.S"23#include "libavutil/riscv/bswap_rvb.S"
24 24
25#if (__riscv_xlen >= 64)25#if (__riscv_xlen >= 64)
26func ff_shuffle_bytes_3210_rvb, zba, zbb26func ff_shuffle_bytes_3210_rvb, zbb
27 lpad 027 lpad 0
28 srli a2, a2, 2
29 bswap32_rvb a1, a0, a228 bswap32_rvb a1, a0, a2
30endfunc29endfunc
31#endif30#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