Mark Taylor schrieb am Don, 28 Sep 2000:
> 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))
>
> (44.1khz -> 32khz requires 320 windows, but 48khz->32khz only
> requires 4!)
int gcd( int u, int v )
{
int t;
while (u > 0) {
if (u < v) {
t = u;
u = v;
v = t;
}
u = u-v;
}
return v;
}
32000/gcd(44100,32000) = 320
32000/gcd(48000,32000) = 2
Ciao Robert
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )