@@ -4,3 +4,5 @@ OBJS += aarch64/cpu.o \
NEON-OBJS += aarch64/float_dsp_neon.o \
aarch64/tx_float_neon.o \
+
+SVE-OBJS += aarch64/cpu_sve.o \
@@ -30,4 +30,8 @@
#define have_sve(flags) CPUEXT(flags, SVE)
#define have_sve2(flags) CPUEXT(flags, SVE2)
+#if HAVE_SVE
+int ff_aarch64_sve_length(void);
+#endif
+
#endif /* AVUTIL_AARCH64_CPU_H */
new file mode 100644
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2023 Martin Storsjo
+ *
+ * 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 "asm.S"
+
+ENABLE_SVE
+
+function ff_aarch64_sve_length, export=1
+ cntb x0
+ ret
+endfunc
@@ -23,6 +23,10 @@
#include "libavutil/cpu.h"
#include "libavutil/avstring.h"
+#if ARCH_AARCH64
+#include "libavutil/aarch64/cpu.h"
+#endif
+
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -161,6 +165,10 @@ int main(int argc, char **argv)
print_cpu_flags(cpu_flags_raw, "raw");
print_cpu_flags(cpu_flags_eff, "effective");
printf("threads = %s (cpu_count = %d)\n", threads, cpu_count);
+#if ARCH_AARCH64
+ if (cpu_flags_raw & AV_CPU_FLAG_SVE)
+ printf("sve_vector_length = %d\n", 8 * ff_aarch64_sve_length());
+#endif
return 0;
}