Go to the documentation of this file.
   84                     double sigmae, 
double *detection,
 
   86                     const double *
src, 
double *dst);
 
   89 #define OFFSET(x) offsetof(AudioDeclickContext, x) 
   90 #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 
  142     s->window_size = 
inlink->sample_rate * 
s->w / 1000.;
 
  143     if (
s->window_size < 100)
 
  145     s->ar_order = 
FFMAX(
s->window_size * 
s->ar / 100., 1);
 
  146     s->nb_burst_samples = 
s->window_size * 
s->burst / 1000.;
 
  147     s->hop_size = 
s->window_size * (1. - (
s->overlap / 100.));
 
  151     s->window_func_lut = 
av_calloc(
s->window_size, 
sizeof(*
s->window_func_lut));
 
  152     if (!
s->window_func_lut)
 
  154     for (
i = 0; 
i < 
s->window_size; 
i++)
 
  155         s->window_func_lut[
i] = sin(
M_PI * 
i / 
s->window_size) *
 
  156                                 (1. - (
s->overlap / 100.)) * 
M_PI_2;
 
  166     if (!
s->in || !
s->out || !
s->buffer || !
s->is)
 
  172     s->overlap_skip = 
s->method ? (
s->window_size - 
s->hop_size) / 2 : 0;
 
  173     if (
s->overlap_skip > 0) {
 
  178     s->nb_channels = 
inlink->channels;
 
  186         c->detection = 
av_calloc(
s->window_size, 
sizeof(*
c->detection));
 
  187         c->auxiliary = 
av_calloc(
s->ar_order + 1, 
sizeof(*
c->auxiliary));
 
  188         c->acoefficients = 
av_calloc(
s->ar_order + 1, 
sizeof(*
c->acoefficients));
 
  189         c->acorrelation = 
av_calloc(
s->ar_order + 1, 
sizeof(*
c->acorrelation));
 
  191         c->click = 
av_calloc(
s->window_size, 
sizeof(*
c->click));
 
  192         c->index = 
av_calloc(
s->window_size, 
sizeof(*
c->index));
 
  193         c->interpolated = 
av_calloc(
s->window_size, 
sizeof(*
c->interpolated));
 
  194         if (!
c->auxiliary || !
c->acoefficients || !
c->detection || !
c->click ||
 
  195             !
c->index || !
c->interpolated || !
c->acorrelation || !
c->tmp)
 
  203                             double *
output, 
double scale)
 
  207     for (
i = 0; 
i <= order; 
i++) {
 
  210         for (j = 
i; j < 
size; j++)
 
  228     k[0] = 
a[0] = -
r[1] / 
r[0];
 
  229     alpha = 
r[0] * (1. - k[0] * k[0]);
 
  233         for (j = 0; j < 
i; j++)
 
  234             epsilon += 
a[j] * 
r[
i - j];
 
  239         for (j = 
i - 1; j >= 0; j--)
 
  240             k[j] = 
a[j] + k[
i] * 
a[
i - j - 1];
 
  241         for (j = 0; j <= 
i; j++)
 
  290     for (
i = 0; 
i < 
n; 
i++) {
 
  291         const int in = 
i * 
n;
 
  295         for (j = 0; j < 
i; j++)
 
  296             value -= matrix[j * 
n + j] * matrix[
in + j] * matrix[
in + j];
 
  303         for (j = 
i + 1; j < 
n; j++) {
 
  304             const int jn = j * 
n;
 
  308             for (k = 0; k < 
i; k++)
 
  309                 x -= matrix[k * 
n + k] * matrix[
in + k] * matrix[jn + k];
 
  310             matrix[jn + 
i] = x / matrix[
in + 
i];
 
  318                             double *vector, 
int n, 
double *
out)
 
  332     for (
i = 0; 
i < 
n; 
i++) {
 
  333         const int in = 
i * 
n;
 
  337         for (j = 0; j < 
i; j++)
 
  338             value -= matrix[
in + j] * y[j];
 
  342     for (
i = 
n - 1; 
i >= 0; 
i--) {
 
  344         for (j = 
i + 1; j < 
n; j++)
 
  352                          double *acoefficients, 
int *
index, 
int nb_errors,
 
  353                          double *auxiliary, 
double *interpolated)
 
  355     double *vector, *matrix;
 
  358     av_fast_malloc(&
c->matrix, &
c->matrix_size, nb_errors * nb_errors * 
sizeof(*
c->matrix));
 
  370     for (
i = 0; 
i < nb_errors; 
i++) {
 
  371         const int im = 
i * nb_errors;
 
  373         for (j = 
i; j < nb_errors; j++) {
 
  375                 matrix[j * nb_errors + 
i] = matrix[
im + j] = auxiliary[
abs(
index[j] - 
index[
i])];
 
  377                 matrix[j * nb_errors + 
i] = matrix[
im + j] = 0;
 
  382     for (
i = 0; 
i < nb_errors; 
i++) {
 
  397                         double *unused1, 
double *unused2,
 
  399                         const double *
src, 
double *dst)
 
  402     double max_amplitude = 0;
 
  406     av_fast_malloc(&
c->histogram, &
c->histogram_size, 
s->nb_hbins * 
sizeof(*
c->histogram));
 
  409     histogram = 
c->histogram;
 
  410     memset(histogram, 0, 
sizeof(*histogram) * 
s->nb_hbins);
 
  412     for (
i = 0; 
i < 
s->window_size; 
i++) {
 
  420     for (
i = 
s->nb_hbins - 1; 
i > 1; 
i--) {
 
  423                 max_amplitude = 
i / (double)
s->nb_hbins;
 
  429     if (max_amplitude > 0.) {
 
  430         for (
i = 0; 
i < 
s->window_size; 
i++) {
 
  435     memset(
clip, 0, 
s->ar_order * 
sizeof(*
clip));
 
  436     memset(
clip + (
s->window_size - 
s->ar_order), 0, 
s->ar_order * 
sizeof(*
clip));
 
  447                          double *detection, 
double *acoefficients,
 
  449                          const double *
src, 
double *dst)
 
  452     int i, j, nb_clicks = 0, prev = -1;
 
  454     memset(detection, 0, 
s->window_size * 
sizeof(*detection));
 
  457         for (j = 0; j <= 
s->ar_order; j++) {
 
  458             detection[
i] += acoefficients[j] * 
src[
i - j];
 
  462     for (
i = 0; 
i < 
s->window_size; 
i++) {
 
  463         click[
i] = fabs(detection[
i]) > sigmae * 
threshold;
 
  467     for (
i = 0; 
i < 
s->window_size; 
i++) {
 
  472             for (j = prev + 1; j < 
i; j++)
 
  477     memset(click, 0, 
s->ar_order * 
sizeof(*click));
 
  478     memset(click + (
s->window_size - 
s->ar_order), 0, 
s->ar_order * 
sizeof(*click));
 
  496     const double *
src = (
const double *)
s->in->extended_data[
ch];
 
  497     double *
is = (
double *)
s->is->extended_data[
ch];
 
  498     double *dst = (
double *)
s->out->extended_data[
ch];
 
  499     double *ptr = (
double *)
out->extended_data[
ch];
 
  500     double *
buf = (
double *)
s->buffer->extended_data[
ch];
 
  501     const double *
w = 
s->window_func_lut;
 
  509         double *interpolated = 
c->interpolated;
 
  513         nb_errors = 
s->detector(
s, 
c, sigmae, 
c->detection, 
c->acoefficients,
 
  517                                 nb_errors, 
c->auxiliary, interpolated);
 
  521             for (j = 0; j < nb_errors; j++) {
 
  522                 dst[
index[j]] = interpolated[j];
 
  527         memcpy(dst, 
src, 
s->window_size * 
sizeof(*dst));
 
  530     if (
s->method == 0) {
 
  531         for (j = 0; j < 
s->window_size; j++)
 
  532             buf[j] += dst[j] * 
w[j];
 
  534         const int skip = 
s->overlap_skip;
 
  536         for (j = 0; j < 
s->hop_size; j++)
 
  537             buf[j] = dst[skip + j];
 
  539     for (j = 0; j < 
s->hop_size; j++)
 
  542     memmove(
buf, 
buf + 
s->hop_size, (
s->window_size * 2 - 
s->hop_size) * 
sizeof(*
buf));
 
  543     memmove(
is, 
is + 
s->hop_size, (
s->window_size - 
s->hop_size) * 
sizeof(*
is));
 
  544     memset(
buf + 
s->window_size * 2 - 
s->hop_size, 0, 
s->hop_size * 
sizeof(*
buf));
 
  545     memset(
is + 
s->window_size - 
s->hop_size, 0, 
s->hop_size * 
sizeof(*
is));
 
  556     int ret = 0, j, 
ch, detected_errors = 0;
 
  573     for (
ch = 0; 
ch < 
s->in->channels; 
ch++) {
 
  574         double *
is = (
double *)
s->is->extended_data[
ch];
 
  576         for (j = 0; j < 
s->hop_size; j++) {
 
  584     if (
s->samples_left > 0)
 
  585         out->nb_samples = 
FFMIN(
s->hop_size, 
s->samples_left);
 
  588     s->pts += 
s->hop_size;
 
  590     s->detected_errors += detected_errors;
 
  591     s->nb_samples += 
out->nb_samples * 
inlink->channels;
 
  597     if (
s->samples_left > 0) {
 
  598         s->samples_left -= 
s->hop_size;
 
  599         if (
s->samples_left <= 0)
 
  652     if (
s->eof && 
s->samples_left <= 0) {
 
  667     s->is_declip = !strcmp(
ctx->filter->name, 
"adeclip");
 
  683            s->is_declip ? 
"clips" : 
"clicks", 
s->detected_errors,
 
  684            s->nb_samples, 100. * 
s->detected_errors / 
s->nb_samples);
 
  694         for (
i = 0; 
i < 
s->nb_channels; 
i++) {
 
  708             c->histogram_size = 0;
 
  741     .priv_class    = &adeclick_class,
 
  769     .priv_class    = &adeclip_class,
 
  
void av_audio_fifo_free(AVAudioFifo *af)
Free an AVAudioFifo.
 
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
 
A list of supported channel layouts.
 
static int query_formats(AVFilterContext *ctx)
 
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
 
static const AVFilterPad outputs[]
 
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
 
The official guide to swscale for confused that is
 
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
 
static enum AVSampleFormat sample_fmts[]
 
enum MovChannelLayoutTag * layouts
 
#define AVERROR_EOF
End of file.
 
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(INT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_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), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { 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) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;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)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&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);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=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) { int planes=out->planar ? out->ch_count :1;unsigned m=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){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch ch
 
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
 
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
 
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
 
static av_cold int end(AVCodecContext *avctx)
 
This structure describes decoded (raw) audio or video data.
 
static av_cold int init(AVFilterContext *ctx)
 
const char * name
Filter name.
 
AVFormatInternal * internal
An opaque field for libavformat internal usage.
 
A link between two filters.
 
static int activate(AVFilterContext *ctx)
 
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
 
Context for an Audio FIFO Buffer.
 
int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples)
Drain data from an AVAudioFifo.
 
A filter pad used for either input or output.
 
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
 
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
Write data to an AVAudioFifo.
 
static int detect_clicks(AudioDeclickContext *s, DeclickChannel *c, double sigmae, double *detection, double *acoefficients, uint8_t *click, int *index, const double *src, double *dst)
 
static av_cold void uninit(AVFilterContext *ctx)
 
static int config_input(AVFilterLink *inlink)
 
static void autocorrelation(const double *input, int order, int size, double *output, double scale)
 
Describe the class of an AVClass context structure.
 
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.
 
AVAudioFifo * av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, int nb_samples)
Allocate an AVAudioFifo.
 
int(* detector)(struct AudioDeclickContext *s, DeclickChannel *c, double sigmae, double *detection, double *acoefficients, uint8_t *click, int *index, const double *src, double *dst)
 
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
 
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
 
static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
 
static const AVOption adeclick_options[]
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
 
double fmin(double, double)
 
#define AV_NOPTS_VALUE
Undefined timestamp value.
 
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
 
FF_FILTER_FORWARD_WANTED(outlink, inlink)
 
int av_audio_fifo_size(AVAudioFifo *af)
Get the current number of samples in the AVAudioFifo available for reading.
 
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
 
static double autoregression(const double *samples, int ar_order, int nb_samples, double *k, double *r, double *a)
 
static int interpolation(DeclickChannel *c, const double *src, int ar_order, double *acoefficients, int *index, int nb_errors, double *auxiliary, double *interpolated)
 
#define AV_LOG_INFO
Standard information.
 
static int detect_clips(AudioDeclickContext *s, DeclickChannel *c, double unused0, double *unused1, double *unused2, uint8_t *clip, int *index, const double *src, double *dst)
 
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
 
static int filter_frame(AVFilterLink *inlink)
 
#define i(width, name, range_min, range_max)
 
static int find_index(int *index, int value, int size)
 
static const AVOption adeclip_options[]
 
AVSampleFormat
Audio sample formats.
 
Used for passing data between threads.
 
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
 
const char * name
Pad name.
 
static int factorization(double *matrix, int n)
 
AVFILTER_DEFINE_CLASS(adeclick)
 
static const AVFilterPad inputs[]
 
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
 
@ AV_SAMPLE_FMT_DBLP
double, planar
 
Filter the word “frame” indicates either a video frame or a group of audio samples
 
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
 
static const int16_t alpha[]
 
static int do_interpolation(DeclickChannel *c, double *matrix, double *vector, int n, double *out)
 
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
 
#define flags(name, subs,...)
 
static int isfinite_array(double *samples, int nb_samples)
 
int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples)
Peek data from an AVAudioFifo.
 
static double clip(void *opaque, double val)
Clip value val in the minval - maxval range.
 
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.