Go to the documentation of this file.
40 int nb_samples =
samples->nb_samples;
41 int nb_channels =
samples->ch_layout.nb_channels;
42 int nb_planes = nb_channels;
47 nb_samples *= nb_channels;
50 for (plane = 0; plane < nb_planes; plane++) {
51 pcm = (int16_t *)
samples->extended_data[plane];
52 for (
i = 0;
i < nb_samples;
i++)
61 static inline double logdb(uint64_t v)
63 double d = v / (
double)(0x8000 * 0x8000);
66 return -log10(
d) * 10;
73 uint64_t nb_samples = 0,
power = 0, nb_samples_shift = 0, sum = 0;
74 uint64_t histdb[
MAX_DB + 1] = { 0 };
76 for (
i = 0;
i < 0x10000;
i++)
87 for (
i = 0;
i < 0x10000;
i++) {
91 if (!nb_samples_shift)
93 power = (
power + nb_samples_shift / 2) / nb_samples_shift;
98 while (max_volume > 0 && !vd->
histogram[0x8000 + max_volume] &&
103 for (
i = 0;
i < 0x10000;
i++)
106 for (;
i <=
MAX_DB && sum < nb_samples / 1000;
i++) {
133 .
name =
"volumedetect",
static const AVFilterPad volumedetect_outputs[]
static av_cold void uninit(AVFilterContext *ctx)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
A link between two filters.
uint64_t histogram[0x10001]
Number of samples at each PCM value.
A filter pad used for either input or output.
const AVFilter ff_af_volumedetect
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
#define FILTER_INPUTS(array)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int shift(int a, int b)
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
#define AV_LOG_INFO
Standard information.
#define i(width, name, range_min, range_max)
static int filter_frame(AVFilterLink *inlink, AVFrame *samples)
@ AV_SAMPLE_FMT_S16
signed 16 bits
const char * name
Pad name.
static float power(float r, float g, float b, float max)
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Filter the word “frame” indicates either a video frame or a group of audio samples
static double logdb(uint64_t v)
static void print_stats(AVFilterContext *ctx)
#define FILTER_OUTPUTS(array)
#define flags(name, subs,...)
#define FILTER_SAMPLEFMTS(...)
static const AVFilterPad volumedetect_inputs[]