你好
在cli模块设置localmax阈值和cafar阈值后,最终经过如下转换输入到HWA中使用,请问转换是什么意思,有没有文档介绍。
Local Max:
/* 2D maximum value offset */
#define CONST_LOG2_10 (3.3219f)
scratchVal = round((float)(obj->cfarAzimFFTCfg.localMaxCfg.azimThreshold)* ((1.0f/20.0f) * CONST_LOG2_10 * 2048.0f));
obj->dopplerAzimHwaCommonConfig.advStatConfig.max2DoffsetDim1 = -scratchVal;
scratchVal = round((float)(obj->cfarAzimFFTCfg.localMaxCfg.dopplerThreshold)* ((1.0f/20.0f) * CONST_LOG2_10 * 2048.0f));
obj->dopplerAzimHwaCommonConfig.advStatConfig.max2DoffsetDim2 = -scratchVal;
Range Cfar:
static uint16_t Mmw_convertRangeCfarToThresh(uint16_t codedCfarVal, uint8_t numBands)
{
uint16_t linearVal;
float dbVal, linVal;
uint32_t defaultScaling = 1 << 11;
float additionalScaling = numBands / (float)(1 << mathUtils_ceilLog2(numBands));
/* dbVal is a float value from 0-100dB. It needs to
be converted to linear scale..
First, recover float dbVal that was encoded in CLI. */
dbVal = (float)(codedCfarVal / MMW_CFAR_THRESHOLD_ENCODING_FACTOR);
/* Now convert it to linear value */
linVal = (uint32_t)(log2f(pow(10, (float)dbVal/20.0)) * additionalScaling * defaultScaling + 0.5);
linearVal = (uint16_t) linVal;
return (linearVal);
}
Doppler Cfar:
#define CONST_LOG2_10 (3.3219)
static uint16_t Mmw_convertDopplerCfarToThresh(uint16_t codedCfarVal)
{
uint16_t linearVal;
float dbVal, linVal;
/* dbVal is a float value from 0-100dB. It needs to
be converted to linear scale..
First, recover float dbVal that was encoded in CLI. */
dbVal = (float)(codedCfarVal / MMW_CFAR_THRESHOLD_ENCODING_FACTOR);
/* Now convert it to linear value */
linVal = (uint32_t)(dbVal/20.0 * CONST_LOG2_10 * 2048.0);
linearVal = (uint16_t) linVal;
return (linearVal);
}