[FFmpeg-devel] [PATCH] lavfi: add aecho filter

Timothy Gu timothygu99 at gmail.com
Tue Jul 9 23:02:45 CEST 2013


On Jul 9, 2013 7:53 AM, "Paul B Mahol" <onemda at gmail.com> wrote:
> + at item delay1..7

delay1 through delay7. Same below

> +Set time interval in miliseconds between original signal and reflection.
> +
> + at item decay1..7
> +Loudness of reflected signal.
> +
> + at end table
> +

[...]

> diff --git a/libavfilter/af_aecho.c b/libavfilter/af_aecho.c
> new file mode 100644
> index 0000000..9d4010d
> --- /dev/null
> +++ b/libavfilter/af_aecho.c
> @@ -0,0 +1,297 @@

[...]

> +#define MAX_ECHOS 7

MAX_ECHOES

This is also not documented directly (although users can infer from the
options numbering).

> +
> +typedef struct AudioEchoContext {
> +    const AVClass *class;
> +    float in_gain, out_gain;
> +    float delay[MAX_ECHOS], decay[MAX_ECHOS];
> +    int nb_echos;
> +    int delay_index;
> +    uint8_t **delayptrs;
> +    int max_samples, fade_out;
> +    int samples[MAX_ECHOS];
> +    int64_t next_pts;
> +
> +    void (*echo_samples)(struct AudioEchoContext *ctx, uint8_t
**delayptrs,
> +                         uint8_t * const *src, uint8_t **dst,
> +                         int nb_samples, int channels);
> +} AudioEchoContext;
> +
> +#define OFFSET(x) offsetof(AudioEchoContext, x)
> +#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
> +
> +static const AVOption aecho_options[] = {
> +    { "in_gain",  "", OFFSET(in_gain),  AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { "out_gain", "", OFFSET(out_gain), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { "delay1",   "", OFFSET(delay[0]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
90000, A },
> +    { "decay1",   "", OFFSET(decay[0]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { "delay2",   "", OFFSET(delay[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
90000, A },
> +    { "decay2",   "", OFFSET(decay[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { "delay3",   "", OFFSET(delay[2]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
90000, A },
> +    { "decay3",   "", OFFSET(decay[2]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { "delay4",   "", OFFSET(delay[3]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
90000, A },
> +    { "decay4",   "", OFFSET(decay[3]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { "delay5",   "", OFFSET(delay[4]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
90000, A },
> +    { "decay5",   "", OFFSET(decay[4]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { "delay6",   "", OFFSET(delay[5]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
90000, A },
> +    { "decay6",   "", OFFSET(decay[5]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { "delay7",   "", OFFSET(delay[6]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
90000, A },
> +    { "decay7",   "", OFFSET(decay[6]), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0,
1, A },
> +    { NULL },
> +};

The default should be saner, i.e. users should be able to have an echo
effect without specifying any options.

[...]

Rest LGTM from a non-programmer's point of view.

Timothy


More information about the ffmpeg-devel mailing list