summaryrefslogtreecommitdiff
path: root/libavfilter/af_headphone.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-04-14 17:25:06 +0200
committerPaul B Mahol <onemda@gmail.com>2018-04-14 17:28:26 +0200
commit2b0f821f51d10ade2fa6d3efc33b09e594d0fcac (patch)
tree8512980de5931ff8d33b59262cdd5b8caeefc41b /libavfilter/af_headphone.c
parent18d6ff2b42c120f1b388c472366b0275ddf9629a (diff)
avfilter/af_headphone: improve performance and reduce latency
Remove not needed code. Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/af_headphone.c')
-rw-r--r--libavfilter/af_headphone.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
index 2188f7ab24..974445e15c 100644
--- a/libavfilter/af_headphone.c
+++ b/libavfilter/af_headphone.c
@@ -404,7 +404,7 @@ static int convert_coeffs(AVFilterContext *ctx, AVFilterLink *inlink)
int i, j;
s->buffer_length = 1 << (32 - ff_clz(s->ir_len));
- s->n_fft = n_fft = 1 << (32 - ff_clz(s->ir_len + inlink->sample_rate));
+ s->n_fft = n_fft = 1 << (32 - ff_clz(s->ir_len + s->size));
if (s->type == FREQUENCY_DOMAIN) {
fft_in_l = av_calloc(n_fft, sizeof(*fft_in_l));
@@ -650,12 +650,6 @@ static int config_input(AVFilterLink *inlink)
AVFilterContext *ctx = inlink->dst;
HeadphoneContext *s = ctx->priv;
- if (s->type == FREQUENCY_DOMAIN) {
- inlink->partial_buf_size =
- inlink->min_samples =
- inlink->max_samples = inlink->sample_rate;
- }
-
if (s->nb_irs < inlink->channels) {
av_log(ctx, AV_LOG_ERROR, "Number of inputs must be >= %d.\n", inlink->channels + 1);
return AVERROR(EINVAL);
@@ -719,11 +713,6 @@ static int config_output(AVFilterLink *outlink)
AVFilterLink *inlink = ctx->inputs[0];
int i;
- if (s->type == TIME_DOMAIN)
- s->size = 1024;
- else
- s->size = inlink->sample_rate;
-
for (i = 0; i < s->nb_inputs; i++) {
s->in[i].fifo = av_audio_fifo_alloc(ctx->inputs[i]->format, ctx->inputs[i]->channels, 1024);
if (!s->in[i].fifo)
@@ -798,6 +787,7 @@ static const AVOption headphone_options[] = {
{ "type", "set processing", OFFSET(type), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, .flags = FLAGS, "type" },
{ "time", "time domain", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = FLAGS, "type" },
{ "freq", "frequency domain", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = FLAGS, "type" },
+ { "size", "set frame size", OFFSET(size), AV_OPT_TYPE_INT, {.i64=1024},1024,96000, .flags = FLAGS },
{ NULL }
};