[FFmpeg-cvslog] r25085 - trunk/libavutil/cpu.c

mru subversion
Thu Sep 9 20:51:50 CEST 2010


Author: mru
Date: Thu Sep  9 20:51:49 2010
New Revision: 25085

Log:
Cache detected CPU flags

Modified:
   trunk/libavutil/cpu.c

Modified: trunk/libavutil/cpu.c
==============================================================================
--- trunk/libavutil/cpu.c	Thu Sep  9 20:51:45 2010	(r25084)
+++ trunk/libavutil/cpu.c	Thu Sep  9 20:51:49 2010	(r25085)
@@ -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



More information about the ffmpeg-cvslog mailing list