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/Source/StatisticsFunctions/arm_min_q31.c')
-rw-r--r--Drivers/CMSIS/DSP/Source/StatisticsFunctions/arm_min_q31.c124
1 files changed, 55 insertions, 69 deletions
diff --git a/Drivers/CMSIS/DSP/Source/StatisticsFunctions/arm_min_q31.c b/Drivers/CMSIS/DSP/Source/StatisticsFunctions/arm_min_q31.c
index fc4c1556c..e25eb47ef 100644
--- a/Drivers/CMSIS/DSP/Source/StatisticsFunctions/arm_min_q31.c
+++ b/Drivers/CMSIS/DSP/Source/StatisticsFunctions/arm_min_q31.c
@@ -3,13 +3,13 @@
* Title: arm_min_q31.c
* Description: Minimum value of a Q31 vector
*
- * $Date: 27. January 2017
- * $Revision: V.1.5.1
+ * $Date: 18. March 2019
+ * $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
- * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
+ * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -29,127 +29,113 @@
#include "arm_math.h"
/**
- * @ingroup groupStats
+ @ingroup groupStats
*/
/**
- * @addtogroup Min
- * @{
+ @addtogroup Min
+ @{
*/
-
/**
- * @brief Minimum value of a Q31 vector.
- * @param[in] *pSrc points to the input vector
- * @param[in] blockSize length of the input vector
- * @param[out] *pResult minimum value returned here
- * @param[out] *pIndex index of minimum value returned here
- * @return none.
+ @brief Minimum value of a Q31 vector.
+ @param[in] pSrc points to the input vector
+ @param[in] blockSize number of samples in input vector
+ @param[out] pResult minimum value returned here
+ @param[out] pIndex index of minimum value returned here
+ @return none
*/
void arm_min_q31(
- q31_t * pSrc,
- uint32_t blockSize,
- q31_t * pResult,
- uint32_t * pIndex)
+ const q31_t * pSrc,
+ uint32_t blockSize,
+ q31_t * pResult,
+ uint32_t * pIndex)
{
-#if defined (ARM_MATH_DSP)
- /* Run the below code for Cortex-M4 and Cortex-M3 */
+ q31_t minVal, out; /* Temporary variables to store the output value. */
+ uint32_t blkCnt, outIndex; /* Loop counter */
- q31_t minVal1, minVal2, out; /* Temporary variables to store the output value. */
- uint32_t blkCnt, outIndex, count; /* loop counter */
+#if defined (ARM_MATH_LOOPUNROLL)
+ uint32_t index; /* index of maximum value */
+#endif
- /* Initialise the count value. */
- count = 0U;
- /* Initialise the index value to zero. */
+ /* Initialise index value to zero. */
outIndex = 0U;
/* Load first input value that act as reference value for comparision */
out = *pSrc++;
- /* Loop unrolling */
+#if defined (ARM_MATH_LOOPUNROLL)
+ /* Initialise index of maximum value. */
+ index = 0U;
+
+ /* Loop unrolling: Compute 4 outputs at a time */
blkCnt = (blockSize - 1U) >> 2U;
while (blkCnt > 0U)
{
- /* Initialize minVal to the next consecutive values one by one */
- minVal1 = *pSrc++;
- minVal2 = *pSrc++;
+ /* Initialize minVal to next consecutive values one by one */
+ minVal = *pSrc++;
/* compare for the minimum value */
- if (out > minVal1)
+ if (out > minVal)
{
- /* Update the minimum value and its index */
- out = minVal1;
- outIndex = count + 1U;
+ /* Update the minimum value and it's index */
+ out = minVal;
+ outIndex = index + 1U;
}
- /* compare for the minimum value */
- if (out > minVal2)
+ minVal = *pSrc++;
+ if (out > minVal)
{
- /* Update the minimum value and its index */
- out = minVal2;
- outIndex = count + 2U;
+ out = minVal;
+ outIndex = index + 2U;
}
- /* Initialize minVal to the next consecutive values one by one */
- minVal1 = *pSrc++;
- minVal2 = *pSrc++;
-
- /* compare for the minimum value */
- if (out > minVal1)
+ minVal = *pSrc++;
+ if (out > minVal)
{
- /* Update the minimum value and its index */
- out = minVal1;
- outIndex = count + 3U;
+ out = minVal;
+ outIndex = index + 3U;
}
- /* compare for the minimum value */
- if (out > minVal2)
+ minVal = *pSrc++;
+ if (out > minVal)
{
- /* Update the minimum value and its index */
- out = minVal2;
- outIndex = count + 4U;
+ out = minVal;
+ outIndex = index + 4U;
}
- count += 4U;
+ index += 4U;
- /* Decrement the loop counter */
+ /* Decrement loop counter */
blkCnt--;
}
- /* if (blockSize - 1U) is not multiple of 4 */
+ /* Loop unrolling: Compute remaining outputs */
blkCnt = (blockSize - 1U) % 4U;
#else
- /* Run the below code for Cortex-M0 */
-
- q31_t minVal1, out; /* Temporary variables to store the output value. */
- uint32_t blkCnt, outIndex; /* loop counter */
-
- /* Initialise the index value to zero. */
- outIndex = 0U;
- /* Load first input value that act as reference value for comparision */
- out = *pSrc++;
+ /* Initialize blkCnt with number of samples */
blkCnt = (blockSize - 1U);
-#endif /* #if defined (ARM_MATH_DSP) */
+#endif /* #if defined (ARM_MATH_LOOPUNROLL) */
while (blkCnt > 0U)
{
/* Initialize minVal to the next consecutive values one by one */
- minVal1 = *pSrc++;
+ minVal = *pSrc++;
/* compare for the minimum value */
- if (out > minVal1)
+ if (out > minVal)
{
/* Update the minimum value and it's index */
- out = minVal1;
+ out = minVal;
outIndex = blockSize - blkCnt;
}
- /* Decrement the loop counter */
+ /* Decrement loop counter */
blkCnt--;
}
@@ -159,5 +145,5 @@ void arm_min_q31(
}
/**
- * @} end of Min group
+ @} end of Min group
*/