Improve WavPack decoder performance#914
Merged
Merged
Conversation
There was a problem hiding this comment.
Cpp-linter Review
Used clang-format v22.1.6
Click here for the full clang-format patch
diff --git a/Sources/CSFBAudioEngine/Decoders/SFBWavPackDecoder.m b/Sources/CSFBAudioEngine/Decoders/SFBWavPackDecoder.m
index b6c0217..74a5d9a 100644
--- a/Sources/CSFBAudioEngine/Decoders/SFBWavPackDecoder.m
+++ b/Sources/CSFBAudioEngine/Decoders/SFBWavPackDecoder.m
@@ -331 +331 @@ static int can_seek_callback(void *id) {
- //int qmode = WavpackGetQualifyMode(_wpc);
+ // int qmode = WavpackGetQualifyMode(_wpc);
@@ -337 +337 @@ static int can_seek_callback(void *id) {
- //} else if(qmode & QMODE_DSD_AUDIO) {
+ //} else if(qmode & QMODE_DSD_AUDIO) {
@@ -467 +467 @@ static int can_seek_callback(void *id) {
- //int qmode = WavpackGetQualifyMode(_wpc);
+ // int qmode = WavpackGetQualifyMode(_wpc);
@@ -470 +470,2 @@ static int can_seek_callback(void *id) {
- memcpy((unsigned char *)buffer.audioBufferList->mBuffers[0].mData + buffer.audioBufferList->mBuffers[0].mDataByteSize,
+ memcpy((unsigned char *)buffer.audioBufferList->mBuffers[0].mData +
+ buffer.audioBufferList->mBuffers[0].mDataByteSize,
@@ -480 +481,2 @@ static int can_seek_callback(void *id) {
- uint32_t *dst = (uint32_t *)((unsigned char *)buffer.audioBufferList->mBuffers[0].mData + buffer.audioBufferList->mBuffers[0].mDataByteSize);
+ uint32_t *dst = (uint32_t *)((unsigned char *)buffer.audioBufferList->mBuffers[0].mData +
+ buffer.audioBufferList->mBuffers[0].mDataByteSize);
@@ -496 +498,2 @@ static int can_seek_callback(void *id) {
- memcpy((unsigned char *)buffer.audioBufferList->mBuffers[0].mData + buffer.audioBufferList->mBuffers[0].mDataByteSize,
+ memcpy((unsigned char *)buffer.audioBufferList->mBuffers[0].mData +
+ buffer.audioBufferList->mBuffers[0].mDataByteSize,
@@ -501 +504,2 @@ static int can_seek_callback(void *id) {
- float *dst = (float *)((unsigned char *)buffer.audioBufferList->mBuffers[0].mData + buffer.audioBufferList->mBuffers[0].mDataByteSize);
+ float *dst = (float *)((unsigned char *)buffer.audioBufferList->mBuffers[0].mData +
+ buffer.audioBufferList->mBuffers[0].mDataByteSize);
@@ -507 +511 @@ static int can_seek_callback(void *id) {
- //float scaleFactor = ldexpf(1.0f, -(WavpackGetBitsPerSample(_wpc) - 1));
+ // float scaleFactor = ldexpf(1.0f, -(WavpackGetBitsPerSample(_wpc) - 1));
Have any feedback or feature suggestions? Share it here.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve WavPack decoding throughput by switching the decoder’s PCM output to interleaved buffers and using bulk/vectorized operations (memcpy, SIMD, vDSP) instead of per-channel deinterleaving loops.
Changes:
- Switch WavPack decoder output formats from non-interleaved to interleaved for float and integer PCM.
- Replace manual deinterleaving/loops with bulk
memcpy, SIMD shifting for lossless integer alignment, and Accelerate/vDSP for lossy int→float conversion.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.