FFmpeg
|
EBU R.128 implementation. More...
#include <math.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/dict.h"
#include "libavutil/ffmath.h"
#include "libavutil/xga_font_data.h"
#include "libavutil/opt.h"
#include "libavutil/timestamp.h"
#include "libswresample/swresample.h"
#include "audio.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
Go to the source code of this file.
Data Structures | |
struct | hist_entry |
A histogram is an array of HIST_SIZE hist_entry storing all the energies recorded (with an accuracy of 1/HIST_GRAIN) of the loudnesses from ABS_THRES (at 0) to ABS_UP_THRES (at HIST_SIZE-1). More... | |
struct | integrator |
struct | rect |
struct | EBUR128Context |
Macros | |
#define | MAX_CHANNELS 63 |
#define | PRE_B0 1.53512485958697 |
#define | PRE_B1 -2.69169618940638 |
#define | PRE_B2 1.19839281085285 |
#define | PRE_A1 -1.69065929318241 |
#define | PRE_A2 0.73248077421585 |
#define | RLB_B0 1.0 |
#define | RLB_B1 -2.0 |
#define | RLB_B2 1.0 |
#define | RLB_A1 -1.99004745483398 |
#define | RLB_A2 0.99007225036621 |
#define | ABS_THRES -70 |
silence gate: we discard anything below this absolute (LUFS) threshold More... | |
#define | ABS_UP_THRES 10 |
upper loud limit to consider (ABS_THRES being the minimum) More... | |
#define | HIST_GRAIN 100 |
defines histogram precision More... | |
#define | HIST_SIZE ((ABS_UP_THRES - ABS_THRES) * HIST_GRAIN + 1) |
#define | I400_BINS (48000 * 4 / 10) |
#define | I3000_BINS (48000 * 3) |
#define | OFFSET(x) offsetof(EBUR128Context, x) |
#define | A AV_OPT_FLAG_AUDIO_PARAM |
#define | V AV_OPT_FLAG_VIDEO_PARAM |
#define | F AV_OPT_FLAG_FILTERING_PARAM |
#define | FONT8 0 |
#define | FONT16 1 |
#define | PAD 8 |
#define | DRAW_RECT(r) |
#define | BACK_MASK |
#define | ENERGY(loudness) (ff_exp10(((loudness) + 0.691) / 10.)) |
#define | LOUDNESS(energy) (-0.691 + 10 * log10(energy)) |
#define | DBFS(energy) (20 * log10(energy)) |
#define | HIST_POS(power) (int)(((power) - ABS_THRES) * HIST_GRAIN) |
#define | MOVE_TO_NEXT_CACHED_ENTRY(time) |
#define | FILTER(Y, X, name) |
#define | COMPUTE_LOUDNESS(m, time) |
#define | I_GATE_THRES -10 |
#define | LRA_GATE_THRES -20 |
#define | LRA_LOWER_PRC 10 |
#define | LRA_HIGHER_PRC 95 |
#define | LOG_FMT "TARGET:%d LUFS M:%6.1f S:%6.1f I:%6.1f %s LRA:%6.1f LU" |
#define | META_PREFIX "lavfi.r128." |
#define | SET_META(name, var) |
#define | SET_META_PEAK(name, ptype) |
#define | PRINT_PEAKS(str, sp, ptype) |
#define | PRINT_PEAK_SUMMARY(str, sp, ptype) |
Enumerations | |
enum | { PEAK_MODE_NONE = 0, PEAK_MODE_SAMPLES_PEAKS = 1<<1, PEAK_MODE_TRUE_PEAKS = 1<<2 } |
enum | { GAUGE_TYPE_MOMENTARY = 0, GAUGE_TYPE_SHORTTERM = 1 } |
enum | { SCALE_TYPE_ABSOLUTE = 0, SCALE_TYPE_RELATIVE = 1 } |
Functions | |
AVFILTER_DEFINE_CLASS (ebur128) | |
static const uint8_t * | get_graph_color (const EBUR128Context *ebur128, int v, int y) |
static int | lu_to_y (const EBUR128Context *ebur128, double v) |
static void | drawtext (AVFrame *pic, int x, int y, int ftid, const uint8_t *color, const char *fmt,...) |
static void | drawline (AVFrame *pic, int x, int y, int len, int step) |
static int | config_video_output (AVFilterLink *outlink) |
static int | config_audio_input (AVFilterLink *inlink) |
static int | config_audio_output (AVFilterLink *outlink) |
static struct hist_entry * | get_histogram (void) |
static av_cold int | init (AVFilterContext *ctx) |
static int | gate_update (struct integrator *integ, double power, double loudness, int gate_thres) |
static int | filter_frame (AVFilterLink *inlink, AVFrame *insamples) |
static int | query_formats (AVFilterContext *ctx) |
static av_cold void | uninit (AVFilterContext *ctx) |
Variables | |
static const AVOption | ebur128_options [] |
static const uint8_t | graph_colors [] |
static const uint8_t | font_colors [] |
static const AVFilterPad | ebur128_inputs [] |
AVFilter | ff_af_ebur128 |
EBU R.128 implementation.
implement start/stop/reset through filter command injection
support other frequencies to avoid resampling
Definition in file f_ebur128.c.
#define MAX_CHANNELS 63 |
Definition at line 46 of file f_ebur128.c.
#define PRE_B0 1.53512485958697 |
Definition at line 49 of file f_ebur128.c.
#define PRE_B1 -2.69169618940638 |
Definition at line 50 of file f_ebur128.c.
#define PRE_B2 1.19839281085285 |
Definition at line 51 of file f_ebur128.c.
#define PRE_A1 -1.69065929318241 |
Definition at line 52 of file f_ebur128.c.
#define PRE_A2 0.73248077421585 |
Definition at line 53 of file f_ebur128.c.
#define RLB_B0 1.0 |
Definition at line 56 of file f_ebur128.c.
#define RLB_B1 -2.0 |
Definition at line 57 of file f_ebur128.c.
#define RLB_B2 1.0 |
Definition at line 58 of file f_ebur128.c.
#define RLB_A1 -1.99004745483398 |
Definition at line 59 of file f_ebur128.c.
#define RLB_A2 0.99007225036621 |
Definition at line 60 of file f_ebur128.c.
#define ABS_THRES -70 |
silence gate: we discard anything below this absolute (LUFS) threshold
Definition at line 62 of file f_ebur128.c.
Referenced by filter_frame(), get_histogram(), and init().
#define ABS_UP_THRES 10 |
upper loud limit to consider (ABS_THRES being the minimum)
Definition at line 63 of file f_ebur128.c.
#define HIST_GRAIN 100 |
defines histogram precision
Definition at line 64 of file f_ebur128.c.
Referenced by get_histogram().
#define HIST_SIZE ((ABS_UP_THRES - ABS_THRES) * HIST_GRAIN + 1) |
Definition at line 65 of file f_ebur128.c.
Referenced by filter(), filter_frame(), gate_update(), get_histogram(), and init().
#define I400_BINS (48000 * 4 / 10) |
Definition at line 132 of file f_ebur128.c.
Referenced by config_audio_output().
#define I3000_BINS (48000 * 3) |
Definition at line 133 of file f_ebur128.c.
Referenced by config_audio_output().
#define OFFSET | ( | x | ) | offsetof(EBUR128Context, x) |
Definition at line 168 of file f_ebur128.c.
#define A AV_OPT_FLAG_AUDIO_PARAM |
Definition at line 169 of file f_ebur128.c.
#define V AV_OPT_FLAG_VIDEO_PARAM |
Definition at line 170 of file f_ebur128.c.
#define F AV_OPT_FLAG_FILTERING_PARAM |
Definition at line 171 of file f_ebur128.c.
#define FONT8 0 |
Definition at line 239 of file f_ebur128.c.
Referenced by config_video_output(), and drawtext().
#define FONT16 1 |
Definition at line 240 of file f_ebur128.c.
Referenced by drawtext(), and filter_frame().
#define PAD 8 |
Referenced by config_video_output(), and filter_frame().
#define DRAW_RECT | ( | r | ) |
Referenced by config_video_output().
#define BACK_MASK |
Referenced by config_audio_output().
#define ENERGY | ( | loudness | ) | (ff_exp10(((loudness) + 0.691) / 10.)) |
Definition at line 477 of file f_ebur128.c.
Referenced by get_histogram().
#define LOUDNESS | ( | energy | ) | (-0.691 + 10 * log10(energy)) |
Definition at line 478 of file f_ebur128.c.
Referenced by filter_frame(), gate_update(), and sbc_unpack_frame().
#define DBFS | ( | energy | ) | (20 * log10(energy)) |
Definition at line 479 of file f_ebur128.c.
#define HIST_POS | ( | power | ) | (int)(((power) - ABS_THRES) * HIST_GRAIN) |
Definition at line 561 of file f_ebur128.c.
Referenced by gate_update().
#define MOVE_TO_NEXT_CACHED_ENTRY | ( | time | ) |
Referenced by filter_frame().
Referenced by filter_frame().
#define COMPUTE_LOUDNESS | ( | m, | |
time | |||
) |
Referenced by filter_frame().
#define I_GATE_THRES -10 |
Referenced by filter_frame().
#define LRA_GATE_THRES -20 |
Referenced by filter_frame().
#define LRA_LOWER_PRC 10 |
Referenced by filter_frame().
#define LRA_HIGHER_PRC 95 |
Referenced by filter_frame().
#define LOG_FMT "TARGET:%d LUFS M:%6.1f S:%6.1f I:%6.1f %s LRA:%6.1f LU" |
Referenced by filter_frame().
#define META_PREFIX "lavfi.r128." |
Referenced by filter_frame().
#define SET_META | ( | name, | |
var | |||
) |
Referenced by filter_frame().
#define SET_META_PEAK | ( | name, | |
ptype | |||
) |
Referenced by filter_frame().
#define PRINT_PEAKS | ( | str, | |
sp, | |||
ptype | |||
) |
Referenced by filter_frame().
#define PRINT_PEAK_SUMMARY | ( | str, | |
sp, | |||
ptype | |||
) |
Referenced by uninit().
anonymous enum |
Enumerator | |
---|---|
PEAK_MODE_NONE | |
PEAK_MODE_SAMPLES_PEAKS | |
PEAK_MODE_TRUE_PEAKS |
Definition at line 152 of file f_ebur128.c.
anonymous enum |
Enumerator | |
---|---|
GAUGE_TYPE_MOMENTARY | |
GAUGE_TYPE_SHORTTERM |
Definition at line 158 of file f_ebur128.c.
anonymous enum |
Enumerator | |
---|---|
SCALE_TYPE_ABSOLUTE | |
SCALE_TYPE_RELATIVE |
Definition at line 163 of file f_ebur128.c.
AVFILTER_DEFINE_CLASS | ( | ebur128 | ) |
|
static |
Definition at line 221 of file f_ebur128.c.
Referenced by config_video_output(), and filter_frame().
|
inlinestatic |
Definition at line 231 of file f_ebur128.c.
Referenced by config_video_output(), and filter_frame().
|
static |
Definition at line 247 of file f_ebur128.c.
Referenced by config_video_output(), and filter_frame().
Definition at line 280 of file f_ebur128.c.
|
static |
Definition at line 291 of file f_ebur128.c.
Referenced by init().
|
static |
Definition at line 386 of file f_ebur128.c.
|
static |
Definition at line 404 of file f_ebur128.c.
Referenced by init().
|
static |
Definition at line 481 of file f_ebur128.c.
Referenced by init().
|
static |
Definition at line 495 of file f_ebur128.c.
|
static |
Definition at line 565 of file f_ebur128.c.
Referenced by filter_frame().
|
static |
Definition at line 588 of file f_ebur128.c.
|
static |
Definition at line 893 of file f_ebur128.c.
|
static |
Definition at line 935 of file f_ebur128.c.
|
static |
Definition at line 172 of file f_ebur128.c.
|
static |
Definition at line 202 of file f_ebur128.c.
Referenced by get_graph_color().
|
static |
Definition at line 242 of file f_ebur128.c.
Referenced by config_video_output(), and filter_frame().
|
static |
Definition at line 998 of file f_ebur128.c.
AVFilter ff_af_ebur128 |
Definition at line 1008 of file f_ebur128.c.