1 /*
2 * Copyright (c) 2009 Rob Sykes <robs@users.sourceforge.net>
3 * Copyright (c) 2013 Paul B Mahol
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 #include <float.h>
23
28
39
48
49 #define OFFSET(x) offsetof(AudioStatsContext, x)
50 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
51
54 { NULL }
55 };
56
58
60 {
66 };
67
69 if (!layouts)
72
74 if (!formats)
77
79 if (!formats)
82
83 return 0;
84 }
85
87 {
90
97
100
103 }
104
105 return 0;
106 }
107
109 {
115 }
else if (d == p->
min) {
118 }
else if (p->
last == p->
min) {
120 }
121
127 }
else if (d == p->
max) {
130 }
else if (p->
last == p->
max) {
132 }
133
138
142 }
144 }
145
147 {
152
155 for (c = 0; c < channels; c++) {
158
161 }
162 break;
165
167 for (c = 0; c < channels; c++, src++)
169 }
170 break;
171 }
172
174 }
175
176 #define LINEAR_TO_DB(x) (log10(x) * 20)
177
179 {
181 uint64_t min_count = 0, max_count = 0, nb_samples = 0;
182 double min_runs = 0, max_runs = 0,
183 min = DBL_MAX, max = DBL_MIN,
184 max_sigma_x = 0,
185 sigma_x = 0,
186 sigma_x2 = 0,
187 min_sigma_x2 = DBL_MAX,
188 max_sigma_x2 = DBL_MIN;
190
193
196
208 if (fabs(p->
sigma_x) > fabs(max_sigma_x))
210
223 }
224
232 if (min_sigma_x2 != 1)
237 }
238
240 {
242
245 }
246
248 {
252 },
253 { NULL }
254 };
255
257 {
261 },
262 { NULL }
263 };
264
270 .priv_class = &astats_class,
274 };