[MPlayer-dev-eng] What's up with frac_t af->mul?

Robert Juliano juliano.1 at osu.edu
Thu May 31 04:35:08 CEST 2007


Can someone explain the reasoning behind frac_t in libaf?

I've written a filter in which the ratio of input to output
is a float (it's equal to playback_speed).  I can approximate
it as rational number, but even with modest values (<10K), I
get integer overflows.  This causes particular problems in
af.c:af_calc_insize_constrained and leads to lost audio data.

By using rational numbers, the code ends up convoluted and
complex, with FUN code like this because ints != integers
   if(in>max_insize) in=t*(max_insize/t);
And without performance tests to prove otherwise, I doubt
that it is any faster than using floats, considering all
those gcd calculations, fraction canceling, and CPU cycles
multiplying and dividing each usage.

I suppose there was and still maybe a good reason for using
frac_t, but I'm missing it.  Could someone enlighten me.

Robert





More information about the MPlayer-dev-eng mailing list