Go to the documentation of this file.
57 #define OFFSET(x) offsetof(ANoiseSrcContext, x)
58 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
78 {
"nb_samples",
"set the number of samples per requested frame",
OFFSET(nb_samples),
AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX,
FLAGS },
79 {
"n",
"set the number of samples per requested frame",
OFFSET(nb_samples),
AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX,
FLAGS },
116 buf[0] = 0.99886 * buf[0] + white * 0.0555179;
117 buf[1] = 0.99332 * buf[1] + white * 0.0750759;
118 buf[2] = 0.96900 * buf[2] + white * 0.1538520;
119 buf[3] = 0.86650 * buf[3] + white * 0.3104856;
120 buf[4] = 0.55000 * buf[4] + white * 0.5329522;
121 buf[5] = -0.7616 * buf[5] - white * 0.0168980;
122 pink = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6] + white * 0.5362;
123 buf[6] = white * 0.115926;
132 buf[0] = 0.0555179 * white - 0.99886 * buf[0];
133 buf[1] = 0.0750759 * white - 0.99332 * buf[1];
134 buf[2] = 0.1538520 * white - 0.96900 * buf[2];
135 buf[3] = 0.3104856 * white - 0.86650 * buf[3];
136 buf[4] = 0.5329522 * white - 0.55000 * buf[4];
137 buf[5] = -0.016898 * white + 0.76160 * buf[5];
138 blue = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6] + white * 0.5362;
139 buf[6] = white * 0.115926;
147 brown = ((0.02 * white) + buf[0]) / 1.02;
156 violet = ((0.02 * white) - buf[0]) / 1.02;
163 double awhite =
fabs(white);
164 return FFDIFFSIGN(white, 0.0) * buf[1] * (awhite < buf[0]);
176 if (
s->duration == 0)
187 s->buf[1] =
s->amplitude;
205 if (!
s->infinite &&
s->duration <= 0) {
208 }
else if (!
s->infinite &&
s->duration <
s->nb_samples) {
209 nb_samples =
s->duration;
211 nb_samples =
s->nb_samples;
217 dst = (
double *)
frame->data[0];
218 for (
i = 0;
i < nb_samples;
i++) {
221 dst[
i] =
s->filter(white,
s->buf);
225 s->duration -= nb_samples;
228 s->pts += nb_samples;
248 .priv_class = &anoisesrc_class,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static const AVOption anoisesrc_options[]
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
static double violet_filter(double white, double *buf)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static enum AVSampleFormat sample_fmts[]
#define AVERROR_EOF
End of file.
static int activate(AVFilterContext *ctx)
static double brown_filter(double white, double *buf)
This structure describes decoded (raw) audio or video data.
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
const char * name
Filter name.
A link between two filters.
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
static const AVFilterPad anoisesrc_outputs[]
A filter pad used for either input or output.
#define FFDIFFSIGN(x, y)
Comparator.
AVFILTER_DEFINE_CLASS(anoisesrc)
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
#define FILTER_OUTPUTS(array)
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
static av_cold int query_formats(AVFilterContext *ctx)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Context structure for the Lagged Fibonacci PRNG.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
static double blue_filter(double white, double *buf)
static double velvet_filter(double white, double *buf)
static av_cold int config_props(AVFilterLink *outlink)
AVFilterContext * src
source filter
#define i(width, name, range_min, range_max)
#define AV_TIME_BASE
Internal time base represented as integer.
AVSampleFormat
Audio sample formats.
const char * name
Pad name.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
const AVFilter ff_asrc_anoisesrc
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CHANNEL_LAYOUT_MONO
static double white_filter(double white, double *buf)
double(* filter)(double white, double *buf)
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function. If this function returns true
@ AV_SAMPLE_FMT_DBL
double
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
#define FILTER_QUERY_FUNC(func)
static double pink_filter(double white, double *buf)