61 #define OFFSET(x) offsetof(AudioNLMSContext, x) 62 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 63 #define AT AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM 118 memcpy(tmp, coeffs + order - *offset, order *
sizeof(
float));
133 const float mu = s->
mu;
134 const float a = 1.f - leakage *
mu;
135 float sum, output, e, norm,
b;
138 delay[offset +
order] = input;
140 output =
fir_sample(s, input, delay, coeffs, tmp, offsetp);
141 e = desired - output;
148 memcpy(tmp, delay + offset, order *
sizeof(
float));
154 memcpy(coeffs + order, coeffs, order *
sizeof(
float));
157 case IN_MODE: output = input;
break;
160 case NOISE_MODE: output = desired - output;
break;
169 const int start = (out->
channels * jobnr) / nb_jobs;
170 const int end = (out->
channels * (jobnr+1)) / nb_jobs;
172 for (
int c = start;
c <
end;
c++) {
199 for (i = 0; i < ctx->
nb_inputs && nb_samples > 0; i++) {
234 for (i = 0; i < 2; i++) {
243 for (i = 0; i < 2; i++) {
319 .description =
NULL_IF_CONFIG_SMALL(
"Apply Normalized Least-Mean-Squares algorithm to first audio stream."),
321 .priv_class = &anlms_class,
float(* scalarproduct_float)(const float *v1, const float *v2, int len)
Calculate the scalar product of two vectors of floats.
This structure describes decoded (raw) audio or video data.
static float fir_sample(AudioNLMSContext *s, float sample, float *delay, float *coeffs, float *tmp, int *offset)
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Main libavfilter public API header.
static int query_formats(AVFilterContext *ctx)
static const AVFilterPad inputs[]
static av_cold void uninit(AVFilterContext *ctx)
static const AVOption anlms_options[]
static int config_output(AVFilterLink *outlink)
int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
Test if enough samples are available on the link.
AVFILTER_DEFINE_CLASS(anlms)
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
void(* vector_fmac_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float and add to destination vector.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static av_cold int end(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
A filter pad used for either input or output.
A link between two filters.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
#define i(width, name, range_min, range_max)
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context.
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
static int activate(AVFilterContext *ctx)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options...
void * priv
private data for use by the filter
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
simple assert() macros that are a bit more flexible than ISO C assert().
static av_cold int init(AVFilterContext *ctx)
int channels
number of audio channels, only used for audio.
audio channel layout utility functions
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
unsigned nb_inputs
number of input pads
static float process_sample(AudioNLMSContext *s, float input, float desired, float *delay, float *coeffs, float *tmp, int *offsetp)
int ff_inlink_queued_samples(AVFilterLink *link)
AVFilterContext * src
source filter
A list of supported channel layouts.
static const AVFilterPad outputs[]
AVSampleFormat
Audio sample formats.
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
Describe the class of an AVClass context structure.
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
const char * name
Filter name.
static int process_channels(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
#define flags(name, subs,...)
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
common internal and external API header
int channels
Number of channels.
avfilter_execute_func * execute
static enum AVSampleFormat sample_fmts[]
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
uint8_t ** extended_data
pointers to the data planes/channels.
int nb_samples
number of audio samples (per channel) described by this frame