Fix audio resampling: decoding in chunks should return identical samples to decoding in one go - #1614
Merged
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1614
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New Failures, 16 PendingAs of commit 2c0db37 with merge base 1f36e84 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Replaces [Resampler Grid Alignment] and [Resampler Preroll] with two notes that explain the problem with diagrams instead of prose, and that say how the pre-roll is sized.
NicolasHug
force-pushed
the
audio-resampler-alignment
branch
from
August 11, 2026 18:47
c75f51f to
a97d5d6
Compare
Contributor
Author
|
There are minor test failures on FFmpeg <= 6, I'm going to ignore them here as they seem to be green on the follow-up PRs. I suspect it's exactly what #1615 fixes. |
This was referenced Aug 12, 2026
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.
This is a fix for the audio decoder when resampling happens: a resampled stream in consecutive chunks must return exactly the same samples as decoding it in one go. See
test_resample_chunked_matches_fullfor the desired behavior and see the two bigNotes I added for details on the solution. In the main lines: we must align the input and output 'grid' for the resampler to output the right samples, and we enforce that through preroll + skipping some samples.This should address most of #1601 and specifically #1601 (comment)
Stack created with GitHub Stacks CLI • Give Feedback 💬