WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
295575
[LibWebRTC, arm64] OPUS codec lacks NEON optimization on Apple Silicon
https://bugs.webkit.org/show_bug.cgi?id=295575
Summary
[LibWebRTC, arm64] OPUS codec lacks NEON optimization on Apple Silicon
Yury Yarashevich
Reported
2025-07-07 23:45:30 PDT
Created
attachment 475817
[details]
Flame graph of webrtc::AudioEncoderOpusImpl::EncodeImpl(unsigned int, rtc::ArrayView<short const, -4711l>, rtc::BufferT<unsigned char, false>*) **Description**: When WebRTC is compiled as part of WebKit (see
https://github.com/WebKit/WebKit/blob/main/Source/ThirdParty/libwebrtc/CMakeLists.txt
), the OPUS codec is built to operate using only the plain C implementation of all functions, rather than using the optimized versions written with NEON intrinsics. This causes unnecessary CPU usage and degraded performance during real-time audio compression/decompression. **Steps to reproduce**: 1. Open
https://webrtc.github.io/samples/src/content/peerconnection/pc1/
and establish "call"; 2. Capture CPU profile of Safari's processes with Instruments; **Actual result**: OPUS encoding uses fallback C implementations of functions like `silk_NSQ_del_dec_c`, `clt_mdct_forward_c` and `silk_LPC_inverse_pred_gain_c`. **Expected result**: OPUS encoding uses optimized NEON implementations like `silk_NSQ_del_dec_neon`, `op_pvq_search_c`, `clt_mdct_forward_neon` and `silk_LPC_inverse_pred_gain_neon` **Environment**: 1. Safari 18.5 on MacOS 15.5 (Apple M2 Pro); 2. Safari Technology Preview Release 222 (WebKit 20622.1.17.2) on MacOS 15.5 (Apple M2 Pro); 3. Safari 18.5 on iOS 18.5 (iPhone 11). a
Attachments
Flame graph of webrtc::AudioEncoderOpusImpl::EncodeImpl(unsigned int, rtc::ArrayView<short const, -4711l>, rtc::BufferT<unsigned char, false>*)
(829.56 KB, image/png)
2025-07-07 23:45 PDT
,
Yury Yarashevich
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2025-07-08 10:46:00 PDT
Is this the same as
bug 169884
?
Yury Yarashevich
Comment 2
2025-07-08 12:49:40 PDT
I've only noticed the existing issue after I've created this one, but it seems like original issue may be at least partially solved:
https://github.com/WebKit/WebKit/blob/8afd08557be462ffe1b3cf06cd39c806dcf37afc/Source/ThirdParty/libwebrtc/CMakeLists.txt#L2649-L2657
, but I don't x86_64 machine to check.
Sam Sneddon [:gsnedders]
Comment 3
2025-07-09 09:04:01 PDT
(In reply to Alexey Proskuryakov from
comment #1
)
> Is this the same as
bug 169884
?
Yes, and the resolved
bug 170592
. (In reply to Yury Yarashevich from
comment #2
)
> I've only noticed the existing issue after I've created this one, but it > seems like original issue may be at least partially solved: >
https://github.com/WebKit/WebKit/blob/
> 8afd08557be462ffe1b3cf06cd39c806dcf37afc/Source/ThirdParty/libwebrtc/ > CMakeLists.txt#L2649-L2657, but I don't x86_64 machine to check.
The Apple ports don't use cmake. Looking at the code, I wonder if this is because we define OPUS_ARM_PRESUME_AARCH64_NEON_INTR but not OPUS_ARM_PRESUME_NEON_INTR — so we only get A64-only NEON instructions, not the ones shared with A32. *** This bug has been marked as a duplicate of
bug 169884
***
Sam Sneddon [:gsnedders]
Comment 4
2025-07-09 09:04:53 PDT
(I didn't mean to close this as a duplicate after noticing the above.)
Yury Yarashevich
Comment 5
2025-07-11 05:07:13 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/47884
Radar WebKit Bug Importer
Comment 6
2025-07-14 23:46:12 PDT
<
rdar://problem/155851882
>
EWS
Comment 7
2025-07-31 06:28:13 PDT
Committed
298080@main
(bc484ce61b8e): <
https://commits.webkit.org/298080@main
> Reviewed commits have been landed. Closing PR #47884 and removing active labels.
WebKit Commit Bot
Comment 8
2025-07-31 08:24:46 PDT
Re-opened since this is blocked by
bug 296744
Yury Yarashevich
Comment 9
2025-07-31 23:33:58 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/48818
EWS
Comment 10
2025-08-19 04:17:46 PDT
Committed
298886@main
(5ddd462f59cd): <
https://commits.webkit.org/298886@main
> Reviewed commits have been landed. Closing PR #48818 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug