* [FFmpeg-devel] [PATCH 1/1] lavc/huffyuvdsp: basic R-V V add_hfyu_left_pred_bgr32
@ 2023-11-12 13:42 Rémi Denis-Courmont
0 siblings, 0 replies; only message in thread
From: Rémi Denis-Courmont @ 2023-11-12 13:42 UTC (permalink / raw)
To: ffmpeg-devel
Better performance can probably be achieved with a more intricate
unrolled loop, but this is a start:
add_hfyu_left_pred_bgr32_c: 15084.0
add_hfyu_left_pred_bgr32_rvv_i32: 10280.2
This would actually be cleaner with the RISC-V P extension, but that is
not ratified yet (I think?) and usually not supported if V is supported.
---
libavcodec/riscv/huffyuvdsp_init.c | 6 +++++-
libavcodec/riscv/huffyuvdsp_rvv.S | 16 ++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/libavcodec/riscv/huffyuvdsp_init.c b/libavcodec/riscv/huffyuvdsp_init.c
index 115b25881c..b49b3dc097 100644
--- a/libavcodec/riscv/huffyuvdsp_init.c
+++ b/libavcodec/riscv/huffyuvdsp_init.c
@@ -24,6 +24,8 @@
#include "libavcodec/huffyuvdsp.h"
void ff_add_int16_rvv(uint16_t *dst, const uint16_t *src, unsigned m, int w);
+void ff_add_hfyu_left_pred_bgr32_rvv(uint8_t *dst, const uint8_t *src,
+ intptr_t w, uint8_t *left);
av_cold void ff_huffyuvdsp_init_riscv(HuffYUVDSPContext *c,
enum AVPixelFormat pix_fmt)
@@ -31,7 +33,9 @@ av_cold void ff_huffyuvdsp_init_riscv(HuffYUVDSPContext *c,
#if HAVE_RVV
int flags = av_get_cpu_flags();
- if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR))
+ if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) {
c->add_int16 = ff_add_int16_rvv;
+ c->add_hfyu_left_pred_bgr32 = ff_add_hfyu_left_pred_bgr32_rvv;
+ }
#endif
}
diff --git a/libavcodec/riscv/huffyuvdsp_rvv.S b/libavcodec/riscv/huffyuvdsp_rvv.S
index f8926fdaea..9c4434907d 100644
--- a/libavcodec/riscv/huffyuvdsp_rvv.S
+++ b/libavcodec/riscv/huffyuvdsp_rvv.S
@@ -35,3 +35,19 @@ func ff_add_int16_rvv, zve32x
ret
endfunc
+
+func ff_add_hfyu_left_pred_bgr32_rvv, zve32x
+ vsetivli zero, 4, e8, m1, ta, ma
+ vle8.v v8, (a3)
+ sh2add a2, a2, a1
+1:
+ vle8.v v0, (a1)
+ vadd.vv v8, v8, v0
+ addi a1, a1, 4
+ vse8.v v8, (a0)
+ addi a0, a0, 4
+ bne a2, a1, 1b
+
+ vse8.v v8, (a3)
+ ret
+endfunc
--
2.42.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-12 13:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12 13:42 [FFmpeg-devel] [PATCH 1/1] lavc/huffyuvdsp: basic R-V V add_hfyu_left_pred_bgr32 Rémi Denis-Courmont
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git