Skip to content

Look up pulse counts for small bit budgets - #267

Merged
thomas-vilte merged 1 commit into
pion:mainfrom
thomas-vilte:celt-pulse-inverse-table
Nov 20, 2026
Merged

thomas-vilte merged 1 commit into
pion:mainfrom
thomas-vilte:celt-pulse-inverse-table

Conversation

@thomas-vilte

Copy link
Copy Markdown
Member

Description

bitsToPulses runs a six-step search over the pulse cache for every band of every frame, in both the encoder and the decoder. The cache never changes, so I precompute the result for budgets up to 256 eighth-bits. Bands that share a cache start share a row, so it ends up as 23 rows. Bigger budgets still go through the search.

The test checks every cache index and budget against the original search, ties included. Packets and decoded PCM are the same as before. It's a small one: about 2-3% off decoding and up to 2% off encoding on my test tracks.

Reference issue

N/A

bitsToPulses ran a six-step search over the pulse-cost cache for every
band. Invert the static cost tables once for budgets up to 256
eighth-bits, with one row per distinct cache start; larger budgets
keep the search. The pulse counts don't change.
@thomas-vilte
thomas-vilte requested a review from JoTurk November 17, 2026 23:12
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.90%. Comparing base (fe19d36) to head (3a9795f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #267      +/-   ##
==========================================
+ Coverage   95.88%   95.90%   +0.01%     
==========================================
  Files          68       69       +1     
  Lines       10654    10675      +21     
==========================================
+ Hits        10216    10238      +22     
+ Misses        438      437       -1     
Flag Coverage Δ
go 95.90% <100.00%> (+0.01%) ⬆️

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
thomas-vilte merged commit 2affb00 into pion:main Nov 20, 2026
23 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