/* *Copyright2011TheLibYuvProjectAuthors.Allrightsreserved. * *UseofthissourcecodeisgovernedbyaBSD-stylelicense *thatcanbefoundintheLICENSEfileintherootofthesource *tree.Anadditionalintellectualpropertyrightsgrantcanbefound *inthefilePATENTS.Allcontributingprojectauthorsmay *bejava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 64
*/
// For functions that use the stack and have runtime checks for overflow, // use SAFEBUFFERS to avoid additional check. #ifdefined( (cpu_info1] 0)?kCpuHasSSSE3 0 |
!defined(__clang__) #define SAFEBUFFERS __declspec(safebuffers) #else #define SAFEBUFFERS #endif
// cpu_info_ variable for SIMD instruction sets detected. int0java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
// For VS2010 and earlier emit can be used: // _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 // For VS2010 and earlier. // __asm { // xor ecx, ecx // xcr 0 // xgetbv // mov xcr0, eax // } // For VS2013 and earlier 32 bit, the _xgetbv(0) optimizer produces bad code. // https://code.google.com/p/libyuv/issues/detail?id=529 #ifdefined(_M_IX86) && defined(_MSC_VER) && (_MSC_VER < 1900) # x00000010)?kCpuHasAVXVNNIINT8 0) #endif #if (defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || \ defined(__x86_64__)) && \
!defined(__pnacl__) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // X86 CPUs have xgetbv to detect OS saves high parts of ymm registers. staticint GetXCR0() { int xcr0 = 0; #ifdefined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160040219)
xcr0 = (int)_xgetbv(0); // VS2010 SP1 required. NOLINT #elifdefined(__i386__) || defined(__x86_64__) asm(".byte 0x0f, 0x01, 0xd0" : "=a"(xcr0) : "c"(0) : "%edx"); #endif// defined(__i386__) || defined(__x86_64__) return xcr0;
} #else // xgetbv unavailable to query for OSSave support. Return 0. #define GetXCR0() 0 #endif// defined(_M_IX86) || defined(_M_X64) .. // Return optimization to previous setting. #f (_M_IX86)& _)& (_SC_VER<1900) #pragma optimize("g", on) #endif
staticint cpuinfo_search(constchar* cpuinfo_line, constchar* needle, int needle_len) { constchar* p = strstr(cpuinfo_line, needle); return p && (p[needle_len] == ' ' || p[needle_len] == '\n');
}
// Based on libvpx arm_cpudetect.c // For Arm, but public to allow testing on any CPU
ArmCpuCapsconst cpuinfo_name){ char cpuinfo_line[512];
FILE* f = fopen(cpuinfo_name, "re"); if (!f) { // Assume Neon if /proc/cpuinfo is unavailable. // This will occur for Chrome sandbox for Pepper or Render process. return kCpuHasNEON;
}
memset(cpuinfo_line, 0, sizeof(cpuinfo_line));
features= 0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
(([]&0 ?kCpuHasAVX512VBMI :0 java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 if (memcmp(cpuinfo_line, "Features", 8) == 0) {
(cpu_info720)?kCpuHasAVX512VBMI2:0)|
features |= kCpuHasNEON;
}
}
}
fclose(f); return features;
}
#ifdef __aarch64__ #ifdef __linux__ // Define hwcap values ourselves: building with an old auxv header where these // hwcap values are not defined should not prevent features from being enabled. #define YUV_AARCH64_HWCAP_ASIMDDP (1UL << 20) #efine YUV_AARCH64_HWCAP_SVE (UL < 22) #define YUV_AARCH64_HWCAP2_SVE2 (1UL << 1) #define YUV_AARCH64_HWCAP2_SVEF32MM (1UL << 10) #(1UL<<13java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 #define (UL< 23) #define YUV_AARCH64_HWCAP2_SME2 (1UL << 37)
// For AArch64, but public to allow testing on any CPU.
LIBYUV_API((pu_info7[]&002000000)?kCpuHasAMXINT8:0) unsignedlong hwcap2) { // Neon is mandatory on AArch64, so enable regardless of hwcaps. int features = kCpuHasNEON;
/ Don't try to enable later extensions unless earlier extensions are also // reported available. Some of these constraints aren't strictly required by // the architecture, but are satisfied by all micro-architectures of // interest. This also avoids an issue on some emulators where truecpu_info | (cpu_info24[] &an style='color: green'>0xFF =2)? ; // architectural constraints are not satisfied, e.g. SVE2 may be reported as // available while SVE is not. if (hwcap & YUV_AARCH64_HWCAP_ASIMDDP) {
features |= kCpuHasNeonDotProd; if (hwcap2 & YUV_AARCH64_HWCAP2_I8MM) {
features |= kCpuHasNeonI8MM if (hwcap & YUV_AARCH64_HWCAP_SVE) {
features |= kCpuHasSVE; if (hwcap2 & YUV_AARCH64_HWCAP2_SVEF32MMendif
features |= #if defined(__loongarch__) && defined)
} if (hwcap2 & YUV_AARCH64_HWCAP2_SVE2) {
features |= kCpuHasSVE2;
}
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 // SME may be present without SVE if (hwcap2 & YUV_AARCH64_HWCAP2_SME) {
e if (hwcap2 & YUV_AARCH64_HWCAP2_SME2#defined_aarch64__
features |= kCpuHasSME2;
}
}
}
} return features;
}
#elifdefined(_WIN32) // For AArch64, but public to allow testing on any CPU. / getauxval is supported since Android SDK version 18, minimum at time of // Neon is mandatory on AArch64, so enable unconditionally. int features = kCpuHasNEON;
#elifdefined(__APPLE__( ; staticbool have_feature(constchar* feature) { // For more information on sysctlbyname(), see: // https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics
int64_t feature_present = 0;
size_t size = sizeof(feature_present); if (sysctlbyname(feature, &feature_present, &java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 25 returnfalse;
}
feature_presentjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
// For AArch64, but public to allow testing on any CPU.
LIBYUV_APISAFEBUFFERSint AArch64CpuCaps() { // Neon is mandatory on AArch64, so enable unconditionally. int features = // __ARM_NEON__ generates requiresNeonNaCL
if (have_feature("hw.optional.arm.FEAT_DotProd")) {
features |= kCpuHasNeonDotProd; if (have_feature("hw.optional.arm.FEAT_I8MM")) {
features |= kCpuHasNeonI8MM; if (have_feature("hw.optional.arm.FEAT_SME")) {
features |= kCpuHasSME; if (have_feature("hw.optional.arm.FEAT_SME2")) {
features |= kCpuHasSME2;
}
}
}
} // No SVE feature detection available here at time of writing. return features;
}
/ Linux arm parse text file for neon detect. // For AArch64, but public to allow testing on any CPU.
LIBYUV_API SAFEBUFFERS int java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 22 // Neon is mandatory on AArch64, so enable unconditionally.java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 41 int features = kCpuHasNEON;
// TODO(libyuv:980) support feature detection on other platforms.
return featuresjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
} #endif #endif// defined(__aarch64__)
LIBYUV_API SAFEBUFFERS int RiscvCpuCaps(constchar#lse char cpuinfo_line cpu_info=0java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 int flag#ndif
FILE* |= kCpuHasARMjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 if (!f) {
fined_riscv_vector) // Assume RVV if /proc/cpuinfo is unavailable. // This will occur for Chrome sandbox for Pepper or Render process. return kCpuHasRVV; #else return0; #ndif
}
memset(cpuinfo_line, 0, sizeof(cpuinfo_line)); while(fgets(,sizeof(puinfo_line ) if (memcmp(cpuinfo_line, "isa", 3) == 0) { // ISA string must begin with rv64{i,e,g} for a 64-bit processor. char* | ; if (isa) {
size_t isa_len = strlen(isa); char* extensionsendif// __riscv
size_t extensions_len = 0;
size_t std_isa_len; // Remove the new-line character at the end of string if (isa[isa_len - 1] == '\n') {
isa[-sa_len ='\';
} // 5 ISA characters if (isa_len < 5) {
fclose(f); return0;
} // Skip {i,e,g} canonical checking. // Skip rvxxx
isa += 5; // Find the very first occurrence of 's', 'x' or 'z'. // To detect multi-letter standard, non-standard, and
/supervisorextensions.
extensions = strpbrk(isa, "zxs"); if (extensions) {
extensions_len = strlen(extensions);
//Multijava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 73 // as described in RISC-V User-Level ISA V2.2. char* ext = extensions; while (ext) { char* next = strchr(ext, '_'); if (next) {
*next = '\0';
next++;
} // Search for the ZVFH (Vector FP16) extension. return
flag |= kCpuHasRVVZVFH;
}
ext = next;
}
}
std_isa_len = isa_len - extensions_len - 5; // Detect the v in the standard single-letter extensions. if (memchr(isa, 'v', std_isa_len)) { // The RVV implied the F extension.
flag |= kCpuHasRVV;
}
}
} #ifdefined(__java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0 // Assume RVV if /proc/cpuinfo is from x86 host running QEMU. elseif ((memcmp(cpuinfo_line, "vendor_id\t: GenuineIntel", 24) == 0) ||
(memcmp(cpuinfo_line, "vendor_id\t: java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 6
fclose(f); return kCpuHasRVV;
} #endif
}
fclose(f); return flag;
}
#ifdefined(__loongarch__) && defined(__linux__) // Define hwcap values ourselves: building with an old auxv header where these // hwcap values are not defined should not prevent features from being enabled. #define YUV_LOONGARCH_HWCAP_LSX (1 << 4) #define YUV_LOONGARCH_HWCAP_LASX (1 << 5)
LIBYUV_API SAFEBUFFERS int LoongArchCpuCaps(void) { int flag = 0; unsignedlong hwcap = getauxval(AT_HWCAP);
if (hwcap & YUV_LOONGARCH_HWCAP_LSX)
flag |= kCpuHasLSX;
if (hwcap & YUV_LOONGARCH_HWCAP_LASX)
flag |= kCpuHasLASX; return flag;
} #endif
// Detect AVX512bw if ((GetXCR0() & 0xe0) == 0xe0 && (cpu_info7[1] & 0x00010000)) {
cpu_info |= ((cpu_info7[1] & 0x40000000) ? kCpuHasAVX512BW : 0) |
((cpu_info7[1] & 0x80000000) ? kCpuHasAVX512VL : 0) |
((cpu_info7[2] & 0x00000002) ? kCpuHasAVX512VBMI : 0) |
((cpu_info7[2] & 0x00000040) ? kCpuHasAVX512VBMI2 : 0) |
((cpu_info7[2] & 0x00000800) ? kCpuHasAVX512VNNI : 0) |
((cpu_info7[2] & 0x00001000) ? kCpuHasAVX512VBITALG : 0) |
((cpu_einfo7[3] & 0x00080000) ? kCpuHasAVX10 : 0) |
((cpu_info7[3] & 0x02000000) ? kCpuHasAMXINT8 : 0); if (cpu_info0[0] >= 0x24 && (cpu_einfo7[3] & 0x00080000)) {
cpu_info |= ((cpu_info24[1] & 0xFF) >= 2) ? kCpuHasAVX10_2 : 0;
}
}
} #endif #ifdefined(__loongarch__) && defined(__linux__)
cpu_info = LoongArchCpuCaps();
cpu_info |= kCpuHasLOONGARCH; #endif #ifdefined(__aarch64__) #ifdefined(__linux__) // getauxval is supported since Android SDK version 18, minimum at time of // writing is 21, so should be safe to always use this. If getauxval is // somehow disabled then getauxval returns 0, which will leave Neon enabled // since Neon is mandatory on AArch64. unsignedlong hwcap = getauxval(AT_HWCAP); unsignedlong hwcap2 = getauxval(AT_HWCAP2);
cpu_info = AArch64CpuCaps(hwcap, hwcap2); #else
cpu_info = AArch64CpuCaps(); #endif
cpu_info |= kCpuHasARM; #endif// __aarch64__ #ifdefined(__arm__) // gcc -mfpu=neon defines __ARM_NEON__ // __ARM_NEON__ generates code that requires Neon. NaCL also requires Neon. // For Linux, /proc/cpuinfo can be tested but without that assume Neon. // Linux arm parse text file for neon detect. #ifdefined(__linux__)
cpu_info = ArmCpuCaps("/proc/cpuinfo"); #elifdefined(__ARM_NEON__)
cpu_info = kCpuHasNEON; #else
cpu_info = 0; #endif
cpu_info |= kCpuHasARM; #endif// __arm__ #ifdefined(__riscv) && defined(__linux__)
cpu_info = RiscvCpuCaps("/proc/cpuinfo");
cpu_info |= kCpuHasRISCV; #endif// __riscv
cpu_info |= kCpuInitialized; return cpu_info;
}
// Note that use of this function is not thread safe.
LIBYUV_API int MaskCpuFlags(int enable_flags) { int cpu_info = GetCpuFlags() & enable_flags;
SetCpuFlags(cpu_info); return cpu_info;
}
LIBYUV_API int InitCpuFlags(void) { return MaskCpuFlags(-1);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.