[FFmpeg-devel] libavutil simd
    Nigel Pearson 
    nigel
       
    Tue Oct  2 09:13:57 CEST 2007
    
    
  
> Not useful. A utility means forking. Lookup how this utility gets its
> information
Its copyright is the Apple Public Source License,
so I don't think it is appropriate to dissect it.
I found a page that lists another method:
http://www.cocoadev.com/index.pl?HowToGetHardwareAndNetworkInfo
which shows Mach calls for detecting CPU.
It also mentions a sysctl parameter, hw.optional.altivec.
I am not sure that this will work on *BSD,
but it does the trick on OS X:
#include <sys/sysctl.h>
int main()
{
     size_t len = 0;
     char   *name = "hw.optional.altivec";
     long   result;
     if (sysctlbyname(name,  NULL,  &len, NULL, 0) == -1)
         return 0;   // altivec is not even an option on an i386
     if (len > sizeof(result))
         return 0;   // this is not a size or frequency, so should be  
32bits
     if (sysctlbyname(name, &result, &len, NULL, 0) == -1)
         return 0;
     printf("sysctl(%s)  returned %d\n", name, result);
}
No guarantee that this doesn't cause a kernel context switch.
Same thing for the Mach calls.
...
> your test is backwards. You should assume altivec
> is available unless one of a fixed set of pre-altivec cpu types is
> detected. The number of cpu models without altivec is already
> fixed/finite. The number of cpu models with altivec is unlimited since
> all future ones will have it.
Moot, because I suspect that Apple
will only ship Intels from now on?
--
Nigel Pearson, nigel at ind.tansu.com.au|"Gentlemen,
Telstra Net. Eng., Sydney, Australia | you can't fight in here-
Office: 9202 3900    Fax:  9261 3912 |   this is the war room!"
Mobile: 0408 664435  Home: 9792 6998 |     Dr Strangelove
    
    
More information about the ffmpeg-devel
mailing list