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]++;
157 #define SQR(a) ((a)*(a))
165 for (ch = 0; ch <
s->nb_channels; ch++) {
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 enum AVSampleFormat sample_fmts[]
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static void update_stat(DRMeterContext *s, ChannelStats *p, float sample)
static const AVFilterPad drmeter_outputs[]
AVFILTER_DEFINE_CLASS(drmeter)
static void finish_block(ChannelStats *p)
static int query_formats(AVFilterContext *ctx)
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
static void print_stats(AVFilterContext *ctx)
static const AVFilterPad drmeter_inputs[]
static const AVOption drmeter_options[]
static av_cold void uninit(AVFilterContext *ctx)
static int config_output(AVFilterLink *outlink)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
internal math functions header
#define AV_LOG_INFO
Standard information.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_FLTP
float, planar
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
enum MovChannelLayoutTag * layouts
Describe the class of an AVClass context structure.
A list of supported channel layouts.
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int channels
Number of channels.
AVFilterContext * src
source filter
int sample_rate
samples per second
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t ** extended_data
pointers to the data planes/channels.