59 #define OFFSET(x) offsetof(AudioStatsContext, x) 60 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 127 p->
imask = 0xFFFFFFFFFFFFFFFF;
156 mask = mask & (~imask);
158 for (; result && !(mask & 1); --result, mask >>= 1);
163 for (; result; --result, mask >>= 1)
176 }
else if (d == p->
min) {
179 }
else if (p->
last == p->
min) {
192 }
else if (d == p->
max) {
195 }
else if (p->
last == p->
max) {
218 const char *
fmt,
double val)
223 snprintf(value,
sizeof(value), fmt, val);
225 snprintf(key2,
sizeof(key2),
"lavfi.astats.%d.%s", chan, key);
227 snprintf(key2,
sizeof(key2),
"lavfi.astats.%s", key);
231 #define LINEAR_TO_DB(x) (log10(x) * 20) 274 if (fabs(p->
sigma_x) > fabs(max_sigma_x))
278 set_meta(metadata, c + 1,
"Min_level",
"%f", p->
min);
279 set_meta(metadata, c + 1,
"Max_level",
"%f", p->
max);
292 set_meta(metadata, c + 1,
"Bit_depth",
"%f", depth.
num);
293 set_meta(metadata, c + 1,
"Bit_depth2",
"%f", depth.
den);
298 set_meta(metadata, 0,
"Overall.Min_level",
"%f",
min);
299 set_meta(metadata, 0,
"Overall.Max_level",
"%f", max);
300 set_meta(metadata, 0,
"Overall.Min_difference",
"%f", min_diff);
301 set_meta(metadata, 0,
"Overall.Max_difference",
"%f", max_diff);
311 set_meta(metadata, 0,
"Overall.Bit_depth",
"%f", depth.
num);
312 set_meta(metadata, 0,
"Overall.Bit_depth2",
"%f", depth.
den);
345 for (c = 0; c <
channels; c++, src++)
362 for (c = 0; c <
channels; c++, src++)
379 for (c = 0; c <
channels; c++, src++)
396 for (c = 0; c <
channels; c++, src++)
413 for (c = 0; c <
channels; c++, src++)
467 if (fabs(p->
sigma_x) > fabs(max_sigma_x))
543 .priv_class = &astats_class,
const char const char void * val
This structure describes decoded (raw) audio or video data.
static int query_formats(AVFilterContext *ctx)
Main libavfilter public API header.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static const AVFilterPad astats_inputs[]
static void update_stat(AudioStatsContext *s, ChannelStats *p, double d, double nd, int64_t i)
AVDictionary * metadata
metadata.
A filter pad used for either input or output.
A link between two filters.
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
static av_cold void uninit(AVFilterContext *ctx)
int sample_rate
samples per second
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
AVFILTER_DEFINE_CLASS(astats)
static void print_stats(AVFilterContext *ctx)
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
static int config_output(AVFilterLink *outlink)
static void reset_stats(AudioStatsContext *s)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
int format
agreed upon media format
A list of supported channel layouts.
static const AVOption astats_options[]
#define AV_LOG_INFO
Standard information.
AVSampleFormat
Audio sample formats.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
static void set_meta(AVDictionary **metadata, int chan, const char *key, const char *fmt, double val)
int channels
Number of channels.
AVFilterContext * dst
dest filter
static const AVFilterPad astats_outputs[]
static enum AVSampleFormat sample_fmts[]
uint8_t ** extended_data
pointers to the data planes/channels.
int nb_samples
number of audio samples (per channel) described by this frame
static void set_metadata(AudioStatsContext *s, AVDictionary **metadata)