diff options
Diffstat (limited to 'libavutil/tests/cpu.c')
-rw-r--r-- | libavutil/tests/cpu.c | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c index 176b7eb030..f02a54cbbb 100644 --- a/libavutil/tests/cpu.c +++ b/libavutil/tests/cpu.c @@ -1,36 +1,35 @@ /* - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * 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. * - * Libav is distributed in the hope that it will be useful, + * 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 Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <stdio.h> + #include "config.h" +#include "libavutil/cpu.h" +#include "libavutil/avstring.h" + #if HAVE_UNISTD_H #include <unistd.h> -#elif !HAVE_GETOPT +#endif +#if !HAVE_GETOPT #include "compat/getopt.c" #endif -#include <stdint.h> -#include <stdio.h> - -#include "libavutil/avstring.h" -#include "libavutil/common.h" -#include "libavutil/cpu.h" - static const struct { int flag; const char *name; @@ -47,6 +46,7 @@ static const struct { { AV_CPU_FLAG_VFP_VM, "vfp_vm" }, { AV_CPU_FLAG_VFPV3, "vfpv3" }, { AV_CPU_FLAG_NEON, "neon" }, + { AV_CPU_FLAG_SETEND, "setend" }, #elif ARCH_PPC { AV_CPU_FLAG_ALTIVEC, "altivec" }, #elif ARCH_X86 @@ -54,9 +54,9 @@ static const struct { { AV_CPU_FLAG_MMXEXT, "mmxext" }, { AV_CPU_FLAG_SSE, "sse" }, { AV_CPU_FLAG_SSE2, "sse2" }, - { AV_CPU_FLAG_SSE2SLOW, "sse2(slow)" }, + { AV_CPU_FLAG_SSE2SLOW, "sse2slow" }, { AV_CPU_FLAG_SSE3, "sse3" }, - { AV_CPU_FLAG_SSE3SLOW, "sse3(slow)" }, + { AV_CPU_FLAG_SSE3SLOW, "sse3slow" }, { AV_CPU_FLAG_SSSE3, "ssse3" }, { AV_CPU_FLAG_ATOM, "atom" }, { AV_CPU_FLAG_SSE4, "sse4.1" }, @@ -72,6 +72,7 @@ static const struct { { AV_CPU_FLAG_AVX2, "avx2" }, { AV_CPU_FLAG_BMI1, "bmi1" }, { AV_CPU_FLAG_BMI2, "bmi2" }, + { AV_CPU_FLAG_AESNI, "aesni" }, #endif { 0 } }; @@ -80,12 +81,12 @@ 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); + printf("cpu_flags(%s) = 0x%08X\n", type, cpu_flags); + printf("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"); + printf(" %s", cpu_flag_tab[i].name); + printf("\n"); } @@ -95,6 +96,15 @@ int main(int argc, char **argv) int cpu_flags_eff; int cpu_count = av_cpu_count(); char threads[5] = "auto"; + int i; + + for(i = 0; cpu_flag_tab[i].flag; i++) { + unsigned tmp = 0; + if (av_parse_cpu_caps(&tmp, cpu_flag_tab[i].name) < 0) { + fprintf(stderr, "Table missing %s\n", cpu_flag_tab[i].name); + return 4; + } + } if (cpu_flags_raw < 0) return 1; @@ -106,10 +116,11 @@ int main(int argc, char **argv) switch (c) { case 'c': { - int cpuflags = av_parse_cpu_flags(optarg); - if (cpuflags < 0) + unsigned flags = av_get_cpu_flags(); + if (av_parse_cpu_caps(&flags, optarg) < 0) return 2; - av_set_cpu_flags_mask(cpuflags); + + av_force_cpu_flags(flags); break; } case 't': @@ -130,7 +141,7 @@ int main(int argc, char **argv) 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); + printf("threads = %s (cpu_count = %d)\n", threads, cpu_count); return 0; } |