[opus] [PATCH] Add ARM cpu detection for iDevices

Jonathan Lennox jonathan at vidyo.com
Thu Jan 8 12:15:19 PST 2015


On Jan 8, 2015, at 2:33 PM, Tom Hughes <tom at airtime.com<mailto:tom at airtime.com>> wrote:

This adds run-time CPU detection for iOS devices. I found this page useful for CPU support and models: http://iossupportmatrix.com/

The patch could be simplified to just set the OPUS_CPU_ARM_NEON flag if you think it's unlikely that anyone would be running on the really old devices that don't support NEON.

Tom

Every armv7 (and armv8) iOS device has supported Neon, and Xcode support for armv6 was dropped with Xcode 4.5.

Even if you’re compiling with an old Xcode version to support really old iOS devices, Apple’s armv6/armv7 selection was a compile-time switch (supported using fat binaries).  I think the arch can be detected based on on preprocessor defines, though I can’t find the specific settings offhand.

That said, since Apple is going (very soon) to require arm64 in all apps submitted through the App Store, and no Xcode version supported both armv6 and arm64, I don’t know how useful this would be.

So my inclination would be to just always set OPUS_CPU_ARM_NEON on iOS/arm.

That said, if we do want to support runtime Neon detection on iOS, rather than checking hardware models I believe the semantically-correct way to do this is to check “hw.optional.neon” using sysctlbyname(), as in:

unsigned int hasNeon;
size_t length = sizeof(hasNeon);
if (sysctlbyname("hw.optional.neon", &hasNeon, &length, NULL, 0) != 0)
hasNeon = 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/opus/attachments/20150108/4ab7c6ad/attachment.htm 


More information about the opus mailing list