Hello
The codes shown below is for the clutter removing from mmWave SDK. Is the "1<<(obj->log2NumDopplerBins-1)" for the rounding of the value pMeanVal?
If the answer is Yes, I think a correct way to do the ROUNDING for the signed number should be "(int)(num < 0 ? (num - 0.5) : (num + 0.5))
". So, how does the following codes ROUND the negative number?
if (obj->cliCfg->clutterRemovalCfg.enabled) { uint32_t sumVal[2]; cmplx32ReIm_t *pSumVal = (cmplx32ReIm_t *) sumVal; uint32_t meanVal; cmplx16ReIm_t *pMeanVal = (cmplx16ReIm_t *) &meanVal; mmwavelib_vecsum((int16_t *) inpDoppFftBuf, (int32_t *) sumVal, (int32_t) obj->numDopplerBins); pMeanVal->real = (pSumVal->real + (1<<(obj->log2NumDopplerBins-1))) >> obj->log2NumDopplerBins; pMeanVal->imag = (pSumVal->imag + (1<<(obj->log2NumDopplerBins-1))) >> obj->log2NumDopplerBins; mmwavelib_vecsubc((int16_t *) inpDoppFftBuf, (int16_t *) inpDoppFftBuf, (uint32_t) meanVal, (int32_t) obj->numDopplerBins); }
Regards
Peter