On Sat, 15 Apr 2006, Mauro Carvalho Chehab wrote: > Em Sex, 2006-04-14 ās 19:40 -0700, Trent Piepho escreveu: > > oN fRI, 14 Apr 2006, Mauro Carvalho Chehab wrote: > > > I've decided to use u64, instead of all those shifts. This way, we can > > > improve the precision for lower BER rates. Here, it worked like a charm: > > > > It was only a single shift. Anyway, the 64 bit math isn't being done > > correctly. Here is a graph were you can see the problem clearly: > > http://www.speakeasy.org/~xyzzy/ber-error.png > Hmmm... I forgot the (s64) at the calculus :) I'll fix it. I think it is > better to make calculus with 64 bits to preserve precision, especially > for low BER rates. If you adjusted the table to eliminate the the last line, which can't be reached with a 22-bit value, and added an extra line for 50%, you could get the scale factor up to 13 or 14 bits without overflow in 32-bit math. Is 64-bit math worth it for an extra 2 or 3 bits? Really, the loss of smoothness comes from trying to scale BER from 0..5380 into just 1% of the range. I was researching how to find SNR from BER, and think I have a better understanding of how this works now. If anyone understands this better, maybe they can correct me if I'm wrong. Normally BER is though of as a probability, that is a number between 0 and 1, of a bit being in error, and named Pb. It's normal to want this probably to be very small, on the order of 10^-6. Usually when you see a graph of BER aka Pb, it will be log scaled. The relationship between Pb and something called Eb/N0 is defined by the modulation used. Eb is the energy per bit, and N0 is the noise spectral energy density. Here is some good information: http://www.sss-mag.com/ebn0.html According to wikipedia, the formula for QPSK, used by DVB-S, is: Pb = Q(sqrt(2*Eb/N0)) Where Q(x) is the tail area under the unit normal distribution from x to positive infinity. You can think of is the probability that a random number with a Gaussian (aka normal) distribution is greater than x. At least that the definition on wikipedia, I think that might be wrong and it's more complex than that. If I graph this, I get a plot that matches the one for PSK on the sss-mag article. I think that Eb = S/fb, where S is the signal power and fb is the bitrate in bits/sec, and that N0 = N/BW, where N is the noise power and BW is the noise bandwidth in MHz. This gives Eb/N0 = (S/N) * (BW/fb), giving us Eb/N0, and thus Pb, in terms of SNR. For QPSK, the bitrate is twice the bandwidth, so (BW/fb) = 1/2. Convert SNR in deciBels to S/N with S/N = 10^(SNR/10). Plug all that in, and graph the result: Pb = Q(sqrt(10^(SNR/10))) http://www.speakeasy.org/~xyzzy/snr-ber-qpsk.png So I think THIS is the curve you should be trying to use to convert BER to SNR. The question I have it, what are the units of the 22-bit value read from the chip? How do you convert this to the fraction of the bits in error? Divide by the gross bitrate (bandwidth in MHz times two)? _______________________________________________ linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb