diff options
author | Diego Biurrun <diego@biurrun.de> | 2016-03-17 19:13:17 +0100 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2016-04-07 16:14:42 +0200 |
commit | d12b5b2f135aade4099f4b26b0fe678656158c13 (patch) | |
tree | d5b44fd428a1c68213fe51aca21b5819bce3d33a /libavutil/cpu.c | |
parent | 330177b508420a553083df94f22cbd5142de0f4a (diff) | |
download | ffmpeg-d12b5b2f135aade4099f4b26b0fe678656158c13.tar.gz |
build: Split test programs off into separate files
This avoids spurious library rebuilds when only the test program
code is changed and simplifies the build system.
Diffstat (limited to 'libavutil/cpu.c')
-rw-r--r-- | libavutil/cpu.c | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 5f04461f6b..7d7390a756 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -178,122 +178,3 @@ int av_cpu_count(void) return nb_cpus; } - -#ifdef TEST - -#include <stdio.h> -#if HAVE_UNISTD_H -#include <unistd.h> -#endif - -#include "avstring.h" - -#if !HAVE_GETOPT -#include "compat/getopt.c" -#endif - -static const struct { - int flag; - const char *name; -} cpu_flag_tab[] = { -#if ARCH_AARCH64 - { AV_CPU_FLAG_ARMV8, "armv8" }, - { AV_CPU_FLAG_NEON, "neon" }, - { AV_CPU_FLAG_VFP, "vfp" }, -#elif ARCH_ARM - { AV_CPU_FLAG_ARMV5TE, "armv5te" }, - { AV_CPU_FLAG_ARMV6, "armv6" }, - { AV_CPU_FLAG_ARMV6T2, "armv6t2" }, - { AV_CPU_FLAG_VFP, "vfp" }, - { AV_CPU_FLAG_VFP_VM, "vfp_vm" }, - { AV_CPU_FLAG_VFPV3, "vfpv3" }, - { AV_CPU_FLAG_NEON, "neon" }, -#elif ARCH_PPC - { AV_CPU_FLAG_ALTIVEC, "altivec" }, -#elif ARCH_X86 - { AV_CPU_FLAG_MMX, "mmx" }, - { AV_CPU_FLAG_MMXEXT, "mmxext" }, - { AV_CPU_FLAG_SSE, "sse" }, - { AV_CPU_FLAG_SSE2, "sse2" }, - { AV_CPU_FLAG_SSE2SLOW, "sse2(slow)" }, - { AV_CPU_FLAG_SSE3, "sse3" }, - { AV_CPU_FLAG_SSE3SLOW, "sse3(slow)" }, - { AV_CPU_FLAG_SSSE3, "ssse3" }, - { AV_CPU_FLAG_ATOM, "atom" }, - { AV_CPU_FLAG_SSE4, "sse4.1" }, - { AV_CPU_FLAG_SSE42, "sse4.2" }, - { AV_CPU_FLAG_AVX, "avx" }, - { AV_CPU_FLAG_AVXSLOW, "avxslow" }, - { AV_CPU_FLAG_XOP, "xop" }, - { AV_CPU_FLAG_FMA3, "fma3" }, - { AV_CPU_FLAG_FMA4, "fma4" }, - { AV_CPU_FLAG_3DNOW, "3dnow" }, - { AV_CPU_FLAG_3DNOWEXT, "3dnowext" }, - { AV_CPU_FLAG_CMOV, "cmov" }, - { AV_CPU_FLAG_AVX2, "avx2" }, - { AV_CPU_FLAG_BMI1, "bmi1" }, - { AV_CPU_FLAG_BMI2, "bmi2" }, -#endif - { 0 } -}; - -static void print_cpu_flags(int cpu_flags, const char *type) -{ - int i; - - fprintf(stderr, "cpu_flags(%s) = 0x%08X\n", type, cpu_flags); - fprintf(stderr, "cpu_flags_str(%s) =", type); - for (i = 0; cpu_flag_tab[i].flag; i++) - if (cpu_flags & cpu_flag_tab[i].flag) - fprintf(stderr, " %s", cpu_flag_tab[i].name); - fprintf(stderr, "\n"); -} - - -int main(int argc, char **argv) -{ - int cpu_flags_raw = av_get_cpu_flags(); - int cpu_flags_eff; - int cpu_count = av_cpu_count(); - char threads[5] = "auto"; - - if (cpu_flags_raw < 0) - return 1; - - for (;;) { - int c = getopt(argc, argv, "c:t:"); - if (c == -1) - break; - switch (c) { - case 'c': - { - int cpuflags = av_parse_cpu_flags(optarg); - if (cpuflags < 0) - return 2; - av_set_cpu_flags_mask(cpuflags); - break; - } - case 't': - { - int len = av_strlcpy(threads, optarg, sizeof(threads)); - if (len >= sizeof(threads)) { - fprintf(stderr, "Invalid thread count '%s'\n", optarg); - return 2; - } - } - } - } - - cpu_flags_eff = av_get_cpu_flags(); - - if (cpu_flags_eff < 0) - return 3; - - print_cpu_flags(cpu_flags_raw, "raw"); - print_cpu_flags(cpu_flags_eff, "effective"); - fprintf(stderr, "threads = %s (cpu_count = %d)\n", threads, cpu_count); - - return 0; -} - -#endif |