53 #define OFFSET(x) offsetof(ANoiseSrcContext, x)
54 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
73 {
"nb_samples",
"set the number of samples per requested frame",
OFFSET(nb_samples),
AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX,
FLAGS },
74 {
"n",
"set the number of samples per requested frame",
OFFSET(nb_samples),
AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX,
FLAGS },
124 buf[0] = 0.99886 * buf[0] + white * 0.0555179;
125 buf[1] = 0.99332 * buf[1] + white * 0.0750759;
126 buf[2] = 0.96900 * buf[2] + white * 0.1538520;
127 buf[3] = 0.86650 * buf[3] + white * 0.3104856;
128 buf[4] = 0.55000 * buf[4] + white * 0.5329522;
129 buf[5] = -0.7616 * buf[5] - white * 0.0168980;
130 pink = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6] + white * 0.5362;
131 buf[6] = white * 0.115926;
140 buf[0] = 0.0555179 * white - 0.99886 * buf[0];
141 buf[1] = 0.0750759 * white - 0.99332 * buf[1];
142 buf[2] = 0.1538520 * white - 0.96900 * buf[2];
143 buf[3] = 0.3104856 * white - 0.86650 * buf[3];
144 buf[4] = 0.5329522 * white - 0.55000 * buf[4];
145 buf[5] = -0.016898 * white + 0.76160 * buf[5];
146 blue = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6] + white * 0.5362;
147 buf[6] = white * 0.115926;
155 brown = ((0.02 * white) + buf[0]) / 1.02;
164 violet = ((0.02 * white) - buf[0]) / 1.02;
212 dst = (
double *)frame->
data[0];
213 for (i = 0; i < nb_samples; i++) {
223 s->
pts += nb_samples;
244 .priv_class = &anoisesrc_class,
This structure describes decoded (raw) audio or video data.
Main libavfilter public API header.
static const AVOption anoisesrc_options[]
double(* filter)(double white, double *buf)
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static av_cold int query_formats(AVFilterContext *ctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
AVFilter ff_asrc_anoisesrc
#define AVERROR_EOF
End of file.
static int request_frame(AVFilterLink *outlink)
AVFILTER_DEFINE_CLASS(anoisesrc)
A filter pad used for either input or output.
A link between two filters.
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
#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
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define AV_TIME_BASE
Internal time base represented as integer.
static double blue_filter(double white, double *buf)
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
A list of supported channel layouts.
static av_cold int config_props(AVFilterLink *outlink)
AVSampleFormat
Audio sample formats.
static double white_filter(double white, double *buf)
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
Describe the class of an AVClass context structure.
static double brown_filter(double white, double *buf)
const char * name
Filter name.
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
enum MovChannelLayoutTag * layouts
static double pink_filter(double white, double *buf)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static const AVFilterPad anoisesrc_outputs[]
static double violet_filter(double white, double *buf)
static enum AVSampleFormat sample_fmts[]
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
#define AV_CH_LAYOUT_MONO