Updated the indentation and added the optimized var function

pull/39/head
Silfurion 4 years ago
parent c6b18e9e92
commit 433ecc8b22

@ -49,6 +49,7 @@ void arm_var_f64(
uint32_t blockSize,
float64_t * pResult)
{
uint32_t blkCnt; /* Loop counter */
float64_t sum = 0.; /* Temporary result storage */
float64_t fSum = 0.;
@ -60,28 +61,29 @@ void arm_var_f64(
*pResult = 0;
return;
}
/* Initialize blkCnt with number of samples */
blkCnt = blockSize;
arm_mean_f64(pInput, blockSize, &fMean);
#if defined(ARM_MATH_NEON)
float64x2_t fValueV ,fsumV , pInputV , fMeanV;
fsumV = vdupq_n_f64(0.0f);
fMeanV = vdupq_n_f64(fMean);
blkCnt = blockSize >> 1U;
while(blkCnt > 0U)
{
/* C = (A[0] + A[1] + A[2] + ... + A[blockSize-1]) */
sum += *pInput++;
/* Decrement loop counter */
pInputV = vld1q_f64(pInput);
fValueV = vsubq_f64(pInputV, fMeanV);
fsumV = vmlaq_f64(fsumV, fValueV, fValueV);
pInput += 2 ;
blkCnt--;
}
fSum = vaddvq_f64(fsumV);
/* C = (A[0] + A[1] + A[2] + ... + A[blockSize-1]) / blockSize */
fMean = sum / (float64_t) blockSize;
pInput = pSrc;
blkCnt = blockSize & 1 ;
#else
/* Initialize blkCnt with number of samples */
blkCnt = blockSize;
#endif
while (blkCnt > 0U)
{
fValue = *pInput++ - fMean;

Loading…
Cancel
Save