FFmpeg
ebur128.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Jan Kokemüller
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  * This file is based on libebur128 which is available at
21  * https://github.com/jiixyj/libebur128/
22  *
23 */
24 
25 #ifndef AVFILTER_EBUR128_H
26 #define AVFILTER_EBUR128_H
27 
33 #include <stddef.h> /* for size_t */
34 
39 enum channel {
41  FF_EBUR128_LEFT,
43  FF_EBUR128_RIGHT,
45  FF_EBUR128_CENTER,
47  FF_EBUR128_LEFT_SURROUND,
49  FF_EBUR128_RIGHT_SURROUND,
77 };
78 
83 enum mode {
85  FF_EBUR128_MODE_M = (1 << 0),
94 };
95 
98 
103 typedef struct FFEBUR128State {
104  int mode;
105  unsigned int channels;
106  unsigned long samplerate;
109 
118 FFEBUR128State *ff_ebur128_init(unsigned int channels,
119  unsigned long samplerate,
120  unsigned long window, int mode);
121 
127 
146  unsigned int channel_number, int value);
147 
155  const short *src, size_t frames);
158  const int *src, size_t frames);
161  const float *src, size_t frames);
164  const double *src, size_t frames);
165 
174  const short **srcs,
175  size_t frames, int stride);
178  const int **srcs,
179  size_t frames, int stride);
182  const float **srcs,
183  size_t frames, int stride);
186  const double **srcs,
187  size_t frames, int stride);
188 
198 int ff_ebur128_loudness_global(FFEBUR128State * st, double *out);
210  size_t size, double *out);
211 
220 int ff_ebur128_loudness_momentary(FFEBUR128State * st, double *out);
230 int ff_ebur128_loudness_shortterm(FFEBUR128State * st, double *out);
231 
244  unsigned long window, double *out);
245 
257 int ff_ebur128_loudness_range(FFEBUR128State * st, double *out);
271  size_t size, double *out);
272 
284  unsigned int channel_number, double *out);
285 
294 int ff_ebur128_relative_threshold(FFEBUR128State * st, double *out);
295 
296 #endif /* AVFILTER_EBUR128_H */
int ff_ebur128_loudness_momentary(FFEBUR128State *st, double *out)
Get momentary loudness (last 400ms) in LUFS.
Definition: ebur128.c:630
int ff_ebur128_loudness_global(FFEBUR128State *st, double *out)
Get global integrated loudness in LUFS.
Definition: ebur128.c:603
int ff_ebur128_set_channel(FFEBUR128State *st, unsigned int channel_number, int value)
Set channel type.
Definition: ebur128.c:446
int ff_ebur128_loudness_global_multiple(FFEBUR128State **sts, size_t size, double *out)
Get global integrated loudness in LUFS across multiple instances.
Definition: ebur128.c:608
itu U+045
Definition: ebur128.h:64
itu U+090
Definition: ebur128.h:66
itu U+110
Definition: ebur128.h:68
itu U-030
Definition: ebur128.h:65
int ff_ebur128_loudness_range(FFEBUR128State *st, double *out)
Get loudness range (LRA) of programme in LU.
Definition: ebur128.c:753
can call ff_ebur128_loudness_global_* and ff_ebur128_relative_threshold
Definition: ebur128.h:89
a channel that is counted twice
Definition: ebur128.h:51
itu T+000
Definition: ebur128.h:73
can call ff_ebur128_sample_peak
Definition: ebur128.h:93
itu M+180
Definition: ebur128.h:60
itu U-090
Definition: ebur128.h:67
itu M-SC
Definition: ebur128.h:53
void ff_ebur128_add_frames_double(FFEBUR128State *st, const double *src, size_t frames)
See ebur128_add_frames_short.
itu U+180
Definition: ebur128.h:72
itu U-030
Definition: ebur128.h:63
itu U-135
Definition: ebur128.h:71
struct FFEBUR128StateInternal * d
Internal state.
Definition: ebur128.h:107
FFEBUR128State * ff_ebur128_init(unsigned int channels, unsigned long samplerate, unsigned long window, int mode)
Initialize library state.
Definition: ebur128.c:217
itu U+030
Definition: ebur128.h:62
unsigned long samplerate
The sample rate.
Definition: ebur128.h:106
int ff_ebur128_sample_peak(FFEBUR128State *st, unsigned int channel_number, double *out)
Get maximum sample peak of selected channel in float format.
Definition: ebur128.c:758
can call ff_ebur128_loudness_shortterm
Definition: ebur128.h:87
unused channel (for example LFE channel)
Definition: ebur128.h:40
itu M-110
Definition: ebur128.h:50
itu M-090
Definition: ebur128.h:57
itu B-045
Definition: ebur128.h:76
void ff_ebur128_add_frames_planar_double(FFEBUR128State *st, const double **srcs, size_t frames, int stride)
See ebur128_add_frames_planar_short.
struct FFEBUR128State FFEBUR128State
Contains information about the state of a loudness measurement.
itu M-030
Definition: ebur128.h:44
can call ff_ebur128_loudness_range
Definition: ebur128.h:91
itu B+000
Definition: ebur128.h:74
void ff_ebur128_add_frames_short(FFEBUR128State *st, const short *src, size_t frames)
Add frames to be processed.
itu M-060
Definition: ebur128.h:55
Contains information about the state of a loudness measurement.
Definition: ebur128.h:103
itu M-135
Definition: ebur128.h:59
int ff_ebur128_loudness_window(FFEBUR128State *st, unsigned long window, double *out)
Get loudness of the specified window in LUFS.
Definition: ebur128.c:659
itu M+SC
Definition: ebur128.h:52
itu M+090
Definition: ebur128.h:56
Definition: ebur128.c:66
itu M+060
Definition: ebur128.h:54
itu U+000
Definition: ebur128.h:61
void ff_ebur128_destroy(FFEBUR128State **st)
Destroy library state.
Definition: ebur128.c:302
void ff_ebur128_add_frames_int(FFEBUR128State *st, const int *src, size_t frames)
See ebur128_add_frames_short.
unsigned int channels
The number of channels.
Definition: ebur128.h:105
int mode
The current mode.
Definition: ebur128.h:104
itu M+110
Definition: ebur128.h:48
itu M+030
Definition: ebur128.h:42
void ff_ebur128_add_frames_float(FFEBUR128State *st, const float *src, size_t frames)
See ebur128_add_frames_short.
void ff_ebur128_add_frames_planar_short(FFEBUR128State *st, const short **srcs, size_t frames, int stride)
Add frames to be processed.
int ff_ebur128_relative_threshold(FFEBUR128State *st, double *out)
Get relative threshold in LUFS.
Definition: ebur128.c:587
itu M+000
Definition: ebur128.h:46
unsigned long window
The maximum window duration in ms.
Definition: ebur128.c:95
can call ff_ebur128_loudness_momentary
Definition: ebur128.h:85
channel
Use these values when setting the channel map with ebur128_set_channel().
Definition: ebur128.h:39
itu U+135
Definition: ebur128.h:70
void ff_ebur128_add_frames_planar_float(FFEBUR128State *st, const float **srcs, size_t frames, int stride)
See ebur128_add_frames_planar_short.
int ff_ebur128_loudness_shortterm(FFEBUR128State *st, double *out)
Get short-term loudness (last 3s) in LUFS.
Definition: ebur128.c:645
itu B+045
Definition: ebur128.h:75
itu M+135
Definition: ebur128.h:58
itu U-110
Definition: ebur128.h:69
void ff_ebur128_add_frames_planar_int(FFEBUR128State *st, const int **srcs, size_t frames, int stride)
See ebur128_add_frames_planar_short.
mode
Use these values in ebur128_init (or&#39;ed).
Definition: ebur128.h:83
int ff_ebur128_loudness_range_multiple(FFEBUR128State **sts, size_t size, double *out)
Get loudness range (LRA) in LU across multiple instances.
Definition: ebur128.c:676