00001 /* 00002 * This file is part of FFmpeg. 00003 * 00004 * FFmpeg is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * FFmpeg is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with FFmpeg; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 00019 00025 #ifdef __APPLE__ 00026 #include <sys/sysctl.h> 00027 #elif __AMIGAOS4__ 00028 #include <exec/exec.h> 00029 #include <interfaces/exec.h> 00030 #include <proto/exec.h> 00031 #endif /* __APPLE__ */ 00032 00038 int has_altivec(void) 00039 { 00040 #ifdef __AMIGAOS4__ 00041 ULONG result = 0; 00042 extern struct ExecIFace *IExec; 00043 00044 IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); 00045 if (result == VECTORTYPE_ALTIVEC) return 1; 00046 return 0; 00047 #elif __APPLE__ 00048 int sels[2] = {CTL_HW, HW_VECTORUNIT}; 00049 int has_vu = 0; 00050 size_t len = sizeof(has_vu); 00051 int err; 00052 00053 err = sysctl(sels, 2, &has_vu, &len, NULL, 0); 00054 00055 if (err == 0) return (has_vu != 0); 00056 return 0; 00057 #else 00058 // since we were compiled for altivec, just assume we have it 00059 // until someone comes up with a proper way (not involving signal hacks). 00060 return 1; 00061 #endif /* __AMIGAOS4__ */ 00062 } 00063
1.5.5