aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/riscv/lpc_init.c
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi@remlab.net>2023-12-08 17:42:22 +0200
committerRémi Denis-Courmont <remi@remlab.net>2023-12-11 18:17:43 +0200
commit272d0c164d990cafc52a43bbceb1fc0445a2d22c (patch)
tree27f720192cf6b9227301faf71f6c9cab0e6011d0 /libavcodec/riscv/lpc_init.c
parent341a483b0868d30d17bf8d5e82facb5e0944a6fe (diff)
downloadffmpeg-272d0c164d990cafc52a43bbceb1fc0445a2d22c.tar.gz
lavc/lpc: R-V V apply_welch_window
apply_welch_window_even_c: 617.5 apply_welch_window_even_rvv_f64: 235.0 apply_welch_window_odd_c: 709.0 apply_welch_window_odd_rvv_f64: 256.5
Diffstat (limited to 'libavcodec/riscv/lpc_init.c')
-rw-r--r--libavcodec/riscv/lpc_init.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/libavcodec/riscv/lpc_init.c b/libavcodec/riscv/lpc_init.c
new file mode 100644
index 0000000000..c16e5745f0
--- /dev/null
+++ b/libavcodec/riscv/lpc_init.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2022 Rémi Denis-Courmont.
+ *
+ * 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
+ */
+
+#include "config.h"
+
+#include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavcodec/lpc.h"
+
+void ff_lpc_apply_welch_window_rvv(const int32_t *, ptrdiff_t, double *);
+
+av_cold void ff_lpc_init_riscv(LPCContext *c)
+{
+#if HAVE_RVV && (__riscv_xlen >= 64)
+ int flags = av_get_cpu_flags();
+
+ if ((flags & AV_CPU_FLAG_RVV_F64) && (flags & AV_CPU_FLAG_RVB_ADDR))
+ c->lpc_apply_welch_window = ff_lpc_apply_welch_window_rvv;
+#endif
+}