[flac-dev] Please test more libFLAC/cpu.c changes

lvqcl lvqcl.mail at gmail.com
Wed Jun 29 16:04:07 UTC 2016


Erik de Castro Lopo wrote:

>> Found a bug in Android OS SSE test.
>
> Sorry, what is the bug and how does this fix it?

FLAC__cpu_info(FLAC__CPUInfo *info): detects CPU features
that can be used and sets corresponding flags in the info
struct.

Feature detection algorithm for x86 arch:

step 1: clear all flags (via memset(info, 0, ...) call)

step 2: test if cpuid is available. If not, return.

step 3: call cpuid, determine available CPU features
         and set corresponding flags to 1.

step 4: test OS SSE support. If the OS doesn't support SSE
         (or if such test isn't possible) then set all sseN flags to 0.

step 5: test OS AVX support. If the OS doesn't support AVX
         then set all avxN flags to 0.

(currently there's some discrepancy: if FLAC__SSE_OS==1 then
step 4 is skipped on Linux, and only on Linux)


If the target OS is Android then step 4 can be skipped because
all versions of Android for x86 support SSE. But the current code
skips everything after the 1st step! All flags in the info struct
are unset, and all accelerated functions are disabled.

After my patch only the step 4 is skipped for Android, as it should be.


And for x86-64 arch, there's no need in steps 2 and 4, for all CPUs and OSes.


More information about the flac-dev mailing list