[vlc-devel] [RFC PATCH 0/7] Loudness Meter plugin and player API

Thomas Guillem thomas at gllm.fr
Fri Aug 14 15:18:00 CEST 2020


Hello there,

Here is a RFC set adding a loudness meter plugin and API. Such API could be
used by Qt, Android, iOS, or macOS aps to display a vumeter in their UI.

This set add a new type of audio_filter: "audio meter", that is just used to
process samples without modifying them.

The ebur128 "audio meter" plugin use the MIT libebur128
https://github.com/jiixyj/libebur128  that implements the EBU R 128 standard
for loudness normalisation.

The measured loudness is passed by a vlc variable callback ("loudness-meter")
from the audio-filter plugin to the aout. The vlc_player is then listening to
this aout cb.

The loudness measurement can be quite demanding CPU wise. The plugin is added
only if a listener is present and can handle few modes:

 - Momentary loudness (last 400ms): very low CPU usage
 - Shortterm loudness (last 3sec): higher CPU usage
 - Integrated loudness (global): higher CPU usage
 - Loudness range: higher CPU usage
 - True Peak: higher CPU usage

For now, I added 2 modes in the vlc player API:
 - BEST_PERF: calculating only the Momentary Loudness
 - FULL: calculating everything

>From a very quick CPU bench, mp3 audio playback without UI is using around 2.5%
of CPU, same with or without Momentary loudness calculation. With Shortterm,
Integrated and Loudness range, it is taking around 5%. When True Peak is
added, it's more 7%.

I think it's interesting to propose the FULL loudness measurement from LibVLC
but our VLC apps should only use the BEST_PERF mode.

Question: should I add 5 modes (M, S, I, LU, TP) instead of 2 or keep it simple
and only propose the best_perfs mode.

Best regards,
Thomas Guillem (7):
  aout: add "audio-meter" filter type
  contrib: add libebur128
  audio_filter: add ebur128 "audio meter" plugin
  player: add vlc_player_aout_AddLoudnessMeter()
  demux: mock: use f32l by default for audio
  demux: mock: audio: output a sine wave by default
  player: test loudness_meter API

 configure.ac                      |   5 +
 contrib/src/libebur128/SHA512SUMS |   1 +
 contrib/src/libebur128/rules.mak  |  25 +++
 include/vlc_aout.h                |  14 ++
 include/vlc_player.h              |  76 ++++++++
 modules/audio_filter/Makefile.am  |   9 +-
 modules/audio_filter/libebur128.c | 290 ++++++++++++++++++++++++++++++
 modules/demux/Makefile.am         |   1 +
 modules/demux/mock.c              |  52 +++++-
 src/audio_output/filters.c        |   5 +
 src/audio_output/output.c         |  17 ++
 src/libvlccore.sym                |   2 +
 src/player/aout.c                 | 103 +++++++++++
 src/player/player.c               |   3 +
 src/player/player.h               |   9 +
 test/src/player/player.c          |  58 ++++++
 16 files changed, 665 insertions(+), 5 deletions(-)
 create mode 100644 contrib/src/libebur128/SHA512SUMS
 create mode 100644 contrib/src/libebur128/rules.mak
 create mode 100644 modules/audio_filter/libebur128.c

-- 
2.28.0



More information about the vlc-devel mailing list