Subject: Re: radiotap DB vs DBM, signedness
To: None <tech-net@NetBSD.org>
From: Greg Troxel <gdt@ir.bbn.com>
List: tech-net
Date: 09/20/2006 08:48:05
--=-=-=
Content-Transfer-Encoding: quoted-printable


David Young <dyoung@pobox.com> writes:

> On Wed, Sep 13, 2006 at 02:47:29PM -0400, Greg Troxel wrote:
>> The other problem is that IEEE80211_RADIOTAP_DB_ANT is in u_int8_t
>> rather than int8_t.  For dB, this doesn't make sense.
>
> Why doesn't it make sense?  If you choose the reference point right, then
> all dB values will fit between 0 and 255.  Maybe I am missing something.

[I know you know some of what I'm saying, but I'm including it for the
broader audience.]

It doesn't make sense because dB relative to a reference is
fundamentally a signed quantity.  We're talking about how to encode a
real number in a computer representation.  So the two choices are what
degree of quantization and the range.  We now have fixed-point with
256 values, and that seems fine.  So therefore we can either have -128
to +127 relative to a reference, or we can have +0 to +255.  With
signed, the system is well behaved for any reasonable choice of
reference.  With unsigned, the reference has to be below the minimum
value that will ever happen or one gets wrapping.

1 mW (used for dBm) is the standard reference level, and in my view an
'unspecified reference' is simply a way to say that the calibration to
dBm is lame or unknown.

With a value that's actually in dBm, and the current DB_ANT encoding,
I got values like 160 dB for noise and 220 dB for a strong signal.
This is relative to -256 dBm, which is an odd choice.  And then values
like +20 dBm can't be represented on the same scale.  Had this been
signed, I would have obtained -96 and -46 dB, which would have been
decent values for "uncalibrated dBm" in this case.


I think my real point is that you shouldn't be forced to choose a
reference point that's on the low end of all possible values.  With a
signed representation and the notion that a reference closer to 1 mW
is better, there's no grief.

=2D-=20
    Greg Troxel <gdt@ir.bbn.com>

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (NetBSD)

iD8DBQFFETiF+vesoDJhHiURAvQIAJ9WOAJmqBdan0NScdtEhbjbMr1+2wCfXLo4
2syJ7WCIuCpZMoJ+p0kD4lY=
=6FRY
-----END PGP SIGNATURE-----
--=-=-=--