mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avfilter/af_headphone: improve performance and reduce latency
Remove not needed code. Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
18d6ff2b42
commit
2b0f821f51
@ -3175,6 +3175,10 @@ Default is @var{freq}.
|
||||
|
||||
@item lfe
|
||||
Set custom gain for LFE channels. Value is in dB. Default is 0.
|
||||
|
||||
@item size
|
||||
Set size of frame in number of samples which will be processed at once.
|
||||
Default value is @var{1024}. Allowed range is from 1024 to 96000.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
@ -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 }
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user