v1.1.0
v1.1.0 β Full CELT Encoder Quality Pipeline
What's new
Encoder β full CELT quality pipeline (Phase 1+2)
v1.0.0 shipped a working but basic CELT encoder. v1.1.0 completes the quality
pipeline: the encoder now produces standard Opus packets that libopus 1.6.1
decodes correctly, with SNR competitive with a full-featured codec at 64 kbps.
Signal quality
| Signal | SNR (64 kbps) |
|---|---|
| 440 Hz sine | ~48 dB |
| 1 kHz sine | ~47 dB |
| 4 kHz sine | ~39 dB |
| 1 kHz stereo | ~43 dB |
New encoder features
- Signal-driven bandwidth detection β per-frame FFT power analysis selects NB/WB/SWB/FB automatically; asymmetric hysteresis prevents flapping. Manual override via
SetBandwidth/SetMaxBandwidth. - Application-coupled bandwidth β
ApplicationVOIPprefers narrower tiers for voice;ApplicationAudiouses music defaults. - Transient detection + short-block MDCT β time-domain HPF masking (
transientAnalysis) switches to 8Γ120-sample short blocks to limit pre-echo.patchTransientDecisionis a complementary band-energy fallback for onsets the time-domain detector misses. - tf_analysis β per-band transform-resolution RDO via 2-pass Viterbi.
- dynalloc / alloc_trim / spread β masking-follower dynamic allocation boost, spectral-tilt trim, spreading decision with recursive hysteresis.
- Stereo decisions β
stereoAnalysis(dual vs joint M/S), intensity stereo with hysteresis. - Anti-collapse β consecutive-transient bit prevents spectral collapse.
- VBR / CVBR rate control β
SetVBR(true)/SetVBRConstraint(true). - Multi-frame packetization β 20/40/60 ms packets (RFC 6716 Β§3.2 codes 0β3) including code-3 padding.
SetPacketPaddingfor explicit padding. - Silence detection + DTX β near-silent frames emit 2β3 byte packets;
SetDTXenables discontinuous transmission.
New public API
func (e *Encoder) SetVBRConstraint(constrained bool) // true = CVBR
func (e *Encoder) SetBandwidth(bw Bandwidth) // Auto/NB/WB/SWB/FB
func (e *Encoder) SetMaxBandwidth(bw Bandwidth)
func (e *Encoder) Bandwidth() Bandwidth
func (e *Encoder) SetDTX(dtx bool)
func (e *Encoder) SetPacketPadding(n int)
const BandwidthAuto Bandwidth = ... // plus BandwidthNB/WB/SWB/FBDecoder β unchanged
The decoder continues to pass all 12 official RFC 8251 test vectors (RMSE < 0.001) and matches the libopus 1.6.1 reference.
Not yet implemented: SILK encoder, hybrid (SILK+CELT) encoder, FEC/PLC encode. The encoder is not bit-exact with libopus.
Upgrade: go get github.com/darui3018823/opus@v1.1.0