Draft
Conversation
Agent-Logs-Url: https://github.com/jmg049/audio_samples/sessions/b1567262-89be-4ffa-b2c4-78fcd135736f Co-authored-by: jmg049 <121042936+jmg049@users.noreply.github.com>
…docs) Agent-Logs-Url: https://github.com/jmg049/audio_samples/sessions/b1567262-89be-4ffa-b2c4-78fcd135736f Co-authored-by: jmg049 <121042936+jmg049@users.noreply.github.com>
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.
Summary
Adds a structural Opus codec skeleton under
src/codecs/opus/, gated on a newopus-codecfeature flag (which depends onpsychoacoustic). This follows the same structural pattern as the existingPerceptualCodec/StereoPerceptualCodec, and extends the work started for the MP3 direction.Architecture
The implementation mirrors the real Opus (RFC 6716) two-codec design:
CELT reuse: the CELT path deliberately delegates to the existing
analyse_signal_with_window_size→allocate_bits→quantize→dequantize→reconstruct_signalpipeline, usingBandLayout::celt(RFC 6716 band edges) instead of Bark/Mel.SILK independence: the SILK path uses new
lpc.rsprimitives —compute_autocorrelation,levinson_durbin,lpc_residual,lpc_synthesis— that are pure time-domain and have no dependency on spectrograms.Auto-mode detection:
detect_modecomputes the Spectral Flatness Measure (SFM) of a frame and chooses SILK for speech-like signals (high tonal structure, low SFM) and CELT for music/noise.What lives in
audio_samples_ioBitstream packing (range coding, Ogg/RIFF containers),
.opusfile I/O, and LSF quantisation of LPC coefficients remain responsibilities of the IO crate. This module provides only the algorithmic core.Quality notes
CELT quality is bounded by the same MDCT window boundary effect that limits
PerceptualCodec(the existingcodec_qualitytests also fail). Each Opus frame is encoded as a single analysis window, so edge samples are windowed to near-zero by the Hanning function. This is a known sketch limitation documented inmod.rsand the test file.Changes
src/codecs/opus/(7 files, ~900 lines)src/codecs/mod.rs,src/lib.rs,Cargo.tomltests/opus_codec_quality.rs— 12 tests (12/12 pass)