Skip to content

Add SILK frame orchestration and public EncodeSILK API - #166

Merged
thomas-vilte merged 2 commits into
pion:mainfrom
thomas-vilte:feat/silk-enc-frame
Jul 27, 2026
Merged

Add SILK frame orchestration and public EncodeSILK API#166
thomas-vilte merged 2 commits into
pion:mainfrom
thomas-vilte:feat/silk-enc-frame

Conversation

@thomas-vilte

@thomas-vilte thomas-vilte commented Jul 25, 2026

Copy link
Copy Markdown
Member

Description

this closes out the SILK encoder split from #147 — the last piece. It's the orchestrator that wires everything already merged in internal/silk/ into a full frame encode (VAD → pitch analysis → noise shaping → prediction coefs → NSQ → range-coded bitstream, in decode order) plus a public EncodeSILK method on the root Encoder

also lands the useInterpolatedNLSFs fix flagged as a known gap in #165:
findLPCNLSF 's interpolation search now only runs when complexity >= 4 , matching silk_setup_complexity in libopus. The root Encoder already had a complexity field wired to CELT, so this just threads it through to the SILK encoder too

EncodeSILK is a separate entry point from Encode / EncodeFloat32 , not an automatic CELT/SILK switch — bitrate based auto-selection still always picks CELT. This is for callers who specifically want a SILK-only voice packet

also applies a DC-block high-pass to EncodeSILK 's input ( applySILKDCBlock, reusing the same fixed 3Hz filter CELT's path already had from #137) — libopus applies this to the shared PCM ahead of both CELT and SILK, and EncodeSILK was skipping it entirely. The pitch-adaptive VoIP cutoff variant ( hp_cutoff in libopus) is not implemented; this only ports the fixed-cutoff dc_reject path

not implemented (disclosed, follow-up work): the rate-control bisection loop, LBRR, and DTX. This port is single-pass, same philosophy as the CELT encoder series (correct simple v1 first)

round-trip tested end to end: encode with both the internal silk.Encoder and the public EncodeSILK , decode with the real decoder, for all three SILK bandwidths (NB/MB/WB)

Reference issue

part of the #147 split. Closes out the split entirely — last piece

@thomas-vilte
thomas-vilte requested a review from FrantaBOT July 25, 2026 20:54
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.07%. Comparing base (aa7cd85) to head (486cf3f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #166      +/-   ##
==========================================
+ Coverage   90.85%   92.07%   +1.22%     
==========================================
  Files          54       55       +1     
  Lines        9576     9792     +216     
==========================================
+ Hits         8700     9016     +316     
+ Misses        638      547      -91     
+ Partials      238      229       -9     
Flag Coverage Δ
go 92.07% <100.00%> (+1.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

thomas-vilte and others added 2 commits July 25, 2026 18:24
@thomas-vilte
thomas-vilte force-pushed the feat/silk-enc-frame branch from a665b6c to 486cf3f Compare July 25, 2026 21:26
@thomas-vilte
thomas-vilte merged commit 3231895 into pion:main Jul 27, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants