mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-22 08:22:04 +03:00
[sam] Adding CMSIS 2.10
This commit is contained in:
@ -0,0 +1,121 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_copy_f32.c
|
||||
*
|
||||
* Description: Copies the elements of a floating-point vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 0.0.7 2010/06/10
|
||||
* Misra-C changes done
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup copy Vector Copy
|
||||
*
|
||||
* Copies sample by sample from source vector to destination vector.
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = pSrc[n]; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
* There are separate functions for floating point, Q31, Q15, and Q7 data types.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup copy
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Copies the elements of a floating-point vector.
|
||||
* @param[in] *pSrc points to input vector
|
||||
* @param[out] *pDst points to output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_copy_f32(
|
||||
float32_t * pSrc,
|
||||
float32_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = A */
|
||||
/* Copy and then store the results in the destination buffer */
|
||||
*pDst++ = *pSrc++;
|
||||
*pDst++ = *pSrc++;
|
||||
*pDst++ = *pSrc++;
|
||||
*pDst++ = *pSrc++;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = A */
|
||||
/* Copy and then store the results in the destination buffer */
|
||||
*pDst++ = *pSrc++;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of BasicCopy group
|
||||
*/
|
@ -0,0 +1,130 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_copy_q15.c
|
||||
*
|
||||
* Description: Copies the elements of a Q15 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 0.0.7 2010/06/10
|
||||
* Misra-C changes done
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup copy
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Copies the elements of a Q15 vector.
|
||||
* @param[in] *pSrc points to input vector
|
||||
* @param[out] *pDst points to output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
|
||||
void arm_copy_q15(
|
||||
q15_t * pSrc,
|
||||
q15_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
q15_t in1, in2; /* Temporary variables */
|
||||
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = A */
|
||||
/* Read two inputs */
|
||||
in1 = *pSrc++;
|
||||
in2 = *pSrc++;
|
||||
|
||||
#ifndef ARM_MATH_BIG_ENDIAN
|
||||
|
||||
/* Store the values in the destination buffer by packing the two inputs */
|
||||
*__SIMD32(pDst)++ = __PKHBT(in1, in2, 16);
|
||||
|
||||
in1 = *pSrc++;
|
||||
in2 = *pSrc++;
|
||||
*__SIMD32(pDst)++ = __PKHBT(in1, in2, 16);
|
||||
|
||||
#else
|
||||
|
||||
/* Store the values in the destination buffer by packing the two inputs */
|
||||
*__SIMD32(pDst)++ = __PKHBT(in2, in1, 16);
|
||||
|
||||
in1 = *pSrc++;
|
||||
in2 = *pSrc++;
|
||||
*__SIMD32(pDst)++ = __PKHBT(in2, in1, 16);
|
||||
|
||||
|
||||
#endif /* #ifndef ARM_MATH_BIG_ENDIAN */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = A */
|
||||
/* Copy and then store the value in the destination buffer */
|
||||
*pDst++ = *pSrc++;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of BasicCopy group
|
||||
*/
|
@ -0,0 +1,109 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_copy_q31.c
|
||||
*
|
||||
* Description: Copies the elements of a Q31 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 0.0.7 2010/06/10
|
||||
* Misra-C changes done
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup copy
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Copies the elements of a Q31 vector.
|
||||
* @param[in] *pSrc points to input vector
|
||||
* @param[out] *pDst points to output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
|
||||
void arm_copy_q31(
|
||||
q31_t * pSrc,
|
||||
q31_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = A */
|
||||
/* Copy and then store the values in the destination buffer */
|
||||
*pDst++ = *pSrc++;
|
||||
*pDst++ = *pSrc++;
|
||||
*pDst++ = *pSrc++;
|
||||
*pDst++ = *pSrc++;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = A */
|
||||
/* Copy and then store the value in the destination buffer */
|
||||
*pDst++ = *pSrc++;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of BasicCopy group
|
||||
*/
|
@ -0,0 +1,107 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_copy_q7.c
|
||||
*
|
||||
* Description: Copies the elements of a Q7 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 0.0.7 2010/06/10
|
||||
* Misra-C changes done
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup copy
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Copies the elements of a Q7 vector.
|
||||
* @param[in] *pSrc points to input vector
|
||||
* @param[out] *pDst points to output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
|
||||
void arm_copy_q7(
|
||||
q7_t * pSrc,
|
||||
q7_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = A */
|
||||
/* Copy and then store the results in the destination buffer */
|
||||
/* 4 samples are copied and stored at a time using SIMD */
|
||||
*__SIMD32(pDst)++ = *__SIMD32(pSrc)++;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = A */
|
||||
/* Copy and then store the results in the destination buffer */
|
||||
*pDst++ = *pSrc++;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of BasicCopy group
|
||||
*/
|
@ -0,0 +1,122 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_fill_f32.c
|
||||
*
|
||||
* Description: Fills a constant value into a floating-point vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 0.0.7 2010/06/10
|
||||
* Misra-C changes done
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup Fill Vector Fill
|
||||
*
|
||||
* Fills the destination vector with a constant value.
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = value; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
* There are separate functions for floating point, Q31, Q15, and Q7 data types.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Fill
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Fills a constant value into a floating-point vector.
|
||||
* @param[in] value input value to be filled
|
||||
* @param[out] *pDst points to output vector
|
||||
* @param[in] blockSize length of the output vector
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_fill_f32(
|
||||
float32_t value,
|
||||
float32_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = value */
|
||||
/* Fill the value in the destination buffer */
|
||||
*pDst++ = value;
|
||||
*pDst++ = value;
|
||||
*pDst++ = value;
|
||||
*pDst++ = value;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = value */
|
||||
/* Fill the value in the destination buffer */
|
||||
*pDst++ = value;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of Fill group
|
||||
*/
|
@ -0,0 +1,112 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_fill_q15.c
|
||||
*
|
||||
* Description: Fills a constant value into a Q15 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 0.0.7 2010/06/10
|
||||
* Misra-C changes done
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Fill
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Fills a constant value into a Q15 vector.
|
||||
* @param[in] value input value to be filled
|
||||
* @param[out] *pDst points to output vector
|
||||
* @param[in] blockSize length of the output vector
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
|
||||
void arm_fill_q15(
|
||||
q15_t value,
|
||||
q15_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
q31_t packedValue; /* value packed to 32 bits */
|
||||
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* Packing two 16 bit values to 32 bit value in order to use SIMD */
|
||||
packedValue = __PKHBT(value, value, 16u);
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = value */
|
||||
/* Fill the value in the destination buffer */
|
||||
*__SIMD32(pDst)++ = packedValue;
|
||||
*__SIMD32(pDst)++ = packedValue;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = value */
|
||||
/* Fill the value in the destination buffer */
|
||||
*pDst++ = value;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of Fill group
|
||||
*/
|
@ -0,0 +1,109 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_fill_q31.c
|
||||
*
|
||||
* Description: Fills a constant value into a Q31 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 0.0.7 2010/06/10
|
||||
* Misra-C changes done
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Fill
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Fills a constant value into a Q31 vector.
|
||||
* @param[in] value input value to be filled
|
||||
* @param[out] *pDst points to output vector
|
||||
* @param[in] blockSize length of the output vector
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
|
||||
void arm_fill_q31(
|
||||
q31_t value,
|
||||
q31_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = value */
|
||||
/* Fill the value in the destination buffer */
|
||||
*pDst++ = value;
|
||||
*pDst++ = value;
|
||||
*pDst++ = value;
|
||||
*pDst++ = value;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = value */
|
||||
/* Fill the value in the destination buffer */
|
||||
*pDst++ = value;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of Fill group
|
||||
*/
|
@ -0,0 +1,110 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_fill_q7.c
|
||||
*
|
||||
* Description: Fills a constant value into a Q7 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 0.0.7 2010/06/10
|
||||
* Misra-C changes done
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Fill
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Fills a constant value into a Q7 vector.
|
||||
* @param[in] value input value to be filled
|
||||
* @param[out] *pDst points to output vector
|
||||
* @param[in] blockSize length of the output vector
|
||||
* @return none.
|
||||
*
|
||||
*/
|
||||
|
||||
void arm_fill_q7(
|
||||
q7_t value,
|
||||
q7_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
q31_t packedValue; /* value packed to 32 bits */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* Packing four 8 bit values to 32 bit value in order to use SIMD */
|
||||
packedValue = __PACKq7(value, value, value, value);
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = value */
|
||||
/* Fill the value in the destination buffer */
|
||||
*__SIMD32(pDst)++ = packedValue;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = value */
|
||||
/* Fill the value in the destination buffer */
|
||||
*pDst++ = value;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of Fill group
|
||||
*/
|
@ -0,0 +1,193 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_float_to_q15.c
|
||||
*
|
||||
* Description: Converts the elements of the floating-point vector to Q15 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup float_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the floating-point vector to Q15 vector.
|
||||
* @param[in] *pSrc points to the floating-point input vector
|
||||
* @param[out] *pDst points to the Q15 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
* \par
|
||||
* The equation used for the conversion process is:
|
||||
* <pre>
|
||||
* pDst[n] = (q15_t)(pSrc[n] * 32768); 0 <= n < blockSize.
|
||||
* </pre>
|
||||
* \par Scaling and Overflow Behavior:
|
||||
* \par
|
||||
* The function uses saturating arithmetic.
|
||||
* Results outside of the allowable Q15 range [0x8000 0x7FFF] will be saturated.
|
||||
* \note
|
||||
* In order to apply rounding, the library should be rebuilt with the ROUNDING macro
|
||||
* defined in the preprocessor section of project options.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_float_to_q15(
|
||||
float32_t * pSrc,
|
||||
q15_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
float32_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
|
||||
float32_t in;
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
/* C = A * 32768 */
|
||||
/* convert from float to q15 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 32768.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q15_t) (__SSAT((q31_t) (in), 16));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 32768.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q15_t) (__SSAT((q31_t) (in), 16));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 32768.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q15_t) (__SSAT((q31_t) (in), 16));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 32768.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q15_t) (__SSAT((q31_t) (in), 16));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 32768 */
|
||||
/* convert from float to q15 and then store the results in the destination buffer */
|
||||
*pDst++ = (q15_t) __SSAT((q31_t) (*pIn++ * 32768.0f), 16);
|
||||
*pDst++ = (q15_t) __SSAT((q31_t) (*pIn++ * 32768.0f), 16);
|
||||
*pDst++ = (q15_t) __SSAT((q31_t) (*pIn++ * 32768.0f), 16);
|
||||
*pDst++ = (q15_t) __SSAT((q31_t) (*pIn++ * 32768.0f), 16);
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
/* C = A * 32768 */
|
||||
/* convert from float to q15 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 32768.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q15_t) (__SSAT((q31_t) (in), 16));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 32768 */
|
||||
/* convert from float to q15 and then store the results in the destination buffer */
|
||||
*pDst++ = (q15_t) __SSAT((q31_t) (*pIn++ * 32768.0f), 16);
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
/* C = A * 32768 */
|
||||
/* convert from float to q15 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 32768.0f);
|
||||
in += in > 0 ? 0.5f : -0.5f;
|
||||
*pDst++ = (q15_t) (__SSAT((q31_t) (in), 16));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 32768 */
|
||||
/* convert from float to q15 and then store the results in the destination buffer */
|
||||
*pDst++ = (q15_t) __SSAT((q31_t) (*pIn++ * 32768.0f), 16);
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of float_to_x group
|
||||
*/
|
@ -0,0 +1,200 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_float_to_q31.c
|
||||
*
|
||||
* Description: Converts the elements of the floating-point vector to Q31 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup float_to_x Convert 32-bit floating point value
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup float_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the floating-point vector to Q31 vector.
|
||||
* @param[in] *pSrc points to the floating-point input vector
|
||||
* @param[out] *pDst points to the Q31 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
*\par Description:
|
||||
* \par
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (q31_t)(pSrc[n] * 2147483648); 0 <= n < blockSize.
|
||||
* </pre>
|
||||
* <b>Scaling and Overflow Behavior:</b>
|
||||
* \par
|
||||
* The function uses saturating arithmetic.
|
||||
* Results outside of the allowable Q31 range[0x80000000 0x7FFFFFFF] will be saturated.
|
||||
*
|
||||
* \note In order to apply rounding, the library should be rebuilt with the ROUNDING macro
|
||||
* defined in the preprocessor section of project options.
|
||||
*/
|
||||
|
||||
|
||||
void arm_float_to_q31(
|
||||
float32_t * pSrc,
|
||||
q31_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
float32_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
|
||||
float32_t in;
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
|
||||
/* C = A * 32768 */
|
||||
/* convert from float to Q31 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 2147483648.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (in));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 2147483648.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (in));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 2147483648.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (in));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 2147483648.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (in));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 2147483648 */
|
||||
/* convert from float to Q31 and then store the results in the destination buffer */
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (*pIn++ * 2147483648.0f));
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (*pIn++ * 2147483648.0f));
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (*pIn++ * 2147483648.0f));
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (*pIn++ * 2147483648.0f));
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
|
||||
/* C = A * 2147483648 */
|
||||
/* convert from float to Q31 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 2147483648.0f);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (in));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 2147483648 */
|
||||
/* convert from float to Q31 and then store the results in the destination buffer */
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (*pIn++ * 2147483648.0f));
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
|
||||
/* C = A * 2147483648 */
|
||||
/* convert from float to Q31 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 2147483648.0f);
|
||||
in += in > 0 ? 0.5f : -0.5f;
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (in));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 2147483648 */
|
||||
/* convert from float to Q31 and then store the results in the destination buffer */
|
||||
*pDst++ = clip_q63_to_q31((q63_t) (*pIn++ * 2147483648.0f));
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of float_to_x group
|
||||
*/
|
@ -0,0 +1,192 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_float_to_q7.c
|
||||
*
|
||||
* Description: Converts the elements of the floating-point vector to Q7 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup float_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the floating-point vector to Q7 vector.
|
||||
* @param[in] *pSrc points to the floating-point input vector
|
||||
* @param[out] *pDst points to the Q7 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
*\par Description:
|
||||
* \par
|
||||
* The equation used for the conversion process is:
|
||||
* <pre>
|
||||
* pDst[n] = (q7_t)(pSrc[n] * 128); 0 <= n < blockSize.
|
||||
* </pre>
|
||||
* \par Scaling and Overflow Behavior:
|
||||
* \par
|
||||
* The function uses saturating arithmetic.
|
||||
* Results outside of the allowable Q7 range [0x80 0x7F] will be saturated.
|
||||
* \note
|
||||
* In order to apply rounding, the library should be rebuilt with the ROUNDING macro
|
||||
* defined in the preprocessor section of project options.
|
||||
*/
|
||||
|
||||
|
||||
void arm_float_to_q7(
|
||||
float32_t * pSrc,
|
||||
q7_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
float32_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
|
||||
float32_t in;
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
/* C = A * 128 */
|
||||
/* convert from float to q7 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 128);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q7_t) (__SSAT((q15_t) (in), 8));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 128);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q7_t) (__SSAT((q15_t) (in), 8));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 128);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q7_t) (__SSAT((q15_t) (in), 8));
|
||||
|
||||
in = *pIn++;
|
||||
in = (in * 128);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q7_t) (__SSAT((q15_t) (in), 8));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 128 */
|
||||
/* convert from float to q7 and then store the results in the destination buffer */
|
||||
*pDst++ = __SSAT((q31_t) (*pIn++ * 128.0f), 8);
|
||||
*pDst++ = __SSAT((q31_t) (*pIn++ * 128.0f), 8);
|
||||
*pDst++ = __SSAT((q31_t) (*pIn++ * 128.0f), 8);
|
||||
*pDst++ = __SSAT((q31_t) (*pIn++ * 128.0f), 8);
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
/* C = A * 128 */
|
||||
/* convert from float to q7 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 128);
|
||||
in += in > 0 ? 0.5 : -0.5;
|
||||
*pDst++ = (q7_t) (__SSAT((q15_t) (in), 8));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 128 */
|
||||
/* convert from float to q7 and then store the results in the destination buffer */
|
||||
*pDst++ = __SSAT((q31_t) (*pIn++ * 128.0f), 8);
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
#ifdef ARM_MATH_ROUNDING
|
||||
/* C = A * 128 */
|
||||
/* convert from float to q7 and then store the results in the destination buffer */
|
||||
in = *pIn++;
|
||||
in = (in * 128.0f);
|
||||
in += in > 0 ? 0.5f : -0.5f;
|
||||
*pDst++ = (q7_t) (__SSAT((q31_t) (in), 8));
|
||||
|
||||
#else
|
||||
|
||||
/* C = A * 128 */
|
||||
/* convert from float to q7 and then store the results in the destination buffer */
|
||||
*pDst++ = (q7_t) __SSAT((q31_t) (*pIn++ * 128.0f), 8);
|
||||
|
||||
#endif /* #ifdef ARM_MATH_ROUNDING */
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of float_to_x group
|
||||
*/
|
@ -0,0 +1,123 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q15_to_float.c
|
||||
*
|
||||
* Description: Converts the elements of the Q15 vector to floating-point vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup q15_to_x Convert 16-bit Integer value
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q15_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q15 vector to floating-point vector.
|
||||
* @param[in] *pSrc points to the Q15 input vector
|
||||
* @param[out] *pDst points to the floating-point output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (float32_t) pSrc[n] / 32768; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q15_to_float(
|
||||
q15_t * pSrc,
|
||||
float32_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q15_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (float32_t) A / 32768 */
|
||||
/* convert from q15 to float and then store the results in the destination buffer */
|
||||
*pDst++ = ((float32_t) * pIn++ / 32768.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 32768.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 32768.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 32768.0f);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (float32_t) A / 32768 */
|
||||
/* convert from q15 to float and then store the results in the destination buffer */
|
||||
*pDst++ = ((float32_t) * pIn++ / 32768.0f);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q15_to_x group
|
||||
*/
|
@ -0,0 +1,116 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q15_to_q31.c
|
||||
*
|
||||
* Description: Converts the elements of the Q15 vector to Q31 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q15_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q15 vector to Q31 vector.
|
||||
* @param[in] *pSrc points to the Q15 input vector
|
||||
* @param[out] *pDst points to the Q31 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (q31_t) pSrc[n] << 16; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q15_to_q31(
|
||||
q15_t * pSrc,
|
||||
q31_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q15_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q31_t)A << 16 */
|
||||
/* convert from q15 to q31 and then store the results in the destination buffer */
|
||||
*pDst++ = (q31_t) * pIn++ << 16;
|
||||
*pDst++ = (q31_t) * pIn++ << 16;
|
||||
*pDst++ = (q31_t) * pIn++ << 16;
|
||||
*pDst++ = (q31_t) * pIn++ << 16;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q31_t)A << 16 */
|
||||
/* convert from q15 to q31 and then store the results in the destination buffer */
|
||||
*pDst++ = (q31_t) * pIn++ << 16;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q15_to_x group
|
||||
*/
|
@ -0,0 +1,117 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q15_to_q7.c
|
||||
*
|
||||
* Description: Converts the elements of the Q15 vector to Q7 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q15_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q15 vector to Q7 vector.
|
||||
* @param[in] *pSrc points to the Q15 input vector
|
||||
* @param[out] *pDst points to the Q7 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (q7_t) pSrc[n] >> 8; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q15_to_q7(
|
||||
q15_t * pSrc,
|
||||
q7_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q15_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q7_t) A >> 8 */
|
||||
/* convert from q15 to q7 and then store the results in the destination buffer */
|
||||
*pDst++ = (q7_t) (*pIn++ >> 8);
|
||||
*pDst++ = (q7_t) (*pIn++ >> 8);
|
||||
*pDst++ = (q7_t) (*pIn++ >> 8);
|
||||
*pDst++ = (q7_t) (*pIn++ >> 8);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q7_t) A >> 8 */
|
||||
/* convert from q15 to q7 and then store the results in the destination buffer */
|
||||
*pDst++ = (q7_t) (*pIn++ >> 8);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q15_to_x group
|
||||
*/
|
@ -0,0 +1,120 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q31_to_float.c
|
||||
*
|
||||
* Description: Converts the elements of the Q31 vector to floating-point vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup q31_to_x Convert 32-bit Integer value
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q31_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q31 vector to floating-point vector.
|
||||
* @param[in] *pSrc points to the Q31 input vector
|
||||
* @param[out] *pDst points to the floating-point output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (float32_t) pSrc[n] / 2147483648; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q31_to_float(
|
||||
q31_t * pSrc,
|
||||
float32_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q31_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (float32_t) A / 2147483648 */
|
||||
/* convert from q31 to float and then store the results in the destination buffer */
|
||||
*pDst++ = ((float32_t) * pIn++ / 2147483648.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 2147483648.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 2147483648.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 2147483648.0f);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (float32_t) A / 2147483648 */
|
||||
/* convert from q31 to float and then store the results in the destination buffer */
|
||||
*pDst++ = ((float32_t) * pIn++ / 2147483648.0f);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q31_to_x group
|
||||
*/
|
@ -0,0 +1,116 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q31_to_q15.c
|
||||
*
|
||||
* Description: Converts the elements of the Q31 vector to Q15 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q31_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q31 vector to Q15 vector.
|
||||
* @param[in] *pSrc points to the Q31 input vector
|
||||
* @param[out] *pDst points to the Q15 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (q15_t) pSrc[n] >> 16; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q31_to_q15(
|
||||
q31_t * pSrc,
|
||||
q15_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q31_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q15_t) A >> 16 */
|
||||
/* convert from q31 to q15 and then store the results in the destination buffer */
|
||||
*pDst++ = (q15_t) (*pIn++ >> 16);
|
||||
*pDst++ = (q15_t) (*pIn++ >> 16);
|
||||
*pDst++ = (q15_t) (*pIn++ >> 16);
|
||||
*pDst++ = (q15_t) (*pIn++ >> 16);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q15_t) A >> 16 */
|
||||
/* convert from q31 to q15 and then store the results in the destination buffer */
|
||||
*pDst++ = (q15_t) (*pIn++ >> 16);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q31_to_x group
|
||||
*/
|
@ -0,0 +1,116 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q31_to_q7.c
|
||||
*
|
||||
* Description: Converts the elements of the Q31 vector to Q7 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q31_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q31 vector to Q7 vector.
|
||||
* @param[in] *pSrc points to the Q31 input vector
|
||||
* @param[out] *pDst points to the Q7 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (q7_t) pSrc[n] >> 24; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q31_to_q7(
|
||||
q31_t * pSrc,
|
||||
q7_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q31_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q7_t) A >> 24 */
|
||||
/* convert from q31 to q7 and then store the results in the destination buffer */
|
||||
*pDst++ = (q7_t) (*pIn++ >> 24);
|
||||
*pDst++ = (q7_t) (*pIn++ >> 24);
|
||||
*pDst++ = (q7_t) (*pIn++ >> 24);
|
||||
*pDst++ = (q7_t) (*pIn++ >> 24);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q7_t) A >> 24 */
|
||||
/* convert from q31 to q7 and then store the results in the destination buffer */
|
||||
*pDst++ = (q7_t) (*pIn++ >> 24);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q31_to_x group
|
||||
*/
|
@ -0,0 +1,120 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q7_to_float.c
|
||||
*
|
||||
* Description: Converts the elements of the Q7 vector to floating-point vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup q7_to_x Convert 8-bit Integer value
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q7_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q7 vector to floating-point vector.
|
||||
* @param[in] *pSrc points to the Q7 input vector
|
||||
* @param[out] *pDst points to the floating-point output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (float32_t) pSrc[n] / 128; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q7_to_float(
|
||||
q7_t * pSrc,
|
||||
float32_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q7_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (float32_t) A / 128 */
|
||||
/* convert from q7 to float and then store the results in the destination buffer */
|
||||
*pDst++ = ((float32_t) * pIn++ / 128.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 128.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 128.0f);
|
||||
*pDst++ = ((float32_t) * pIn++ / 128.0f);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (float32_t) A / 128 */
|
||||
/* convert from q7 to float and then store the results in the destination buffer */
|
||||
*pDst++ = ((float32_t) * pIn++ / 128.0f);
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q7_to_x group
|
||||
*/
|
@ -0,0 +1,119 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q7_to_q15.c
|
||||
*
|
||||
* Description: Converts the elements of the Q7 vector to Q15 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q7_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q7 vector to Q15 vector.
|
||||
* @param[in] *pSrc points to the Q7 input vector
|
||||
* @param[out] *pDst points to the Q15 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (q15_t) pSrc[n] << 8; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q7_to_q15(
|
||||
q7_t * pSrc,
|
||||
q15_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q7_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q15_t) A << 8 */
|
||||
/* convert from q7 to q15 and then store the results in the destination buffer */
|
||||
*pDst++ = (q15_t) * pIn++ << 8;
|
||||
*pDst++ = (q15_t) * pIn++ << 8;
|
||||
*pDst++ = (q15_t) * pIn++ << 8;
|
||||
*pDst++ = (q15_t) * pIn++ << 8;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q15_t) A << 8 */
|
||||
/* convert from q7 to q15 and then store the results in the destination buffer */
|
||||
*pDst++ = (q15_t) * pIn++ << 8;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q7_to_x group
|
||||
*/
|
@ -0,0 +1,116 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (C) 2010 ARM Limited. All rights reserved.
|
||||
*
|
||||
* $Date: 15. July 2011
|
||||
* $Revision: V1.0.10
|
||||
*
|
||||
* Project: CMSIS DSP Library
|
||||
* Title: arm_q7_to_q31.c
|
||||
*
|
||||
* Description: Converts the elements of the Q7 vector to Q31 vector.
|
||||
*
|
||||
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
||||
*
|
||||
* Version 1.0.10 2011/7/15
|
||||
* Big Endian support added and Merged M0 and M3/M4 Source code.
|
||||
*
|
||||
* Version 1.0.3 2010/11/29
|
||||
* Re-organized the CMSIS folders and updated documentation.
|
||||
*
|
||||
* Version 1.0.2 2010/11/11
|
||||
* Documentation updated.
|
||||
*
|
||||
* Version 1.0.1 2010/10/05
|
||||
* Production release and review comments incorporated.
|
||||
*
|
||||
* Version 1.0.0 2010/09/20
|
||||
* Production release and review comments incorporated.
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
/**
|
||||
* @ingroup groupSupport
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup q7_to_x
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Converts the elements of the Q7 vector to Q31 vector.
|
||||
* @param[in] *pSrc points to the Q7 input vector
|
||||
* @param[out] *pDst points to the Q31 output vector
|
||||
* @param[in] blockSize length of the input vector
|
||||
* @return none.
|
||||
*
|
||||
* \par Description:
|
||||
*
|
||||
* The equation used for the conversion process is:
|
||||
*
|
||||
* <pre>
|
||||
* pDst[n] = (q31_t) pSrc[n] << 24; 0 <= n < blockSize.
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
void arm_q7_to_q31(
|
||||
q7_t * pSrc,
|
||||
q31_t * pDst,
|
||||
uint32_t blockSize)
|
||||
{
|
||||
q7_t *pIn = pSrc; /* Src pointer */
|
||||
uint32_t blkCnt; /* loop counter */
|
||||
|
||||
#ifndef ARM_MATH_CM0
|
||||
|
||||
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
||||
|
||||
/*loop Unrolling */
|
||||
blkCnt = blockSize >> 2u;
|
||||
|
||||
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
|
||||
** a second loop below computes the remaining 1 to 3 samples. */
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q31_t) A << 24 */
|
||||
/* convert from q7 to q31 and then store the results in the destination buffer */
|
||||
*pDst++ = (q31_t) * pIn++ << 24;
|
||||
*pDst++ = (q31_t) * pIn++ << 24;
|
||||
*pDst++ = (q31_t) * pIn++ << 24;
|
||||
*pDst++ = (q31_t) * pIn++ << 24;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
|
||||
** No loop unrolling is used. */
|
||||
blkCnt = blockSize % 0x4u;
|
||||
|
||||
#else
|
||||
|
||||
/* Run the below code for Cortex-M0 */
|
||||
|
||||
/* Loop over blockSize number of values */
|
||||
blkCnt = blockSize;
|
||||
|
||||
#endif /* #ifndef ARM_MATH_CM0 */
|
||||
|
||||
while(blkCnt > 0u)
|
||||
{
|
||||
/* C = (q31_t) A << 24 */
|
||||
/* convert from q7 to q31 and then store the results in the destination buffer */
|
||||
*pDst++ = (q31_t) * pIn++ << 24;
|
||||
|
||||
/* Decrement the loop counter */
|
||||
blkCnt--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} end of q7_to_x group
|
||||
*/
|
Reference in New Issue
Block a user