FFmpeg
|
#include "ebur128.h"
#include <float.h>
#include <limits.h>
#include <math.h>
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/thread.h"
Go to the source code of this file.
Data Structures | |
struct | FFEBUR128StateInternal |
Macros | |
#define | CHECK_ERROR(condition, errorcode, goto_point) |
#define | ALMOST_ZERO 0.000001 |
#define | RELATIVE_GATE (-10.0) |
#define | RELATIVE_GATE_FACTOR pow(10.0, RELATIVE_GATE / 10.0) |
#define | MINUS_20DB pow(10.0, -20.0 / 10.0) |
#define | EBUR128_FILTER(type, scaling_factor) |
#define | FF_EBUR128_ADD_FRAMES_PLANAR(type) |
#define | FF_EBUR128_ADD_FRAMES(type) |
Functions | |
static void | ebur128_init_filter (FFEBUR128State *st) |
static int | ebur128_init_channel_map (FFEBUR128State *st) |
static void | init_histogram (void) |
FFEBUR128State * | ff_ebur128_init (unsigned int channels, unsigned long samplerate, unsigned long window, int mode) |
Initialize library state. More... | |
void | ff_ebur128_destroy (FFEBUR128State **st) |
Destroy library state. More... | |
EBUR128_FILTER (short, -(double) SHRT_MIN) | |
static size_t | find_histogram_index (double energy) |
static void | ebur128_calc_gating_block (FFEBUR128State *st, size_t frames_per_block, double *optional_output) |
int | ff_ebur128_set_channel (FFEBUR128State *st, unsigned int channel_number, int value) |
Set channel type. More... | |
static int | ebur128_energy_shortterm (FFEBUR128State *st, double *out) |
static int | ebur128_calc_relative_threshold (FFEBUR128State **sts, size_t size, double *relative_threshold) |
static int | ebur128_gated_loudness (FFEBUR128State **sts, size_t size, double *out) |
int | ff_ebur128_relative_threshold (FFEBUR128State *st, double *out) |
Get relative threshold in LUFS. More... | |
int | ff_ebur128_loudness_global (FFEBUR128State *st, double *out) |
Get global integrated loudness in LUFS. More... | |
int | ff_ebur128_loudness_global_multiple (FFEBUR128State **sts, size_t size, double *out) |
Get global integrated loudness in LUFS across multiple instances. More... | |
static int | ebur128_energy_in_interval (FFEBUR128State *st, size_t interval_frames, double *out) |
int | ff_ebur128_loudness_momentary (FFEBUR128State *st, double *out) |
Get momentary loudness (last 400ms) in LUFS. More... | |
int | ff_ebur128_loudness_shortterm (FFEBUR128State *st, double *out) |
Get short-term loudness (last 3s) in LUFS. More... | |
int | ff_ebur128_loudness_window (FFEBUR128State *st, unsigned long window, double *out) |
Get loudness of the specified window in LUFS. More... | |
int | ff_ebur128_loudness_range_multiple (FFEBUR128State **sts, size_t size, double *out) |
Get loudness range (LRA) in LU across multiple instances. More... | |
int | ff_ebur128_loudness_range (FFEBUR128State *st, double *out) |
Get loudness range (LRA) of programme in LU. More... | |
int | ff_ebur128_sample_peak (FFEBUR128State *st, unsigned int channel_number, double *out) |
Get maximum sample peak of selected channel in float format. More... | |
Variables | |
static AVOnce | histogram_init = AV_ONCE_INIT |
static double | histogram_energies [1000] |
static double | histogram_energy_boundaries [1001] |
#define CHECK_ERROR | ( | condition, | |
errorcode, | |||
goto_point | |||
) |
#define RELATIVE_GATE_FACTOR pow(10.0, RELATIVE_GATE / 10.0) |
|
static |
Definition at line 104 of file ebur128.c.
Referenced by ff_ebur128_init().
|
static |
Definition at line 154 of file ebur128.c.
Referenced by ff_ebur128_init().
|
inlinestatic |
Definition at line 202 of file ebur128.c.
Referenced by ff_ebur128_init().
FFEBUR128State* ff_ebur128_init | ( | unsigned int | channels, |
unsigned long | samplerate, | ||
unsigned long | window, | ||
int | mode | ||
) |
Initialize library state.
channels | the number of channels. |
samplerate | the sample rate. |
window | set the maximum window size in ms, set to 0 for auto. |
mode | see the mode enum for possible values. |
Definition at line 217 of file ebur128.c.
Referenced by config_input().
void ff_ebur128_destroy | ( | FFEBUR128State ** | st | ) |
|
static |
Definition at line 374 of file ebur128.c.
Referenced by ebur128_calc_gating_block(), ebur128_gated_loudness(), and ff_ebur128_loudness_range_multiple().
|
static |
Definition at line 392 of file ebur128.c.
Referenced by ebur128_energy_in_interval().
int ff_ebur128_set_channel | ( | FFEBUR128State * | st, |
unsigned int | channel_number, | ||
int | value | ||
) |
Set channel type.
The default is:
st | library state. |
channel_number | zero based channel index. |
value | channel type from the "channel" enum. |
Definition at line 446 of file ebur128.c.
Referenced by config_input().
|
static |
Definition at line 624 of file ebur128.c.
Referenced by ff_ebur128_loudness_shortterm().
|
static |
Definition at line 522 of file ebur128.c.
Referenced by ebur128_gated_loudness(), and ff_ebur128_relative_threshold().
|
static |
Definition at line 545 of file ebur128.c.
Referenced by ff_ebur128_loudness_global(), and ff_ebur128_loudness_global_multiple().
int ff_ebur128_relative_threshold | ( | FFEBUR128State * | st, |
double * | out | ||
) |
Get relative threshold in LUFS.
st | library state |
out | relative threshold in LUFS. |
Definition at line 587 of file ebur128.c.
Referenced by filter_frame(), and uninit().
int ff_ebur128_loudness_global | ( | FFEBUR128State * | st, |
double * | out | ||
) |
Get global integrated loudness in LUFS.
st | library state. |
out | integrated loudness in LUFS. -HUGE_VAL if result is negative infinity. |
Definition at line 603 of file ebur128.c.
Referenced by filter_frame(), and uninit().
int ff_ebur128_loudness_global_multiple | ( | FFEBUR128State ** | sts, |
size_t | size, | ||
double * | out | ||
) |
Get global integrated loudness in LUFS across multiple instances.
sts | array of library states. |
size | length of sts |
out | integrated loudness in LUFS. -HUGE_VAL if result is negative infinity. |
|
static |
Definition at line 614 of file ebur128.c.
Referenced by ebur128_energy_shortterm(), ff_ebur128_loudness_momentary(), and ff_ebur128_loudness_window().
int ff_ebur128_loudness_momentary | ( | FFEBUR128State * | st, |
double * | out | ||
) |
int ff_ebur128_loudness_shortterm | ( | FFEBUR128State * | st, |
double * | out | ||
) |
Get short-term loudness (last 3s) in LUFS.
st | library state. |
out | short-term loudness in LUFS. -HUGE_VAL if result is negative infinity. |
Definition at line 645 of file ebur128.c.
Referenced by filter_frame().
int ff_ebur128_loudness_window | ( | FFEBUR128State * | st, |
unsigned long | window, | ||
double * | out | ||
) |
Get loudness of the specified window in LUFS.
window must not be larger than the current window set in st.
st | library state. |
window | window in ms to calculate loudness. |
out | loudness in LUFS. -HUGE_VAL if result is negative infinity. |
int ff_ebur128_loudness_range_multiple | ( | FFEBUR128State ** | sts, |
size_t | size, | ||
double * | out | ||
) |
Get loudness range (LRA) in LU across multiple instances.
Calculates loudness range according to EBU 3342.
sts | array of library states. |
size | length of sts |
out | loudness range (LRA) in LU. Will not be changed in case of error. AVERROR(EINVAL) will be returned in this case. |
Definition at line 676 of file ebur128.c.
Referenced by ff_ebur128_loudness_range().
int ff_ebur128_loudness_range | ( | FFEBUR128State * | st, |
double * | out | ||
) |
Get loudness range (LRA) of programme in LU.
Calculates loudness range according to EBU 3342.
st | library state. |
out | loudness range (LRA) in LU. Will not be changed in case of error. AVERROR(EINVAL) will be returned in this case. |
Definition at line 753 of file ebur128.c.
Referenced by filter_frame(), and uninit().
int ff_ebur128_sample_peak | ( | FFEBUR128State * | st, |
unsigned int | channel_number, | ||
double * | out | ||
) |
Get maximum sample peak of selected channel in float format.
st | library state |
channel_number | channel to analyse |
out | maximum sample peak in float format (1.0 is 0 dBFS) |
Definition at line 758 of file ebur128.c.
Referenced by filter_frame(), and uninit().
|
static |
Definition at line 100 of file ebur128.c.
Referenced by ff_ebur128_init().
|
static |
Definition at line 101 of file ebur128.c.
Referenced by ebur128_calc_relative_threshold(), ebur128_gated_loudness(), ff_ebur128_loudness_range_multiple(), and init_histogram().
|
static |
Definition at line 102 of file ebur128.c.
Referenced by ebur128_calc_gating_block(), ebur128_gated_loudness(), ff_ebur128_loudness_range_multiple(), find_histogram_index(), and init_histogram().