46 #define OFFSET(x) offsetof(DRMeterContext, x) 47 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 101 int peak_bin, rms_bin;
106 rms_bin = av_clip(rms * 10000, 0, 10000);
107 peak_bin = av_clip(peak * 10000, 0, 10000);
109 p->
peaks[peak_bin]++;
148 for (c = 0; c <
channels; c++, src++)
157 #define SQR(a) ((a)*(a)) 167 float chdr, secondpeak, rmssum = 0;
177 for (i = 0; i <= 10000; i++) {
178 if (p->
peaks[10000 - i]) {
185 secondpeak = (10000 -
i) / 10000.;
187 for (i = 10000, j = 0; i >= 0 && j < 0.2 * p->
blknum; i--) {
189 rmssum +=
SQR(i / 10000.) * p->
rms[
i];
194 chdr = 20 * log10(secondpeak / sqrt(rmssum / (0.2 * p->
blknum)));
234 .priv_class = &drmeter_class,
static void update_stat(DRMeterContext *s, ChannelStats *p, float sample)
This structure describes decoded (raw) audio or video data.
static int config_output(AVFilterLink *outlink)
Main libavfilter public API header.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
static void print_stats(AVFilterContext *ctx)
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static void finish_block(ChannelStats *p)
A filter pad used for either input or output.
A link between two filters.
#define i(width, name, range_min, range_max)
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(drmeter)
#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
static int query_formats(AVFilterContext *ctx)
A list of supported channel layouts.
#define AV_LOG_INFO
Standard information.
AVSampleFormat
Audio sample formats.
Describe the class of an AVClass context structure.
const char * name
Filter name.
static const AVOption drmeter_options[]
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
internal math functions header
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
int channels
Number of channels.
AVFilterContext * dst
dest filter
static const AVFilterPad drmeter_inputs[]
static av_cold void uninit(AVFilterContext *ctx)
static enum AVSampleFormat sample_fmts[]
static const AVFilterPad drmeter_outputs[]
uint8_t ** extended_data
pointers to the data planes/channels.
int nb_samples
number of audio samples (per channel) described by this frame