Implement automatic and explicit bandwidth selection#152
Conversation
Encoder Quality ReportStatus: pass Tier 1 — SNR regression (96 kbps, pion encode → pion decode)Delta = baseline − current SNR; positive = regression. Fail threshold: 1.5 dB.
Tier 2 — opus_compare vs libopus (96 kbps CBR)Weighted error: lower is better. The gap reflects pion lacking constrained VBR; libopus ships with it enabled by default.
Run outputBaseline: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #152 +/- ##
==========================================
+ Coverage 87.96% 88.04% +0.08%
==========================================
Files 32 32
Lines 7692 7762 +70
==========================================
+ Hits 6766 6834 +68
- Misses 700 702 +2
Partials 226 226
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RFC 6716 / 8251 conformationStatus: pass The action extracts the RFC 6716 reference implementation, applies the RFC 8251 decoder update patch, and then builds the patched reference tools. Legend: numeric cells are Inputs use the shared RFC 6716 / RFC 8251 bitstream corpus; accepted references follow RFC 8251 Section 11.
Run output |
f96e9f1 to
e812e31
Compare
Description
Adds
WithBandwidth/SetBandwidth(explicit NB/WB/SWB/FB — mediumband gets rejected, CELT-only doesn't have a mediumband TOC config) andWithMaxBandwidth/SetMaxBandwidth(caps auto-selection without forcing a fixed bandwidth). Default staysBandwidthAuto.Auto-select picks a bandwidth from the target bitrate using the same thresholds as libopus's voice profile (9000/13500/14000 bps,
opus_encoder.c). First pass compared those against the raw configured bitrate, which is wrong — libopus compares againstequiv_rate, notbitrate, which docks ~8% for CBR and scales by complexity. Portedcompute_equiv_rate(skipped the frame-rate-overhead term, doesn't apply since we're fixed at 20ms/50fps, and skipped the "CELT complexity<5 has no pitch filter" penalty since our pre-filter always runs regardless of complexity now). TOC config numbers for CELT-only 20ms are 19/23/27/31 per bandwidth, matches the existingframeDuration()table in this same file.Also fixed a default that got lost somewhere in #150:
opus.NewEncoder()was defaultingcomplexityto 0 and stompingcelt.NewEncoder()'s own correct default of 5 viaSetComplexity(0). Rolling it in here since I'm already touching that same struct literal for the new bandwidth fields — meant every encoder built without an explicitWithComplexitywas silently gettingSPREAD_NONEinstead of the real spreading analysis.Reference issue
Fixes #...