upipe-ebur128/ebur128.h header reference
Members
Types
- enum channel
- typedef [...] ebur128_state
- enum error
- enum mode
Functions
- int ebur128_add_frames_double(ebur128_state *st, const double *src, size_t frames)
- int ebur128_add_frames_float(ebur128_state *st, const float *src, size_t frames)
- int ebur128_add_frames_int(ebur128_state *st, const int *src, size_t frames)
- int ebur128_add_frames_short(ebur128_state *st, const short *src, size_t frames)
- int ebur128_change_parameters(ebur128_state *st, unsigned int channels, unsigned long samplerate)
- void ebur128_destroy(ebur128_state **st)
- void ebur128_get_version(int *major, int *minor, int *patch)
- ebur128_state * ebur128_init(unsigned int channels, unsigned long samplerate, int mode)
- int ebur128_loudness_global(ebur128_state *st, double *out)
- int ebur128_loudness_global_multiple(ebur128_state **sts, size_t size, double *out)
- int ebur128_loudness_momentary(ebur128_state *st, double *out)
- int ebur128_loudness_range(ebur128_state *st, double *out)
- int ebur128_loudness_range_multiple(ebur128_state **sts, size_t size, double *out)
- int ebur128_loudness_shortterm(ebur128_state *st, double *out)
- int ebur128_sample_peak(ebur128_state *st, unsigned int channel_number, double *out)
- int ebur128_set_channel(ebur128_state *st, unsigned int channel_number, int value)
- int ebur128_true_peak(ebur128_state *st, unsigned int channel_number, double *out)
Macro
Members detail
This struct is declared in upipe-ebur128/ebur128.h source file, line 74.
\brief Contains information about the state of a loudness measurement.
You should not need to modify this struct directly.
Field | Description |
---|---|
int mode; | |
unsigned int channels; | < The current mode. |
unsigned long samplerate; | < The number of channels. |
struct ebur128_state_internal *d; | < The sample rate. |
See also ebur128_state typedef.
This macro is declared in upipe-ebur128/ebur128.h source file, line 3.
This macro is declared in upipe-ebur128/ebur128.h source file, line 14.
\file ebur128.h \brief libebur128 - a library for loudness measurement according to the EBU R128 standard.
This macro is declared in upipe-ebur128/ebur128.h source file, line 15.
This macro is declared in upipe-ebur128/ebur128.h source file, line 16.
This enum is declared in upipe-ebur128/ebur128.h source file, line 24.
\enum channel Use these values when setting the channel map with ebur128_set_channel().
Identifier | Value | Description |
---|---|---|
EBUR128_UNUSED | 0 | |
EBUR128_LEFT | 1 | < unused channel (for example LFE channel) |
EBUR128_RIGHT | 2 | < left channel |
EBUR128_CENTER | 3 | < right channel |
EBUR128_LEFT_SURROUND | 4 | < center channel |
EBUR128_RIGHT_SURROUND | 5 | < left surround channel |
EBUR128_DUAL_MONO | 6 | < a channel that is counted twice |
int ebur128_add_frames_double(ebur128_state *st, const double *src, size_t frames)
This function is declared in upipe-ebur128/ebur128.h source file, line 168.
\brief See \ref ebur128_add_frames_short
int ebur128_add_frames_float(ebur128_state *st, const float *src, size_t frames)
This function is declared in upipe-ebur128/ebur128.h source file, line 164.
\brief See \ref ebur128_add_frames_short
int ebur128_add_frames_int(ebur128_state *st, const int *src, size_t frames)
This function is declared in upipe-ebur128/ebur128.h source file, line 160.
\brief See \ref ebur128_add_frames_short
int ebur128_add_frames_short(ebur128_state *st, const short *src, size_t frames)
This function is declared in upipe-ebur128/ebur128.h source file, line 156.
\brief Add frames to be processed.
Parameters list:
- st: library state.
- src: array of source frames. Channels must be interleaved.
- frames: number of frames. Not number of samples!
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_NOMEM on memory allocation error.
int ebur128_change_parameters(ebur128_state *st, unsigned int channels, unsigned long samplerate)
This function is declared in upipe-ebur128/ebur128.h source file, line 143.
\brief Change library parameters.
Note that the channel map will be reset when setting a different number of channels. The current unfinished block will be lost.
Parameters list:
- st: library state.
- channels: new number of channels.
- samplerate: new sample rate.
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_NOMEM on memory allocation error. The state will be invalid and must be destroyed. - EBUR128_ERROR_NO_CHANGE if channels and sample rate were not changed.
void ebur128_destroy(ebur128_state **st)
This function is declared in upipe-ebur128/ebur128.h source file, line 104.
\brief Destroy library state.
Parameters list:
- st: pointer to a library state.
This function is declared in upipe-ebur128/ebur128.h source file, line 87.
\brief Get library version number. Do not pass null pointers here.
Parameters list:
- major: major version number of library
- minor: minor version number of library
- patch: patch version number of library
ebur128_state * ebur128_init(unsigned int channels, unsigned long samplerate, int mode)
This function is declared in upipe-ebur128/ebur128.h source file, line 98.
\brief Initialize library state.
Parameters list:
- channels: the number of channels.
- samplerate: the sample rate.
- mode: see the mode enum for possible values.
The return value is an initialized library state.
int ebur128_loudness_global(ebur128_state *st, double *out)
This function is declared in upipe-ebur128/ebur128.h source file, line 179.
\brief Get global integrated loudness in LUFS.
Parameters list:
- st: library state.
- out: integrated loudness in LUFS. -HUGE_VAL if result is negative infinity.
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_INVALID_MODE if mode "EBUR128_MODE_I" has not been set.
int ebur128_loudness_global_multiple(ebur128_state **sts, size_t size, double *out)
This function is declared in upipe-ebur128/ebur128.h source file, line 192.
\brief Get global integrated loudness in LUFS across multiple instances.
Parameters list:
- sts: array of library states.
- size: length of sts
- out: integrated loudness in LUFS. -HUGE_VAL if result is negative infinity.
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_INVALID_MODE if mode "EBUR128_MODE_I" has not been set.
int ebur128_loudness_momentary(ebur128_state *st, double *out)
This function is declared in upipe-ebur128/ebur128.h source file, line 202.
\brief Get momentary loudness (last 400ms) in LUFS.
Parameters list:
- st: library state.
- out: momentary loudness in LUFS. -HUGE_VAL if result is negative infinity.
The return value is - EBUR128_SUCCESS on success.
int ebur128_loudness_range(ebur128_state *st, double *out)
This function is declared in upipe-ebur128/ebur128.h source file, line 227.
\brief Get loudness range (LRA) of programme in LU.
Calculates loudness range according to EBU 3342.
Parameters list:
- st: library state.
- out: loudness range (LRA) in LU. Will not be changed in case of error. EBUR128_ERROR_NOMEM or EBUR128_ERROR_INVALID_MODE will be returned in this case.
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_NOMEM in case of memory allocation error. - EBUR128_ERROR_INVALID_MODE if mode "EBUR128_MODE_LRA" has not been set.
int ebur128_loudness_range_multiple(ebur128_state **sts, size_t size, double *out)
This function is declared in upipe-ebur128/ebur128.h source file, line 244.
\brief Get loudness range (LRA) in LU across multiple instances.
Calculates loudness range according to EBU 3342.
Parameters list:
- sts: array of library states.
- size: length of sts
- out: loudness range (LRA) in LU. Will not be changed in case of error. EBUR128_ERROR_NOMEM or EBUR128_ERROR_INVALID_MODE will be returned in this case.
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_NOMEM in case of memory allocation error. - EBUR128_ERROR_INVALID_MODE if mode "EBUR128_MODE_LRA" has not been set.
int ebur128_loudness_shortterm(ebur128_state *st, double *out)
This function is declared in upipe-ebur128/ebur128.h source file, line 212.
\brief Get short-term loudness (last 3s) in LUFS.
Parameters list:
- st: library state.
- out: short-term loudness in LUFS. -HUGE_VAL if result is negative infinity.
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_INVALID_MODE if mode "EBUR128_MODE_S" has not been set.
int ebur128_sample_peak(ebur128_state *st, unsigned int channel_number, double *out)
This function is declared in upipe-ebur128/ebur128.h source file, line 259.
\brief Get maximum sample peak of selected channel in float format.
Parameters list:
- st: library state
- channel_number: channel to analyse
- out: maximum sample peak in float format (1.0 is 0 dBFS)
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_INVALID_MODE if mode "EBUR128_MODE_SAMPLE_PEAK" has not been set. - EBUR128_ERROR_INVALID_CHANNEL_INDEX if invalid channel index.
int ebur128_set_channel(ebur128_state *st, unsigned int channel_number, int value)
This function is declared in upipe-ebur128/ebur128.h source file, line 125.
\brief Set channel type.
The default is: - 0 -> EBUR128_LEFT - 1 -> EBUR128_RIGHT - 2 -> EBUR128_CENTER - 3 -> EBUR128_UNUSED - 4 -> EBUR128_LEFT_SURROUND - 5 -> EBUR128_RIGHT_SURROUND
Parameters list:
- st: library state.
- channel_number: zero based channel index.
- value: channel type from the "channel" enum.
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_INVALID_CHANNEL_INDEX if invalid channel index.
typedef struct <anonymous> ebur128_state
This typedef is declared in upipe-ebur128/ebur128.h source file, line 79.
< Internal state.
int ebur128_true_peak(ebur128_state *st, unsigned int channel_number, double *out)
This function is declared in upipe-ebur128/ebur128.h source file, line 282.
\brief Get maximum true peak of selected channel in float format.
Uses an implementation defined algorithm to calculate the true peak. Do not try to compare resulting values across different versions of the library, as the algorithm may change.
The current implementation uses the Speex resampler with quality level 8 to calculate true peak. Will oversample 4x for sample rates < 96000 Hz, 2x for sample rates < 192000 Hz and leave the signal unchanged for 192000 Hz.
Parameters list:
- st: library state
- channel_number: channel to analyse
- out: maximum true peak in float format (1.0 is 0 dBFS)
The return value is - EBUR128_SUCCESS on success. - EBUR128_ERROR_INVALID_MODE if mode "EBUR128_MODE_TRUE_PEAK" has not been set. - EBUR128_ERROR_INVALID_CHANNEL_INDEX if invalid channel index.
This enum is declared in upipe-ebur128/ebur128.h source file, line 37.
\enum error Error return values.
Identifier | Value | Description |
---|---|---|
EBUR128_SUCCESS | 0 | |
EBUR128_ERROR_NOMEM | 1 | |
EBUR128_ERROR_INVALID_MODE | 2 | |
EBUR128_ERROR_INVALID_CHANNEL_INDEX | 3 | |
EBUR128_ERROR_NO_CHANGE | 4 |
This enum is declared in upipe-ebur128/ebur128.h source file, line 49.
\enum mode Use these values in ebur128_init (or'ed). Try to use the lowest possible modes that suit your needs, as performance will be better.
Identifier | Value | Description |
---|---|---|
EBUR128_MODE_M | (1<<0) | can call ebur128_loudness_momentary |
EBUR128_MODE_S | (1<<1)|EBUR128_MODE_M | can call ebur128_loudness_shortterm |
EBUR128_MODE_I | (1<<2)|EBUR128_MODE_M | can call ebur128_gated_loudness_* |
EBUR128_MODE_LRA | (1<<3)|EBUR128_MODE_S | can call ebur128_loudness_range |
EBUR128_MODE_SAMPLE_PEAK | (1<<4)|EBUR128_MODE_M | can call ebur128_sample_peak |
EBUR128_MODE_TRUE_PEAK | (1<<5)|EBUR128_MODE_M|EBUR128_MODE_SAMPLE_PEAK | can call ebur128_true_peak |
EBUR128_MODE_HISTOGRAM | (1<<6) | uses histogram algorithm to calculate loudness |