Skip k-weighting when no loudness mode is requested#64
Open
dholroyd wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_PEAKandMode::SAMPLE_PEAK: PreviouslyMode::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 theMbit from both peak modes; allowing peak-only construction without anaudio_databuffer. Also threads acalculate_loudnessflag intoFilterso the biquad loop,filter_stateupdates, anddestwrites are skipped entirely when no loudness metric is requested.Hopefully this represents a useful optimisation rather than a misunderstanding on my part 😅