Skip to content

Fix WavPack sample shift#916

Merged
sbooth merged 1 commit into
mainfrom
wavpack-shift-fix
May 25, 2026
Merged

Fix WavPack sample shift#916
sbooth merged 1 commit into
mainfrom
wavpack-shift-fix

Conversation

@sbooth
Copy link
Copy Markdown
Owner

@sbooth sbooth commented May 25, 2026

For lossless decoding

Copilot AI review requested due to automatic review settings May 25, 2026 15:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes WavPack lossless sample shifting for non-byte-aligned bit depths by shifting based on bytes-per-sample rather than bits-per-sample. WavPack delivers samples low-aligned within the bytes used for the original data (e.g. 20-bit samples occupy 3 bytes), so shifting by 32 - bitsPerSample over-shifts and corrupts the high-aligned 32-bit output expected by the processing format.

Changes:

  • Replaced 32 - bitsPerSample with 32 - 8 * WavpackGetBytesPerSample(_wpc) in the lossless decode path.
  • Expanded the explanatory comment to clarify WavPack's low-alignment-within-byte-boundary behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sbooth sbooth merged commit c4ab347 into main May 25, 2026
3 checks passed
@sbooth sbooth deleted the wavpack-shift-fix branch May 25, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants