Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-02-15 22:15:45 +0400
committerNicolas George <nicolas.george@normalesup.org>2012-03-05 19:57:27 +0400
commit3073aadf2ded5f02f2db7ee151a02f592ea24733 (patch)
tree9362cec0db3e674132eb99822742fbcd27b154dc /libavdevice/alsa-audio-dec.c
parent1007a805a486a1348a0543ac2dd99d823148d25c (diff)
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/alsa-audio-dec.c')
-rw-r--r--libavdevice/alsa-audio-dec.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index f2dd21655b..62bf42d272 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -59,7 +59,6 @@ static av_cold int audio_read_header(AVFormatContext *s1)
AVStream *st;
int ret;
enum CodecID codec_id;
- double o;
st = avformat_new_stream(s1, NULL);
if (!st) {
@@ -81,9 +80,9 @@ static av_cold int audio_read_header(AVFormatContext *s1)
st->codec->sample_rate = s->sample_rate;
st->codec->channels = s->channels;
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
- o = 2 * M_PI * s->period_size / s->sample_rate * 1.5; // bandwidth: 1.5Hz
+ /* microseconds instead of seconds, MHz instead of Hz */
s->timefilter = ff_timefilter_new(1000000.0 / s->sample_rate,
- sqrt(2 * o), o * o);
+ s->period_size, 1.5E-6);
if (!s->timefilter)
goto fail;