FFmpeg
f_ebur128.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 Clément Bœsch
3  * Copyright (c) 2025 Niklas Haas
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVFILTER_F_EBUR128_H
23 #define AVFILTER_F_EBUR128_H
24 
25 #include <assert.h>
26 #include <stddef.h>
27 
28 typedef struct EBUR128Biquad {
29  double b0, b1, b2;
30  double a1, a2;
32 
33 typedef struct EBUR128DSPContext {
34  /* Filter data */
37 
38  /* Cache of 3 samples for each channel */
39  double *y; /* after pre-filter */
40  double *z; /* after RLB-filter */
41 
42  /* DSP functions */
43  void (*filter_channels)(const struct EBUR128DSPContext *dsp,
44  const double *samples,
45  double *cache_400, double *cache_3000,
46  double *sum_400, double *sum_3000,
47  int nb_channels);
48 
49  /* Updates ch_peaks[] and returns maximum from all channels */
50  double (*find_peak)(double *ch_peaks, int nb_channels,
51  const double *samples, int nb_samples);
53 
54 static_assert(offsetof(EBUR128DSPContext, pre) == 0, "struct layout mismatch");
55 static_assert(offsetof(EBUR128DSPContext, rlb) == 5 * sizeof(double), "struct layout mismatch");
56 static_assert(offsetof(EBUR128DSPContext, y) == 10 * sizeof(double), "struct layout mismatch");
57 
58 void ff_ebur128_init_x86(EBUR128DSPContext *dsp, int nb_channels);
59 
60 void ff_ebur128_filter_channels_c(const EBUR128DSPContext *, const double *,
61  double *, double *, double *, double *, int);
62 
63 double ff_ebur128_find_peak_c(double *, int, const double *, int);
64 
65 #endif /* AVFILTER_F_EBUR128_H */
EBUR128DSPContext::z
double * z
Definition: f_ebur128.h:40
EBUR128Biquad::b2
double b2
Definition: f_ebur128.h:29
ff_ebur128_find_peak_c
double ff_ebur128_find_peak_c(double *, int, const double *, int)
EBUR128Biquad::a1
double a1
Definition: f_ebur128.h:30
double
double
Definition: af_crystalizer.c:132
ff_ebur128_init_x86
void ff_ebur128_init_x86(EBUR128DSPContext *dsp, int nb_channels)
Definition: f_ebur128_init.c:31
EBUR128DSPContext
Definition: f_ebur128.h:33
EBUR128Biquad::b1
double b1
Definition: f_ebur128.h:29
EBUR128DSPContext::rlb
EBUR128Biquad rlb
Definition: f_ebur128.h:36
EBUR128Biquad::a2
double a2
Definition: f_ebur128.h:30
EBUR128Biquad::b0
double b0
Definition: f_ebur128.h:29
EBUR128DSPContext::filter_channels
void(* filter_channels)(const struct EBUR128DSPContext *dsp, const double *samples, double *cache_400, double *cache_3000, double *sum_400, double *sum_3000, int nb_channels)
Definition: f_ebur128.h:43
EBUR128Biquad
Definition: f_ebur128.h:28
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
ff_ebur128_filter_channels_c
void ff_ebur128_filter_channels_c(const EBUR128DSPContext *, const double *, double *, double *, double *, double *, int)
EBUR128DSPContext::pre
EBUR128Biquad pre
Definition: f_ebur128.h:35
EBUR128DSPContext::y
double * y
Definition: f_ebur128.h:39
EBUR128DSPContext::find_peak
double(* find_peak)(double *ch_peaks, int nb_channels, const double *samples, int nb_samples)
Definition: f_ebur128.h:50