1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

CalcDB: use direct value for floor in value to dB conversion

This commit is contained in:
f4exb 2017-08-17 17:17:25 +02:00
parent 90ce3ec9ad
commit 3536cfb816
2 changed files with 8 additions and 6 deletions

View File

@ -16,17 +16,19 @@
#include "util/db.h"
#include <cmath>
#include <cassert>
double CalcDb::dbPower(double magsq, double floordB)
double CalcDb::dbPower(double magsq, double floor)
{
if (magsq > 0)
assert(floor > 0.0);
if (magsq > floor)
{
double val = 10.0 * log10(magsq);
return val > floordB ? val : floordB;
return 10.0 * log10(magsq);
}
else
{
return floordB;
return 10.0 * log10(floor);
}
}

View File

@ -22,7 +22,7 @@
class CalcDb
{
public:
static double dbPower(double magsq, double floordB = -100.0);
static double dbPower(double magsq, double floor = 1e-10);
static double powerFromdB(double powerdB);
};