29 #define RDFT_BITS_MIN 4
30 #define RDFT_BITS_MAX 16
54 #define NB_GAIN_ENTRY_MAX 4096
108 #define OFFSET(x) offsetof(FIREqualizerContext, x)
109 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
203 if (nsamples <= s->nsamples_max) {
204 float *
buf = conv_buf + idx->buf_idx * s->rdft_len;
205 float *obuf = conv_buf + !idx->buf_idx * s->rdft_len + idx->overlap_idx;
206 int center = s->fir_len/2;
209 memset(buf, 0, center *
sizeof(*data));
210 memcpy(buf + center, data, nsamples *
sizeof(*data));
211 memset(buf + center + nsamples, 0, (s->rdft_len - nsamples - center) *
sizeof(*data));
214 buf[0] *= kernel_buf[0];
215 buf[1] *= kernel_buf[s->rdft_len/2];
216 for (k = 1; k < s->rdft_len/2; k++) {
217 buf[2*k] *= kernel_buf[k];
218 buf[2*k+1] *= kernel_buf[k];
222 for (k = 0; k < s->rdft_len - idx->overlap_idx; k++)
224 memcpy(data, buf, nsamples *
sizeof(*data));
225 idx->buf_idx = !idx->buf_idx;
226 idx->overlap_idx = nsamples;
228 while (nsamples > s->nsamples_max * 2) {
229 fast_convolute(s, kernel_buf, conv_buf, idx, data, s->nsamples_max);
230 data += s->nsamples_max;
231 nsamples -= s->nsamples_max;
234 fast_convolute(s, kernel_buf, conv_buf, idx, data + nsamples/2, nsamples - nsamples/2);
239 OverlapIndex *av_restrict idx,
float *av_restrict data0,
float *av_restrict data1,
int nsamples)
241 if (nsamples <= s->nsamples_max) {
243 FFTComplex *obuf = conv_buf + !idx->buf_idx * s->rdft_len + idx->overlap_idx;
244 int center = s->fir_len/2;
248 memset(buf, 0, center *
sizeof(*buf));
249 for (k = 0; k < nsamples; k++) {
250 buf[center+k].
re = data0[k];
251 buf[center+k].
im = data1[k];
253 memset(buf + center + nsamples, 0, (s->rdft_len - nsamples - center) *
sizeof(*buf));
260 buf[0].
re = 0.5f * kernel_buf[0] * buf[0].
im;
261 buf[0].
im = 0.5f * kernel_buf[0] *
tmp;
262 for (k = 1; k < s->rdft_len/2; k++) {
263 int m = s->rdft_len - k;
265 buf[k].
re = 0.5f * kernel_buf[k] * buf[k].
im;
266 buf[k].
im = 0.5f * kernel_buf[k] *
tmp;
268 buf[m].
re = 0.5f * kernel_buf[k] * buf[m].
im;
269 buf[m].
im = 0.5f * kernel_buf[k] *
tmp;
272 buf[k].
re = 0.5f * kernel_buf[k] * buf[k].
im;
273 buf[k].
im = 0.5f * kernel_buf[k] *
tmp;
278 for (k = 0; k < s->rdft_len - idx->overlap_idx; k++) {
279 buf[k].
re += obuf[k].
re;
280 buf[k].
im += obuf[k].
im;
284 for (k = 0; k < nsamples; k++) {
285 data0[k] = buf[k].
im;
286 data1[k] = buf[k].
re;
288 idx->buf_idx = !idx->buf_idx;
289 idx->overlap_idx = nsamples;
291 while (nsamples > s->nsamples_max * 2) {
292 fast_convolute2(s, kernel_buf, conv_buf, idx, data0, data1, s->nsamples_max);
293 data0 += s->nsamples_max;
294 data1 += s->nsamples_max;
295 nsamples -= s->nsamples_max;
297 fast_convolute2(s, kernel_buf, conv_buf, idx, data0, data1, nsamples/2);
298 fast_convolute2(s, kernel_buf, conv_buf, idx, data0 + nsamples/2, data1 + nsamples/2, nsamples - nsamples/2);
310 double delay = s->
zero_phase ? 0.0 : (double) center / rate;
314 for (x = 1; x <= center; x++) {
322 fprintf(fp,
"# time[%d] (time amplitude)\n", ch);
324 for (x = center; x > 0; x--)
327 for (x = 0; x <= center; x++)
328 fprintf(fp,
"%15.10f %15.10f\n", delay + (
double)x / rate , (
double) s->
analysis_buf[x]);
332 fprintf(fp,
"\n\n# freq[%d] (frequency desired_gain actual_gain)\n", ch);
342 ya = 20.0 * log10(fabs(ya));
343 yb = 20.0 * log10(fabs(yb));
345 fprintf(fp,
"%17.10f %17.10f %17.10f\n", vx, ya, yb);
380 const double *freq = key;
383 if (*freq < entry[0].freq)
385 if (*freq > entry[1].freq)
403 if (freq <= s->gain_entry_tbl[0].freq)
413 d0 = freq - res[0].
freq;
414 d1 = res[1].
freq - freq;
417 return (d0 * res[1].gain + d1 * res[0].gain) / d;
432 double m0, m1, m2, msum, unit;
437 if (freq <= s->gain_entry_tbl[0].freq)
448 unit * (res[0].
gain - res[-1].
gain) / (res[0].freq - res[-1].freq) : 0;
451 unit * (res[2].
gain - res[1].
gain) / (res[2].freq - res[1].freq) : 0;
453 msum = fabs(m0) + fabs(m1);
454 m0 = msum > 0 ? (fabs(m0) * m1 + fabs(m1) * m0) / msum : 0;
455 msum = fabs(m1) + fabs(m2);
456 m1 = msum > 0 ? (fabs(m1) * m2 + fabs(m2) * m1) / msum : 0;
460 b = 3 * res[1].
gain - m1 - 2 * c - 3 * d;
461 a = res[1].
gain - b - c - d;
463 x = (freq - res[0].
freq) / unit;
467 return a * x3 + b * x2 + c * x + d;
494 const char *gain_entry_func_names[] = {
"entry",
NULL };
495 const char *gain_func_names[] = {
"gain_interpolate",
"cubic_interpolate",
NULL };
496 double (*gain_entry_funcs[])(
void *, double, double) = {
entry_func,
NULL };
500 int ret, k, center,
ch;
503 FILE *dump_fp =
NULL;
510 gain_entry_func_names, gain_entry_funcs, ctx, 0, ctx);
520 gain_func_names, gain_funcs,
NULL,
NULL, 0, ctx);
530 for (ch = 0; ch < inlink->
channels; ch++) {
539 s->
analysis_buf[0] = ylog ? pow(10.0, 0.05 * result) : result;
545 s->
analysis_buf[1] = ylog ? pow(10.0, 0.05 * result) : result;
552 s->
analysis_buf[2*k] = ylog ? pow(10.0, 0.05 * result) : result;
562 for (k = 0; k <= center; k++) {
563 double u = k * (
M_PI/center);
570 win = 0.5 + 0.5 * cos(u);
573 win = 0.53836 + 0.46164 * cos(u);
576 win = 0.42 + 0.5 * cos(u) + 0.08 * cos(2*u);
579 win = 0.40897 + 0.5 * cos(u) + 0.09103 * cos(2*u);
582 win = 0.4243801 + 0.4973406 * cos(u) + 0.0782793 * cos(2*u);
585 win = 0.355768 + 0.487396 * cos(u) + 0.144232 * cos(2*u) + 0.012604 * cos(3*u);
588 win = 0.3635819 + 0.4891775 * cos(u) + 0.1365995 * cos(2*u) + 0.0106411 * cos(3*u);
591 win = 0.35875 + 0.48829 * cos(u) + 0.14128 * cos(2*u) + 0.01168 * cos(3*u);
594 win = (u <= 0.5 *
M_PI) ? 1.0 : (0.5 + 0.5 * cos(2*u -
M_PI));
610 if (
isnan(rdft_buf[k]) ||
isinf(rdft_buf[k])) {
619 rdft_buf[s->
rdft_len-1] = rdft_buf[1];
621 rdft_buf[k] = rdft_buf[2*k];
638 #define SELECT_GAIN(s) (s->gain_cmd ? s->gain_cmd : s->gain)
639 #define SELECT_GAIN_ENTRY(s) (s->gain_entry_cmd ? s->gain_entry_cmd : s->gain_entry)
700 av_log(ctx,
AV_LOG_DEBUG,
"sample_rate = %d, channels = %d, analysis_rdft_len = %d, rdft_len = %d, fir_len = %d, nsamples_max = %d.\n",
721 for ( ; ch < inlink->
channels; ch++) {
760 char *res,
int res_len,
int flags)
765 if (!strcmp(cmd,
"gain")) {
784 }
else if (!strcmp(cmd,
"gain_entry")) {
785 char *gain_entry_cmd;
829 .
name =
"firequalizer",
835 .
inputs = firequalizer_inputs,
836 .
outputs = firequalizer_outputs,
837 .priv_class = &firequalizer_class,
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
av_cold void av_fft_end(FFTContext *s)
#define AV_LOG_WARNING
Something somehow does not look correct.
static void common_uninit(FIREqualizerContext *s)
Main libavfilter public API header.
int max_samples
Maximum number of samples to filter at once.
static double gain_interpolate_func(void *p, double freq)
static int request_frame(AVFilterLink *outlink)
void av_fft_permute(FFTContext *s, FFTComplex *z)
Do the permutation needed BEFORE calling ff_fft_calc().
static int config_input(AVFilterLink *inlink)
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
#define SELECT_GAIN_ENTRY(s)
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
#define NB_GAIN_ENTRY_MAX
static const AVFilterPad firequalizer_outputs[]
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static double cubic_interpolate_func(void *p, double freq)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static const char *const var_names[]
#define AVERROR_EOF
End of file.
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Fill an audio buffer with silence.
int min_samples
Minimum number of samples to filter at once.
int sample_rate
samples per second
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. ...
AVFILTER_DEFINE_CLASS(firequalizer)
void * priv
private data for use by the filter
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
FFTContext * av_fft_init(int nbits, int inverse)
Set up a complex FFT.
RDFTContext * analysis_irdft
static av_cold void uninit(AVFilterContext *ctx)
static const AVOption firequalizer_options[]
void av_rdft_calc(RDFTContext *s, FFTSample *data)
static const AVFilterPad firequalizer_inputs[]
static void fast_convolute2(FIREqualizerContext *av_restrict s, const float *av_restrict kernel_buf, FFTComplex *av_restrict conv_buf, OverlapIndex *av_restrict idx, float *av_restrict data0, float *av_restrict data1, int nsamples)
void av_rdft_end(RDFTContext *s)
AVFilterContext * src
source filter
RDFTContext * av_rdft_init(int nbits, enum RDFTransformType trans)
Set up a real FFT.
int partial_buf_size
Size of the partial buffer to allocate.
static const AVFilterPad outputs[]
A list of supported channel layouts.
static double entry_func(void *p, double freq, double gain)
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
static const uint8_t vars[2][12]
static const AVFilterPad inputs[]
char * av_strdup(const char *s)
Duplicate a string.
AVSampleFormat
Audio sample formats.
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
AVFilter ff_af_firequalizer
static AVRational av_make_q(int num, int den)
Create an AVRational.
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static void fast_convolute(FIREqualizerContext *av_restrict s, const float *av_restrict kernel_buf, float *av_restrict conv_buf, OverlapIndex *av_restrict idx, float *av_restrict data, int nsamples)
Describe the class of an AVClass context structure.
GainEntry gain_entry_tbl[NB_GAIN_ENTRY_MAX]
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
static void dump_fir(AVFilterContext *ctx, FILE *fp, int ch)
RDFTContext * analysis_rdft
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
Get the channel with the given index in channel_layout.
static int query_formats(AVFilterContext *ctx)
static int generate_kernel(AVFilterContext *ctx, const char *gain, const char *gain_entry)
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_YASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
int channels
Number of channels.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
AVFilterContext * dst
dest filter
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static enum AVSampleFormat sample_fmts[]
#define av_malloc_array(a, b)
static int gain_entry_compare(const void *key, const void *memb)
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
uint8_t ** extended_data
pointers to the data planes/channels.
void av_fft_calc(FFTContext *s, FFTComplex *z)
Do a complex FFT with the parameters defined in av_fft_init().
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_NOPTS_VALUE
Undefined timestamp value.
simple arithmetic expression evaluator