From: Jaroslav Kysela Date: Tue, 12 Mar 2002 19:22:43 +0000 (+0000) Subject: Linear interpolation fix by Takashi X-Git-Tag: v1.0.3~453 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=b559c97833252db4833bdd4a613a4256b2400127;p=alsa-lib.git Linear interpolation fix by Takashi --- diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 2e5e73f6..752c3af9 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -145,18 +145,8 @@ static snd_pcm_uframes_t snd_pcm_rate_expand(const snd_pcm_channel_area_t *dst_a new_sample = sample; src += src_step; src_frames1++; -#if 1 /* fast-change interpolation */ - /* this interpolation gives us better results especially for low-rate sources */ - // sample = (((int)old_sample * (DIV - pos)) + ((int)new_sample * pos)) / DIV; - sample = ((int)old_sample + (int)new_sample) / 2; - } else { - sample = new_sample; } -#else /* linear interpolation */ - /* in some cases, a high-band filter is required to remove high noises */ - } - sample = (((int)old_sample * (DIV - pos)) + ((int)new_sample * pos)) / DIV; -#endif + sample = (((int64_t)old_sample * (int64_t)(get_threshold - pos)) + ((int64_t)new_sample * pos)) / get_threshold; goto *put; #define PUT16_END after_put #include "plugin_ops.h"