FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cpu.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <stdint.h>
20 
21 #include "cpu.h"
22 #include "cpu_internal.h"
23 #include "config.h"
24 #include "opt.h"
25 #include "common.h"
26 
27 #if HAVE_SCHED_GETAFFINITY
28 #ifndef _GNU_SOURCE
29 # define _GNU_SOURCE
30 #endif
31 #include <sched.h>
32 #endif
33 #if HAVE_GETPROCESSAFFINITYMASK
34 #include <windows.h>
35 #endif
36 #if HAVE_SYSCTL
37 #if HAVE_SYS_PARAM_H
38 #include <sys/param.h>
39 #endif
40 #include <sys/types.h>
41 #include <sys/sysctl.h>
42 #endif
43 #if HAVE_UNISTD_H
44 #include <unistd.h>
45 #endif
46 
47 static int flags, checked;
48 
50  if ( (arg & ( AV_CPU_FLAG_3DNOW |
65  && !(arg & AV_CPU_FLAG_MMX)) {
66  av_log(NULL, AV_LOG_WARNING, "MMX implied by specified flags\n");
67  arg |= AV_CPU_FLAG_MMX;
68  }
69 
70  flags = arg;
71  checked = arg != -1;
72 }
73 
75 {
76  if (checked)
77  return flags;
78 
79  if (ARCH_AARCH64)
81  if (ARCH_ARM)
83  if (ARCH_PPC)
85  if (ARCH_X86)
87 
88  checked = 1;
89  return flags;
90 }
91 
93 {
94  checked = 0;
96  checked = 1;
97 }
98 
99 int av_parse_cpu_flags(const char *s)
100 {
101 #define CPUFLAG_MMXEXT (AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT | AV_CPU_FLAG_CMOV)
102 #define CPUFLAG_3DNOW (AV_CPU_FLAG_3DNOW | AV_CPU_FLAG_MMX)
103 #define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW)
104 #define CPUFLAG_SSE (AV_CPU_FLAG_SSE | CPUFLAG_MMXEXT)
105 #define CPUFLAG_SSE2 (AV_CPU_FLAG_SSE2 | CPUFLAG_SSE)
106 #define CPUFLAG_SSE2SLOW (AV_CPU_FLAG_SSE2SLOW | CPUFLAG_SSE2)
107 #define CPUFLAG_SSE3 (AV_CPU_FLAG_SSE3 | CPUFLAG_SSE2)
108 #define CPUFLAG_SSE3SLOW (AV_CPU_FLAG_SSE3SLOW | CPUFLAG_SSE3)
109 #define CPUFLAG_SSSE3 (AV_CPU_FLAG_SSSE3 | CPUFLAG_SSE3)
110 #define CPUFLAG_SSE4 (AV_CPU_FLAG_SSE4 | CPUFLAG_SSSE3)
111 #define CPUFLAG_SSE42 (AV_CPU_FLAG_SSE42 | CPUFLAG_SSE4)
112 #define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42)
113 #define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX)
114 #define CPUFLAG_FMA3 (AV_CPU_FLAG_FMA3 | CPUFLAG_AVX)
115 #define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX)
116 #define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX)
117 #define CPUFLAG_BMI1 (AV_CPU_FLAG_BMI1)
118 #define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | CPUFLAG_BMI1)
119  static const AVOption cpuflags_opts[] = {
120  { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
121 #if ARCH_PPC
122  { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "flags" },
123 #elif ARCH_X86
124  { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" },
125  { "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_MMXEXT }, .unit = "flags" },
126  { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE }, .unit = "flags" },
127  { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2 }, .unit = "flags" },
128  { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2SLOW }, .unit = "flags" },
129  { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3 }, .unit = "flags" },
130  { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3SLOW }, .unit = "flags" },
131  { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSSE3 }, .unit = "flags" },
132  { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "flags" },
133  { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE4 }, .unit = "flags" },
134  { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE42 }, .unit = "flags" },
135  { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX }, .unit = "flags" },
136  { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP }, .unit = "flags" },
137  { "fma3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA3 }, .unit = "flags" },
138  { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4 }, .unit = "flags" },
139  { "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX2 }, .unit = "flags" },
140  { "bmi1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI1 }, .unit = "flags" },
141  { "bmi2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI2 }, .unit = "flags" },
142  { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW }, .unit = "flags" },
143  { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT }, .unit = "flags" },
144  { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" },
145 #elif ARCH_ARM
146  { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "flags" },
147  { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "flags" },
148  { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" },
149  { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
150  { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" },
151  { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
152 #elif ARCH_AARCH64
153  { "armv8", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV8 }, .unit = "flags" },
154  { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
155  { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
156 #endif
157  { NULL },
158  };
159  static const AVClass class = {
160  .class_name = "cpuflags",
161  .item_name = av_default_item_name,
162  .option = cpuflags_opts,
163  .version = LIBAVUTIL_VERSION_INT,
164  };
165 
166  int flags = 0, ret;
167  const AVClass *pclass = &class;
168 
169  if ((ret = av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, &flags)) < 0)
170  return ret;
171 
172  return flags & INT_MAX;
173 }
174 
175 int av_parse_cpu_caps(unsigned *flags, const char *s)
176 {
177  static const AVOption cpuflags_opts[] = {
178  { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
179 #if ARCH_PPC
180  { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "flags" },
181 #elif ARCH_X86
182  { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" },
183  { "mmx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX2 }, .unit = "flags" },
184  { "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX2 }, .unit = "flags" },
185  { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE }, .unit = "flags" },
186  { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE2 }, .unit = "flags" },
187  { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE2SLOW }, .unit = "flags" },
188  { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE3 }, .unit = "flags" },
189  { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE3SLOW }, .unit = "flags" },
190  { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSSE3 }, .unit = "flags" },
191  { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "flags" },
192  { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE4 }, .unit = "flags" },
193  { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE42 }, .unit = "flags" },
194  { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_AVX }, .unit = "flags" },
195  { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_XOP }, .unit = "flags" },
196  { "fma3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_FMA3 }, .unit = "flags" },
197  { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_FMA4 }, .unit = "flags" },
198  { "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_AVX2 }, .unit = "flags" },
199  { "bmi1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI1 }, .unit = "flags" },
200  { "bmi2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI2 }, .unit = "flags" },
201  { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_3DNOW }, .unit = "flags" },
202  { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_3DNOWEXT }, .unit = "flags" },
203  { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" },
204 
205 #define CPU_FLAG_P2 AV_CPU_FLAG_CMOV | AV_CPU_FLAG_MMX
206 #define CPU_FLAG_P3 CPU_FLAG_P2 | AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE
207 #define CPU_FLAG_P4 CPU_FLAG_P3| AV_CPU_FLAG_SSE2
208  { "pentium2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_P2 }, .unit = "flags" },
209  { "pentium3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_P3 }, .unit = "flags" },
210  { "pentium4", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_P4 }, .unit = "flags" },
211 
212 #define CPU_FLAG_K62 AV_CPU_FLAG_MMX | AV_CPU_FLAG_3DNOW
213 #define CPU_FLAG_ATHLON CPU_FLAG_K62 | AV_CPU_FLAG_CMOV | AV_CPU_FLAG_3DNOWEXT | AV_CPU_FLAG_MMX2
214 #define CPU_FLAG_ATHLONXP CPU_FLAG_ATHLON | AV_CPU_FLAG_SSE
215 #define CPU_FLAG_K8 CPU_FLAG_ATHLONXP | AV_CPU_FLAG_SSE2
216  { "k6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" },
217  { "k62", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_K62 }, .unit = "flags" },
218  { "athlon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_ATHLON }, .unit = "flags" },
219  { "athlonxp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_ATHLONXP }, .unit = "flags" },
220  { "k8", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_K8 }, .unit = "flags" },
221 #elif ARCH_ARM
222  { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "flags" },
223  { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "flags" },
224  { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" },
225  { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
226  { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" },
227  { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
228  { "setend", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SETEND }, .unit = "flags" },
229 #elif ARCH_AARCH64
230  { "armv8", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV8 }, .unit = "flags" },
231  { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" },
232  { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" },
233 #endif
234  { NULL },
235  };
236  static const AVClass class = {
237  .class_name = "cpuflags",
238  .item_name = av_default_item_name,
239  .option = cpuflags_opts,
240  .version = LIBAVUTIL_VERSION_INT,
241  };
242  const AVClass *pclass = &class;
243 
244  return av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, flags);
245 }
246 
247 int av_cpu_count(void)
248 {
249  static volatile int printed;
250 
251  int nb_cpus = 1;
252 #if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)
253  cpu_set_t cpuset;
254 
255  CPU_ZERO(&cpuset);
256 
257  if (!sched_getaffinity(0, sizeof(cpuset), &cpuset))
258  nb_cpus = CPU_COUNT(&cpuset);
259 #elif HAVE_GETPROCESSAFFINITYMASK
260  DWORD_PTR proc_aff, sys_aff;
261  if (GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff))
262  nb_cpus = av_popcount64(proc_aff);
263 #elif HAVE_SYSCTL && defined(HW_NCPU)
264  int mib[2] = { CTL_HW, HW_NCPU };
265  size_t len = sizeof(nb_cpus);
266 
267  if (sysctl(mib, 2, &nb_cpus, &len, NULL, 0) == -1)
268  nb_cpus = 0;
269 #elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN)
270  nb_cpus = sysconf(_SC_NPROC_ONLN);
271 #elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN)
272  nb_cpus = sysconf(_SC_NPROCESSORS_ONLN);
273 #endif
274 
275  if (!printed) {
276  av_log(NULL, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);
277  printed = 1;
278  }
279 
280  return nb_cpus;
281 }
282 
283 #ifdef TEST
284 
285 #include <stdio.h>
286 #include "avstring.h"
287 
288 #if !HAVE_GETOPT
289 #include "compat/getopt.c"
290 #endif
291 
292 static const struct {
293  int flag;
294  const char *name;
295 } cpu_flag_tab[] = {
296 #if ARCH_AARCH64
297  { AV_CPU_FLAG_ARMV8, "armv8" },
298  { AV_CPU_FLAG_NEON, "neon" },
299  { AV_CPU_FLAG_VFP, "vfp" },
300 #elif ARCH_ARM
301  { AV_CPU_FLAG_ARMV5TE, "armv5te" },
302  { AV_CPU_FLAG_ARMV6, "armv6" },
303  { AV_CPU_FLAG_ARMV6T2, "armv6t2" },
304  { AV_CPU_FLAG_VFP, "vfp" },
305  { AV_CPU_FLAG_VFPV3, "vfpv3" },
306  { AV_CPU_FLAG_NEON, "neon" },
307  { AV_CPU_FLAG_SETEND, "setend" },
308 #elif ARCH_PPC
309  { AV_CPU_FLAG_ALTIVEC, "altivec" },
310 #elif ARCH_X86
311  { AV_CPU_FLAG_MMX, "mmx" },
312  { AV_CPU_FLAG_MMXEXT, "mmxext" },
313  { AV_CPU_FLAG_SSE, "sse" },
314  { AV_CPU_FLAG_SSE2, "sse2" },
315  { AV_CPU_FLAG_SSE2SLOW, "sse2slow" },
316  { AV_CPU_FLAG_SSE3, "sse3" },
317  { AV_CPU_FLAG_SSE3SLOW, "sse3slow" },
318  { AV_CPU_FLAG_SSSE3, "ssse3" },
319  { AV_CPU_FLAG_ATOM, "atom" },
320  { AV_CPU_FLAG_SSE4, "sse4.1" },
321  { AV_CPU_FLAG_SSE42, "sse4.2" },
322  { AV_CPU_FLAG_AVX, "avx" },
323  { AV_CPU_FLAG_XOP, "xop" },
324  { AV_CPU_FLAG_FMA3, "fma3" },
325  { AV_CPU_FLAG_FMA4, "fma4" },
326  { AV_CPU_FLAG_3DNOW, "3dnow" },
327  { AV_CPU_FLAG_3DNOWEXT, "3dnowext" },
328  { AV_CPU_FLAG_CMOV, "cmov" },
329  { AV_CPU_FLAG_AVX2, "avx2" },
330  { AV_CPU_FLAG_BMI1, "bmi1" },
331  { AV_CPU_FLAG_BMI2, "bmi2" },
332 #endif
333  { 0 }
334 };
335 
336 static void print_cpu_flags(int cpu_flags, const char *type)
337 {
338  int i;
339 
340  printf("cpu_flags(%s) = 0x%08X\n", type, cpu_flags);
341  printf("cpu_flags_str(%s) =", type);
342  for (i = 0; cpu_flag_tab[i].flag; i++)
343  if (cpu_flags & cpu_flag_tab[i].flag)
344  printf(" %s", cpu_flag_tab[i].name);
345  printf("\n");
346 }
347 
348 
349 int main(int argc, char **argv)
350 {
351  int cpu_flags_raw = av_get_cpu_flags();
352  int cpu_flags_eff;
353  int cpu_count = av_cpu_count();
354  char threads[5] = "auto";
355  int i;
356 
357  for(i = 0; cpu_flag_tab[i].flag; i++) {
358  unsigned tmp = 0;
359  if (av_parse_cpu_caps(&tmp, cpu_flag_tab[i].name) < 0) {
360  fprintf(stderr, "Table missing %s\n", cpu_flag_tab[i].name);
361  return 4;
362  }
363  }
364 
365  if (cpu_flags_raw < 0)
366  return 1;
367 
368  for (;;) {
369  int c = getopt(argc, argv, "c:t:");
370  if (c == -1)
371  break;
372  switch (c) {
373  case 'c':
374  {
375  unsigned flags = av_get_cpu_flags();
376  if (av_parse_cpu_caps(&flags, optarg) < 0)
377  return 2;
378 
379  av_force_cpu_flags(flags);
380  break;
381  }
382  case 't':
383  {
384  int len = av_strlcpy(threads, optarg, sizeof(threads));
385  if (len >= sizeof(threads)) {
386  fprintf(stderr, "Invalid thread count '%s'\n", optarg);
387  return 2;
388  }
389  }
390  }
391  }
392 
393  cpu_flags_eff = av_get_cpu_flags();
394 
395  if (cpu_flags_eff < 0)
396  return 3;
397 
398  print_cpu_flags(cpu_flags_raw, "raw");
399  print_cpu_flags(cpu_flags_eff, "effective");
400  printf("threads = %s (cpu_count = %d)\n", threads, cpu_count);
401 
402  return 0;
403 }
404 
405 #endif