aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/cpu.c
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-09-09 18:51:49 +0000
committerMåns Rullgård <mans@mansr.com>2010-09-09 18:51:49 +0000
commita3f0d2b9674b4bbbdb6eb28a1e600ba324a5853b (patch)
treeafc13d82a50013393d6c4c8299bce39d742d5486 /libavutil/cpu.c
parent9275438a19c02264762d550a077bbf83acd63f3f (diff)
downloadffmpeg-a3f0d2b9674b4bbbdb6eb28a1e600ba324a5853b.tar.gz
Cache detected CPU flags
Originally committed as revision 25085 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/cpu.c')
-rw-r--r--libavutil/cpu.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 34530eebaf..1548530b87 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -21,10 +21,17 @@
int av_get_cpu_flags(void)
{
- if (ARCH_ARM) return ff_get_cpu_flags_arm();
- if (ARCH_PPC) return ff_get_cpu_flags_ppc();
- if (ARCH_X86) return ff_get_cpu_flags_x86();
- return 0;
+ static int flags, checked;
+
+ if (checked)
+ return flags;
+
+ if (ARCH_ARM) flags = ff_get_cpu_flags_arm();
+ if (ARCH_PPC) flags = ff_get_cpu_flags_ppc();
+ if (ARCH_X86) flags = ff_get_cpu_flags_x86();
+
+ checked = 1;
+ return flags;
}
#ifdef TEST