diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2014-12-04 21:03:01 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2014-12-04 21:03:06 +1100 |
commit | ac0b4b4cab42fdd5c010bac85bf4e63f49647e69 (patch) | |
tree | ca05780c2fad18468d1fb2d8a691250bfdf2b046 /src/libFLAC/cpu.c | |
parent | d03c9f46be975307f30db39c8cbd09b505fe5e24 (diff) | |
download | flac-ac0b4b4cab42fdd5c010bac85bf4e63f49647e69.tar.gz |
Improve encoding speed on older Intel CPUs.
The commit http://git.xiph.org/?p=flac.git;a=commit;h=e9d805dd4374
changed the that calculate autocorrelation. However, the new code
worked slightly (about 4%) slower on Core 2, but with the new
presets the speed decrease can reach ~25%.
This patch enables both old and new functions and chooses between
them at runtime.
Patch-from: lvqcl <lvqcl.mail@gmail.com>
Diffstat (limited to 'src/libFLAC/cpu.c')
-rw-r--r-- | src/libFLAC/cpu.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libFLAC/cpu.c b/src/libFLAC/cpu.c index bb095067..40c79509 100644 --- a/src/libFLAC/cpu.c +++ b/src/libFLAC/cpu.c @@ -164,6 +164,8 @@ void FLAC__cpu_info(FLAC__CPUInfo *info) /* http://www.sandpile.org/x86/cpuid.htm */ #ifdef FLAC__HAS_X86INTRIN FLAC__uint32 flags_eax, flags_ebx, flags_ecx, flags_edx; + FLAC__cpu_info_x86(0, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); + info->ia32.intel = (flags_ebx == 0x756E6547 && flags_edx == 0x49656E69 && flags_ecx == 0x6C65746E)? true : false; /* GenuineIntel */ FLAC__cpu_info_x86(1, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); #else FLAC__uint32 flags_ecx, flags_edx; @@ -347,6 +349,8 @@ void FLAC__cpu_info(FLAC__CPUInfo *info) { /* http://www.sandpile.org/x86/cpuid.htm */ FLAC__uint32 flags_eax, flags_ebx, flags_ecx, flags_edx; + FLAC__cpu_info_x86(0, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); + info->x86.intel = (flags_ebx == 0x756E6547 && flags_edx == 0x49656E69 && flags_ecx == 0x6C65746E)? true : false; /* GenuineIntel */ FLAC__cpu_info_x86(1, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); info->x86.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 )? true : false; info->x86.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3)? true : false; |