PR #22376 opened by Zhanheng.Yang
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22376
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22376.patch

Signed-off-by: zhanheng.yang <[email protected]>


>From 8f25f97e04a0bc0ee768636e1d84c79bd0a19a8d Mon Sep 17 00:00:00 2001
From: "zhanheng.yang" <[email protected]>
Date: Wed, 21 Jan 2026 15:01:39 +0800
Subject: [PATCH] libavutil/intreadwrite: add RVV optimized for
 AV_COPY128/AV_COPY128U/AV_ZERO128.

Signed-off-by: zhanheng.yang <[email protected]>
---
 libavutil/intreadwrite.h       |  2 ++
 libavutil/riscv/intreadwrite.h | 47 ++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
 create mode 100644 libavutil/riscv/intreadwrite.h

diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
index ffd15a1502..3f5e42d90e 100644
--- a/libavutil/intreadwrite.h
+++ b/libavutil/intreadwrite.h
@@ -72,6 +72,8 @@ typedef union {
 #   include "ppc/intreadwrite.h"
 #elif ARCH_X86
 #   include "x86/intreadwrite.h"
+#elif ARCH_RISCV
+#   include "riscv/intreadwrite.h"
 #endif
 
 #endif /* HAVE_AV_CONFIG_H */
diff --git a/libavutil/riscv/intreadwrite.h b/libavutil/riscv/intreadwrite.h
new file mode 100644
index 0000000000..3ff3e0fb10
--- /dev/null
+++ b/libavutil/riscv/intreadwrite.h
@@ -0,0 +1,47 @@
+ /*
+ * Copyright (C) 2026 Alibaba Group Holding Limited.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#ifndef AVUTIL_RISCV_INTREADWRITE_H
+#define AVUTIL_RISCV_INTREADWRITE_H
+
+#if HAVE_RVV
+#include <riscv_vector.h>
+
+#define AV_COPY128 AV_COPY128
+static av_always_inline void AV_COPY128(void *d, const void *s)
+{
+    vuint8m1_t tmp = __riscv_vle8_v_u8m1((const uint8_t *)s, 16);
+    __riscv_vse8_v_u8m1((uint8_t *)d, tmp, 16);
+}
+
+#define AV_COPY128U AV_COPY128U
+static av_always_inline void AV_COPY128U(void *d, const void *s)
+{
+    vuint8m1_t tmp = __riscv_vle8_v_u8m1((const uint8_t *)s, 16);
+    __riscv_vse8_v_u8m1((uint8_t *)d, tmp, 16);
+}
+
+#define AV_ZERO128 AV_ZERO128
+static av_always_inline void AV_ZERO128(void *d)
+{
+    vuint8m1_t zero = __riscv_vmv_v_x_u8m1(0, 16);
+    __riscv_vse8_v_u8m1((uint8_t *)d, zero, 16);
+}
+#endif
+#endif
\ No newline at end of file
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to