This normalizes the loudness of an audio stream to a target loudness
with a given maximum peak based on EBU R128.
Conceptually it keeps a 3s lookahead for calculating the perceived
loudness and based on that calculates the gain required to reach the
target loudness. The calculated gains then go through a gaussian filter
for smoothening and are then applied to the audio in 100ms blocks. Each
of the 100ms blocks is then passed to a limiter filter to prevent going
above the maximum peak.
See http://k.ylo.ph/2016/04/04/loudnorm.html for some more details about
the algorithm.
It introduces 3s of latency and currently only works on 192kHz audio.
Using it with a different sample rate requires resampling before and
afterwards. The upsampling is required to calculate the true peak.
Other than the ffmpeg filter it currently does not support two-pass
processing but only one-pass/live processing.
Compared to the ffmpeg filter this code was refactored considerably and
the limiter implementation was fixed to actually work, as well as
various other bugs in different places that were fixed.