Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/math_helper.c')
-rw-r--r--Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/math_helper.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/math_helper.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/math_helper.c
index 35925c853..2b1d30d92 100644
--- a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/math_helper.c
+++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/math_helper.c
@@ -64,7 +64,7 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
if (temp == 0x7FC00000)
{
- return(0);
+ return(100000.0);
}
/* Checking for a NAN value in pTest array */
@@ -73,7 +73,7 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
if (temp == 0x7FC00000)
{
- return(0);
+ return(100000.0);
}
EnergySignal += pRef[i] * pRef[i];
EnergyError += (pRef[i] - pTest[i]) * (pRef[i] - pTest[i]);
@@ -85,12 +85,21 @@ float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize)
if (temp == 0x7FC00000)
{
- return(0);
+ return(100000.0);
}
SNR = 10 * log10f (EnergySignal / EnergyError);
+ /* Checking for a NAN value in SNR */
+ test = (int *)(&SNR);
+ temp = *test;
+
+ if (temp == 0x7FC00000)
+ {
+ return(100000.0);
+ }
+
return (SNR);
}
@@ -113,7 +122,7 @@ double arm_snr_f64(double *pRef, double *pTest, uint32_t buffSize)
if (temp == 0x7FC00000)
{
- return(0);
+ return(100000.0);
}
/* Checking for a NAN value in pTest array */
@@ -122,7 +131,7 @@ double arm_snr_f64(double *pRef, double *pTest, uint32_t buffSize)
if (temp == 0x7FC00000)
{
- return(0);
+ return(100000.0);
}
EnergySignal += pRef[i] * pRef[i];
EnergyError += (pRef[i] - pTest[i]) * (pRef[i] - pTest[i]);
@@ -134,12 +143,21 @@ double arm_snr_f64(double *pRef, double *pTest, uint32_t buffSize)
if (temp == 0x7FC00000)
{
- return(0);
+ return(100000.0);
}
SNR = 10 * log10 (EnergySignal / EnergyError);
+ /* Checking for a NAN value in SNR */
+ test = (int *)(&SNR);
+ temp = *test;
+
+ if (temp == 0x7FC00000)
+ {
+ return(10000.0);
+ }
+
return (SNR);
}