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:
parent
90ce3ec9ad
commit
3536cfb816
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user