49#define OFFSET(x) offsetof(DRMeterContext, x)
50#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
74 int peak_bin, rms_bin;
77 rms =
sqrtf(2.f * p->sum / p->nb_samples);
95 if (p->nb_samples >=
s->tc_samples)
127#define SQR(a) ((a)*(a))
134 for (
int ch = 0; ch <
s->nb_channels; ch++) {
136 float chdr, secondpeak, rmssum = 0.f;
137 int first = 0, last =
lrintf(0.2f * p->blknum);
140 if (!p->nb_samples) {
148 for (
int i =
BINS;
i >= 0;
i--) {
150 if (first || p->peaks[
i] > 1) {
162 rmssum +=
SQR(
i / (
float)
BINS) * p->rms[
i];
167 chdr = 20.f *
log10f(secondpeak /
sqrtf(rmssum / (
float)last));
203 .p.priv_class = &drmeter_class,
static void update_stat(DRMeterContext *s, ChannelStats *p, float sample)
static const AVFilterPad drmeter_outputs[]
const FFFilter ff_af_drmeter
static void finish_block(ChannelStats *p)
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
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 i(width, name, range_min, range_max)
static __device__ float sqrtf(float a)
static __device__ float fabsf(float a)
float fmaxf(float, float)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
internal math functions header
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
#define AV_LOG_INFO
Standard information.
@ AV_SAMPLE_FMT_FLTP
float, planar
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FILTER_SAMPLEFMTS(...)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
AVFilterContext * src
source filter
int sample_rate
samples per second
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
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.
static AVFormatContext * ctx