annotate cpu.c @ 1027:7d79d41d152e libavutil

Move av_get_token() from libavfilter to libavutil.
author stefano
date Mon, 27 Sep 2010 16:23:43 +0000
parents ec22b0df8cf6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1009
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
1 /*
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
2 * This file is part of FFmpeg.
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
3 *
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
4 * FFmpeg is free software; you can redistribute it and/or
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
7 * version 2.1 of the License, or (at your option) any later version.
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
8 *
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
9 * FFmpeg is distributed in the hope that it will be useful,
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
12 * Lesser General Public License for more details.
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
13 *
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
15 * License along with FFmpeg; if not, write to the Free Software
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
17 */
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
18
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
19 #include "cpu.h"
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
20 #include "config.h"
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
21
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
22 int av_get_cpu_flags(void)
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
23 {
1011
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
24 static int flags, checked;
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
25
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
26 if (checked)
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
27 return flags;
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
28
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
29 if (ARCH_ARM) flags = ff_get_cpu_flags_arm();
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
30 if (ARCH_PPC) flags = ff_get_cpu_flags_ppc();
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
31 if (ARCH_X86) flags = ff_get_cpu_flags_x86();
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
32
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
33 checked = 1;
ec22b0df8cf6 Cache detected CPU flags
mru
parents: 1010
diff changeset
34 return flags;
1009
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
35 }
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
36
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
37 #ifdef TEST
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
38
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
39 #undef printf
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
40
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
41 int main(void)
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
42 {
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
43 int cpu_flags = av_get_cpu_flags();
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
44
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
45 printf("cpu_flags = 0x%08X\n", cpu_flags);
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
46 printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s\n",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
47 #if ARCH_ARM
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
48 cpu_flags & AV_CPU_FLAG_IWMMXT ? "IWMMXT " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
49 #elif ARCH_PPC
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
50 cpu_flags & AV_CPU_FLAG_ALTIVEC ? "ALTIVEC " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
51 #elif ARCH_X86
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
52 cpu_flags & AV_CPU_FLAG_MMX ? "MMX " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
53 cpu_flags & AV_CPU_FLAG_MMX2 ? "MMX2 " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
54 cpu_flags & AV_CPU_FLAG_SSE ? "SSE " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
55 cpu_flags & AV_CPU_FLAG_SSE2 ? "SSE2 " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
56 cpu_flags & AV_CPU_FLAG_SSE2SLOW ? "SSE2(slow) " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
57 cpu_flags & AV_CPU_FLAG_SSE3 ? "SSE3 " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
58 cpu_flags & AV_CPU_FLAG_SSE3SLOW ? "SSE3(slow) " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
59 cpu_flags & AV_CPU_FLAG_SSSE3 ? "SSSE3 " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
60 cpu_flags & AV_CPU_FLAG_SSE4 ? "SSE4.1 " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
61 cpu_flags & AV_CPU_FLAG_SSE42 ? "SSE4.2 " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
62 cpu_flags & AV_CPU_FLAG_3DNOW ? "3DNow " : "",
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
63 cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt " : "");
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
64 #endif
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
65 return 0;
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
66 }
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
67
40b8596460af Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents:
diff changeset
68 #endif