Correct the calculation of dBfs signal level.

dBFS is defined in AES Standard AES17-1998, IEC 61606, and ITU-T Recs.
P.381 and P.382, such that the RMS value of a full-scale sine wave is
designated 0 dBFS.

A full scale sine wave on HackRF has the range -127 to 127.

We calculate the full scale ratio relative to a signal in which both I
and Q are held at 127. This represents a signal with sqrt(2) times
the amplitude, and thus twice the power, of a full scale sine wave.

Therefore to obtain dBfs by the above definition, we add 3dB.
This commit is contained in:
Martin Ling
2022-09-14 18:15:44 +01:00
parent 66fa76c550
commit f1e34b7cea

View File

@ -1357,8 +1357,8 @@ int main(int argc, char** argv)
fprintf(stderr, "Waiting for sync...\n");
} else {
double full_scale_ratio = (double) stream_power_now /
(byte_count_now * 128 * 128);
double dB_full_scale = 10 * log10(full_scale_ratio);
(byte_count_now * 127 * 127);
double dB_full_scale = 10 * log10(full_scale_ratio) + 3.0;
fprintf(stderr,
"%4.1f MiB / %5.3f sec = %4.1f MiB/second, average power %3.1f dBfs",
(byte_count_now / 1e6f),