Skip to content

Skip k-weighting when no loudness mode is requested#64

Open
dholroyd wants to merge 1 commit into
sdroege:mainfrom
dholroyd:skip-biquad-when-no-loudness-mode-is-requested
Open

Skip k-weighting when no loudness mode is requested#64
dholroyd wants to merge 1 commit into
sdroege:mainfrom
dholroyd:skip-biquad-when-no-loudness-mode-is-requested

Conversation

@dholroyd

@dholroyd dholroyd commented Jun 16, 2026

Copy link
Copy Markdown

I am looking at speeding up loudness processing by performing different parts of the work on different threads - specifically, putting the peak calculations on a different thread than the monetary / integrated loudness. While investigating this, I noticed that the thread where I requested peak calculations was still performing k-weighting filtering that drives monetary / integrated loudness. I think that the output of this filtering isn't used by the peak calculations, so this seems like a redundancy that could be removed.

Therefore this change alters the definitions of Mode::TRUE_PEAK and Mode::SAMPLE_PEAK: Previously Mode::M's bit was included their encoding, which resulted in running the BS.1770 k-weighting filter on every block even if the caller only wanted peak values and never read the filtered samples. This drops the M bit from both peak modes; allowing peak-only construction without an audio_data buffer. Also threads a calculate_loudness flag into Filter so the biquad loop, filter_state updates, and dest writes are skipped entirely when no loudness metric is requested.

Hopefully this represents a useful optimisation rather than a misunderstanding on my part 😅

Mode::TRUE_PEAK and Mode::SAMPLE_PEAK previously included Mode::M's bit
in their encoding, which forced EbuR128 to always run the BS.1770 biquad
on every block even when the caller only wanted peak values and never
read the filtered samples.

Drop the M bit from both peak modes; allow peak-only construction
without an audio_data buffer, and thread a calculate_loudness flag into
Filter so the biquad loop, filter_state updates, and dest writes are
skipped entirely when no loudness metric is requested.
@dholroyd dholroyd changed the title Skip biquad when no loudness mode is requested Skip k-weighting when no loudness mode is requested Jun 18, 2026
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.

1 participant