FFmpeg
|
#include "ebur128.h"
#include <float.h>
#include <limits.h>
#include <math.h>
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.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 | 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... | |
static double | ebur128_energy_to_loudness (double energy) |
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... | |
static int | ebur128_energy_in_interval (FFEBUR128State *st, size_t interval_frames, double *out) |
int | ff_ebur128_loudness_shortterm (FFEBUR128State *st, double *out) |
Get short-term loudness (last 3s) 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 105 of file ebur128.c.
Referenced by ff_ebur128_init().
|
static |
Definition at line 155 of file ebur128.c.
Referenced by ff_ebur128_init().
|
inlinestatic |
Definition at line 203 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 218 of file ebur128.c.
Referenced by config_input().
void ff_ebur128_destroy | ( | FFEBUR128State ** | st | ) |
|
static |
Definition at line 367 of file ebur128.c.
Referenced by ebur128_gated_loudness(), ff_ebur128_loudness_range_multiple(), ff_ebur128_loudness_shortterm(), and ff_ebur128_relative_threshold().
|
static |
Definition at line 372 of file ebur128.c.
Referenced by ebur128_calc_gating_block(), ebur128_gated_loudness(), and ff_ebur128_loudness_range_multiple().
|
static |
Definition at line 390 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 444 of file ebur128.c.
Referenced by config_input().
|
static |
Definition at line 610 of file ebur128.c.
Referenced by ff_ebur128_loudness_shortterm().
|
static |
Definition at line 514 of file ebur128.c.
Referenced by ebur128_gated_loudness(), and ff_ebur128_relative_threshold().
|
static |
Definition at line 537 of file ebur128.c.
Referenced by ff_ebur128_loudness_global().
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 579 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 595 of file ebur128.c.
Referenced by filter_frame(), and uninit().
|
static |
Definition at line 600 of file ebur128.c.
Referenced by ebur128_energy_shortterm().
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 616 of file ebur128.c.
Referenced by filter_frame().
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 631 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 708 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 713 of file ebur128.c.
Referenced by filter_frame(), and uninit().
|
static |
Definition at line 101 of file ebur128.c.
Referenced by ff_ebur128_init().
|
static |
Definition at line 102 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 103 of file ebur128.c.
Referenced by ebur128_calc_gating_block(), ebur128_gated_loudness(), ff_ebur128_loudness_range_multiple(), find_histogram_index(), and init_histogram().