diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-02-15 19:15:45 +0100 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-03-05 16:57:27 +0100 |
commit | 3073aadf2ded5f02f2db7ee151a02f592ea24733 (patch) | |
tree | 9362cec0db3e674132eb99822742fbcd27b154dc /libavdevice/jack_audio.c | |
parent | 1007a805a486a1348a0543ac2dd99d823148d25c (diff) | |
download | ffmpeg-3073aadf2ded5f02f2db7ee151a02f592ea24733.tar.gz |
timefilter: internally compute feedback factors.
The feedback factors for the timefilter are directly computed from
the expected period. This commit changes the init function to accept
the period itself and compute the feedback factors internally,
rather than having all client code duplicate the formulas.
This commit also actually fixes the formulas: the current code had
sqrt(2*o), but the correct formula, both theoretically and according
to experimental testing, is sqrt(2)*o.
Furthermore, it adds an exponential to feedback factors larger than
1 with large periods.
Diffstat (limited to 'libavdevice/jack_audio.c')
-rw-r--r-- | libavdevice/jack_audio.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c index 257a291758..1fa4f86724 100644 --- a/libavdevice/jack_audio.c +++ b/libavdevice/jack_audio.c @@ -145,7 +145,6 @@ static int start_jack(AVFormatContext *context) JackData *self = context->priv_data; jack_status_t status; int i, test; - double o, period; /* Register as a JACK client, using the context filename as client name. */ self->client = jack_client_open(context->filename, JackNullOption, &status); @@ -181,9 +180,7 @@ static int start_jack(AVFormatContext *context) jack_set_xrun_callback(self->client, xrun_callback, self); /* Create time filter */ - period = (double) self->buffer_size / self->sample_rate; - o = 2 * M_PI * 1.5 * period; /// bandwidth: 1.5Hz - self->timefilter = ff_timefilter_new (1.0 / self->sample_rate, sqrt(2 * o), o * o); + self->timefilter = ff_timefilter_new (1.0 / self->sample_rate, self->buffer_size, 1.5); /* Create FIFO buffers */ self->filled_pkts = av_fifo_alloc(FIFO_PACKETS_NUM * sizeof(AVPacket)); |