@@ -22,7 +22,7 @@
#include "libavutil/bswap.h"
#include "bswapdsp.h"
-static void bswap_buf(uint32_t *dst, const uint32_t *src, int w)
+void ff_bswap32_buf(uint32_t *dst, const uint32_t *src, int w)
{
int i;
@@ -48,7 +48,7 @@ static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len)
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
{
- c->bswap_buf = bswap_buf;
+ c->bswap_buf = ff_bswap32_buf;
c->bswap16_buf = bswap16_buf;
#if ARCH_RISCV
@@ -30,4 +30,6 @@ void ff_bswapdsp_init(BswapDSPContext *c);
void ff_bswapdsp_init_riscv(BswapDSPContext *c);
void ff_bswapdsp_init_x86(BswapDSPContext *c);
+void ff_bswap32_buf(uint32_t *dst, const uint32_t *src, int w);
+
#endif /* AVCODEC_BSWAPDSP_H */
@@ -23,7 +23,9 @@
#if (__riscv_xlen >= 64)
func ff_bswap32_buf_rvb, zbb
+ andi t1, a1, 3
andi t0, a1, 4
+ bnez t1, 6f
beqz t0, 1f
/* Align a1 (input) to 64-bit */
lwu t0, (a1)
@@ -64,5 +66,8 @@ func ff_bswap32_buf_rvb, zbb
sw t0, -4(a0)
5:
ret
+
+6: /* No worthy optimisation if unaligned */
+ tail ff_bswap32_buf
endfunc
#endif