Synthesize RFC 6716 CELT PCM output#108
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #108 +/- ##
==========================================
+ Coverage 82.32% 83.45% +1.13%
==========================================
Files 20 21 +1
Lines 3502 3899 +397
==========================================
+ Hits 2883 3254 +371
- Misses 492 508 +16
- Partials 127 137 +10
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:
|
RFC 6716 / 8251 conformationStatus: fail (informational) The action extracts the RFC 6716 reference implementation, applies the RFC 8251 decoder update patch, and then builds the patched reference tools. This check is informational while CELT support is incomplete; the workflow still reports success. Legend: numeric cells are rfc6716
rfc8251
Run output |
fbb5f71 to
748783a
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements the RFC 6716 CELT synthesis stage (time-domain PCM generation) after PVQ decoding, including overlap handling, postfilter application, and output interleaving, and expands tests to cover the new output path.
Changes:
- Add CELT synthesis pipeline: band denormalisation → inverse transform (MDCT) → postfilter → deemphasis/interleave.
- Extend CELT decoder state for synthesis/postfilter and add range-decoder sharing support for hybrid decode.
- Add new unit tests covering synthesis helpers and end-to-end decode output behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/celt/synthesis.go | New CELT synthesis implementation (inverse transform, overlap, postfilter, deemphasis). |
| internal/celt/synthesis_test.go | New tests for synthesis helpers and state transitions. |
| internal/celt/decoder.go | Adds CELT frame decode entrypoints, PLC path, synthesis invocation, and state management. |
| internal/celt/frame.go | Extends frame config with output channel count and supports external/shared range decoder. |
| internal/celt/frame_test.go | Updates existing tests for new side-info signature and adds decode/synthesis tests. |
| internal/bitdepth/bitdepth.go | Changes float→int16 quantization rounding behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Float32ToSigned16 quantizes a float32 PCM sample to signed 16-bit PCM. | ||
| func Float32ToSigned16(sample float32) int16 { | ||
| sample64 := math.Round(float64(sample * 32768)) | ||
| sample64 := math.Floor(0.5 + float64(sample*32768)) |
There was a problem hiding this comment.
Float32ToSigned16 now uses floor(0.5 + x) which rounds negative half-way values toward zero (e.g., -0.5 -> 0) instead of symmetric rounding. That introduces a DC bias vs the prior math.Round behavior and typical PCM quantization expectations. Consider restoring math.Round or implementing symmetric rounding (e.g., for negatives use -floor(0.5+abs(x))) and add a unit test that covers half-way negative values.
| sample64 := math.Floor(0.5 + float64(sample*32768)) | |
| sample64 := math.Round(float64(sample * 32768)) |
There was a problem hiding this comment.
The intention was to be on-par with C reference implementation; we can revert it here now
748783a to
6a41b34
Compare
Summary
Validation