This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 0645c484537649a5b5921f8be7e3ccd3b02ca983 Author: Zhao Zhili <[email protected]> AuthorDate: Mon Oct 6 13:41:16 2025 +0800 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Sun Jan 4 15:49:30 2026 +0100 avutil/cpu: add CPU feature flag for arm crc32 Co-Authored-by: Martin Storsjö <[email protected]> --- doc/APIchanges | 3 +++ libavutil/aarch64/cpu.c | 9 +++++++++ libavutil/aarch64/cpu.h | 1 + libavutil/cpu.c | 1 + libavutil/cpu.h | 1 + libavutil/tests/cpu.c | 1 + libavutil/version.h | 2 +- tests/checkasm/checkasm.c | 1 + 8 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index d8bff3c4b5..93f0b3bf1c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28 API changes, most recent first: +2026-01-04 - xxxxxxxxxx - lavu 60.23.100 - cpu.h + Add AV_CPU_FLAG_ARM_CRC. + 2026-01-04 - xxxxxxxxxx - lavu 60.22.100 - cpu.h Add AV_CPU_FLAG_CLMUL. diff --git a/libavutil/aarch64/cpu.c b/libavutil/aarch64/cpu.c index f93ff08fb5..6733b62123 100644 --- a/libavutil/aarch64/cpu.c +++ b/libavutil/aarch64/cpu.c @@ -24,6 +24,7 @@ #include <stdint.h> #include <sys/auxv.h> +#define HWCAP_AARCH64_CRC32 (1 << 7) #define HWCAP_AARCH64_ASIMDDP (1 << 20) #define HWCAP_AARCH64_SVE (1 << 22) #define HWCAP2_AARCH64_SVE2 (1 << 1) @@ -37,6 +38,8 @@ static int detect_flags(void) unsigned long hwcap = ff_getauxval(AT_HWCAP); unsigned long hwcap2 = ff_getauxval(AT_HWCAP2); + if (hwcap & HWCAP_AARCH64_CRC32) + flags |= AV_CPU_FLAG_ARM_CRC; if (hwcap & HWCAP_AARCH64_ASIMDDP) flags |= AV_CPU_FLAG_DOTPROD; if (hwcap & HWCAP_AARCH64_SVE) @@ -72,6 +75,8 @@ static int detect_flags(void) flags |= AV_CPU_FLAG_I8MM; if (have_feature("hw.optional.arm.FEAT_SME")) flags |= AV_CPU_FLAG_SME; + if (have_feature("hw.optional.armv8_crc32")) + flags |= AV_CPU_FLAG_ARM_CRC; return flags; } @@ -120,6 +125,10 @@ static int detect_flags(void) static int detect_flags(void) { int flags = 0; +#ifdef PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE + if (IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE)) + flags |= AV_CPU_FLAG_ARM_CRC; +#endif #ifdef PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE if (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE)) flags |= AV_CPU_FLAG_DOTPROD; diff --git a/libavutil/aarch64/cpu.h b/libavutil/aarch64/cpu.h index 62d5eb768f..e1fc625e0f 100644 --- a/libavutil/aarch64/cpu.h +++ b/libavutil/aarch64/cpu.h @@ -25,6 +25,7 @@ #define have_armv8(flags) CPUEXT(flags, ARMV8) #define have_neon(flags) CPUEXT(flags, NEON) #define have_vfp(flags) CPUEXT(flags, VFP) +#define have_arm_crc(flags) CPUEXT(flags, ARM_CRC) #define have_dotprod(flags) CPUEXT(flags, DOTPROD) #define have_i8mm(flags) CPUEXT(flags, I8MM) #define have_sve(flags) CPUEXT(flags, SVE) diff --git a/libavutil/cpu.c b/libavutil/cpu.c index ce53c4d14a..03e2720a7f 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -188,6 +188,7 @@ int av_parse_cpu_caps(unsigned *flags, const char *s) { "sve", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SVE }, .unit = "flags" }, { "sve2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SVE2 }, .unit = "flags" }, { "sme", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SME }, .unit = "flags" }, + { "crc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARM_CRC }, .unit = "flags" }, #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" }, diff --git a/libavutil/cpu.h b/libavutil/cpu.h index d0b2270286..58157ea208 100644 --- a/libavutil/cpu.h +++ b/libavutil/cpu.h @@ -78,6 +78,7 @@ #define AV_CPU_FLAG_SVE (1 <<10) #define AV_CPU_FLAG_SVE2 (1 <<11) #define AV_CPU_FLAG_SME (1 <<12) +#define AV_CPU_FLAG_ARM_CRC (1 <<13) #define AV_CPU_FLAG_SETEND (1 <<16) #define AV_CPU_FLAG_MMI (1 << 0) diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c index 2f25bcf86f..663f9994be 100644 --- a/libavutil/tests/cpu.c +++ b/libavutil/tests/cpu.c @@ -49,6 +49,7 @@ static const struct { { AV_CPU_FLAG_SVE, "sve" }, { AV_CPU_FLAG_SVE2, "sve2" }, { AV_CPU_FLAG_SME, "sme" }, + { AV_CPU_FLAG_ARM_CRC, "crc" }, #elif ARCH_ARM { AV_CPU_FLAG_ARMV5TE, "armv5te" }, { AV_CPU_FLAG_ARMV6, "armv6" }, diff --git a/libavutil/version.h b/libavutil/version.h index 3bea461f82..264c13a1b8 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 60 -#define LIBAVUTIL_VERSION_MINOR 22 +#define LIBAVUTIL_VERSION_MINOR 23 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 16d980e220..7dcdaeb2a4 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -370,6 +370,7 @@ static const struct { { "SVE", "sve", AV_CPU_FLAG_SVE }, { "SVE2", "sve2", AV_CPU_FLAG_SVE2 }, { "SME", "sme", AV_CPU_FLAG_SME }, + { "CRC", "crc", AV_CPU_FLAG_ARM_CRC }, #elif ARCH_ARM { "ARMV5TE", "armv5te", AV_CPU_FLAG_ARMV5TE }, { "ARMV6", "armv6", AV_CPU_FLAG_ARMV6 }, _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
