aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/cpu.c
diff options
context:
space:
mode:
authorShiyou Yin <yinshiyou-hf@loongson.cn>2021-12-15 11:51:04 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2021-12-15 18:37:40 +0100
commit9a840ffa176038d44e0197283590f891b2cf9eeb (patch)
tree0ffdbc383bd1bdd8a7af3963c27e7ff7999d3f02 /libavutil/cpu.c
parent571e8ca2ddb90a05e0e0091110f8aeed78620edd (diff)
downloadffmpeg-9a840ffa176038d44e0197283590f891b2cf9eeb.tar.gz
avutil: [loongarch] Add support for loongarch SIMD.
LSX and LASX is loongarch SIMD extention. They are enabled by default if compiler support it, and can be disabled with '--disable-lsx' '--disable-lasx'. Change-Id: Ie2608ea61dbd9b7fffadbf0ec2348bad6c124476 Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn> Reviewed-by: guxiwei <guxiwei-hf@loongson.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/cpu.c')
-rw-r--r--libavutil/cpu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 4627af4f23..63efb97ffd 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -62,6 +62,8 @@ static int get_cpu_flags(void)
return ff_get_cpu_flags_ppc();
if (ARCH_X86)
return ff_get_cpu_flags_x86();
+ if (ARCH_LOONGARCH)
+ return ff_get_cpu_flags_loongarch();
return 0;
}
@@ -168,6 +170,9 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
#elif ARCH_MIPS
{ "mmi", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMI }, .unit = "flags" },
{ "msa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MSA }, .unit = "flags" },
+#elif ARCH_LOONGARCH
+ { "lsx", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_LSX }, .unit = "flags" },
+ { "lasx", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_LASX }, .unit = "flags" },
#endif
{ NULL },
};
@@ -253,6 +258,8 @@ size_t av_cpu_max_align(void)
return ff_get_cpu_max_align_ppc();
if (ARCH_X86)
return ff_get_cpu_max_align_x86();
+ if (ARCH_LOONGARCH)
+ return ff_get_cpu_max_align_loongarch();
return 8;
}