> From: "Mark Taylor" <[EMAIL PROTECTED]>
>
> I hope to add something soon which has it precompute the exact amount
> needed. Does anyone have code which computes the lcd (largest
> common denominator) of two ints? I think the number of windows needed
> is given by: out_samplerate/(lcd(in_samplerate,out_samplerate))
A positively ancient algorithm (by Euclid IIRC :)
/* gcd - greatest common divisor */
int gcd(int i, int j) {
return j ? gcd(j, i % j) : i;
}
or if you'd prefer a non-recursive version
int gcd(int i, int j) {
while (j) {
int t=j;
j=i%j;
i=t;
}
return i;
}
-- Mat.
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )
- [MP3 ENCODER] resampling Gabriel Bouvigne
- Re: [MP3 ENCODER] resampling Mark Taylor
- Re: [MP3 ENCODER] resampling Robert Hegemann
- Re: [MP3 ENCODER] resampling Frank Klemm
- Re: [MP3 ENCODER] resampling Mark Taylor
- Re: [MP3 ENCODER] resampling Frank Klemm
- Re: [MP3 ENCODER] resampling Mark Taylor
- Re: [MP3 ENCODER] resampling Frank Klemm
- Re: [MP3 ENCODER] resamplin... Mark Taylor
- Re: [MP3 ENCODER] resampling Mathew Hendry
- Re: [MP3 ENCODER] resampling Frank Klemm
- Re: [MP3 ENCODER] resampling Mark Taylor
- Re: [MP3 ENCODER] resampling Frank Klemm
- Re: [MP3 ENCODER] resampling Mark Taylor
- Re: [MP3 ENCODER] resampling Frank Klemm
- Re: [MP3 ENCODER] resampling Mark Taylor
