From: Guillaume L. <gle...@tf...> - 2004-03-28 16:58:01
|
--On Dimanche 28 mars 2004 18:16 +0200 Gabriel Bouvigne <bou...@mp...> wrote: > Guillaume Lessard wrote: > >>> In calc_noise, we have this: >>> >>> noise = *distort++ = noise / *l3_xmin++; >>> >>> /* multiplying here is adding in dB, but can overflow */ >>> noise = FAST_LOG10(Max(noise,1E-20)); >>> > >>> In those 2 cases, we are considering the noise of the sfb to be -20, and >>> even worst we are adding -20 to total noise instead of 0. > >> This is just a question of size. As long as 1e-20 is much smaller than a >> normal value, everything is fine. All we can do is use the log of a >> vanishingly small number instead of log(0); 10^(-20) seems, at first >> blush, good enough. > > The (potential) problem is that: > 1) we are then considering the sfb to be distorted, and are increasing > the "over_count" value > b) we are using a log of the value, so 10^(-20) is becoming -20, which is > not minor at all when added to tot_noise. It is minor. The code replaces 0 with 0.00000000000000000001. Remember that log(0) is minus infinity, an unrepresentable value. We are replacing -NaN with -20, thus avoiding an error. For kicks, I added the line "printf("%f ", noise);" just after the log calculation. Here's a sampling of the results: -0.529911 -0.539173 -0.741660 -0.704893 -1.057069 -1.230736 -1.895052 -2.570281 (and it goes on and on). The logs of the noise values are mostly between -3 and 0, which is to say between 0.001 and 1. This shows that the value chosen to avoid NaN errors is correct and well below any typically calculated noise. -- Guillaume Lessard gle...@tf... |