Implement SILK stereo decoding#92
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #92 +/- ##
==========================================
+ Coverage 77.51% 79.02% +1.50%
==========================================
Files 8 8
Lines 1352 1535 +183
==========================================
+ Hits 1048 1213 +165
- Misses 270 276 +6
- Partials 34 46 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds SILK stereo support to the Opus decoder path, enabling mid/side stereo decoding and ensuring resampling/bitdepth conversion preserves stereo interleaving.
Changes:
- Implement SILK mid/side stereo decoding, mid-only side skipping, and stereo unmixing per RFC 6716.
- Make resampling and float32→s16 conversion channel-aware to preserve interleaved stereo during upsampling.
- Extend/update tests for stereo decoding behavior, stereo iCDF tables, mono delay, and interleaved upsampling.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
decoder.go |
Tracks decoded sample count; sizes SILK buffer for stereo; uses channel-aware upsample/bitdepth conversion. |
decoder_test.go |
Updates internal decode call sites for new return signature. |
packet_test.go |
Adjusts tests for new decode signature; validates stereo buffer sizing behavior. |
internal/silk/decoder.go |
Implements stereo weight decode, mid-only flag, mono delay, side decoder state handling, and stereo unmixing. |
internal/silk/decoder_test.go |
Replaces stereo “TODO” with functional tests; adds targeted coverage for new stereo/mono-delay logic. |
internal/silk/icdf.go |
Adds stereo iCDF tables (weights + mid-only). |
internal/resample/resample.go |
Updates Up to be channel-aware and return validation errors. |
internal/resample/resample_test.go |
Adds tests for mono/stereo interleaved upsampling and validation errors. |
internal/bitdepth/bitdepth.go |
Makes float32→s16 conversion channel-aware with resample repetition and input validation. |
internal/bitdepth/bitdepth_test.go |
Adds stereo + resample coverage and validation/error tests. |
internal/rangecoding/decoder.go |
Comment formatting/alignment changes only. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| mid := make([]float32, frameSampleCount) | ||
| if err := d.decodeFrame( | ||
| mid, | ||
| midVoiceActivityDetected[i], | ||
| silkFrameNanoseconds, | ||
| bandwidth, | ||
| i == 0, | ||
| false, | ||
| ); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| side := make([]float32, frameSampleCount) | ||
| if !midOnly { |
There was a problem hiding this comment.
decodeStereo allocates fresh mid and side buffers on every SILK frame (make([]float32, frameSampleCount)), which will add GC pressure in steady-state decoding (packets at 50/100 fps). Consider reusing per-decoder scratch buffers (e.g., fields on Decoder sized to maxSilkFrameSampleCount) or decoding into preallocated slices reused across loop iterations, and only allocating when the required size grows.
4f92db0 to
781a283
Compare
What changed