|
|
|
|
@ -1,24 +1,24 @@
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* $Date: 19. March 2015
|
|
|
|
|
* $Revision: V.1.4.5
|
|
|
|
|
*
|
|
|
|
|
* Project: CMSIS DSP Library
|
|
|
|
|
* Title: arm_conv_partial_q15.c
|
|
|
|
|
*
|
|
|
|
|
* Description: Partial convolution of Q15 sequences.
|
|
|
|
|
*
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
* Copyright (C) 2010-2014 ARM Limited. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* $Date: 26. September 2016
|
|
|
|
|
* $Revision: V.1.4.5 a
|
|
|
|
|
*
|
|
|
|
|
* Project: CMSIS DSP Library
|
|
|
|
|
* Title: arm_conv_partial_q15.c
|
|
|
|
|
*
|
|
|
|
|
* Description: Partial convolution of Q15 sequences.
|
|
|
|
|
*
|
|
|
|
|
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
|
|
|
|
* - Redistributions of source code must retain the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
|
* - Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
|
* distribution.
|
|
|
|
|
* - Neither the name of ARM LIMITED nor the names of its contributors
|
|
|
|
|
* may be used to endorse or promote products derived from this
|
|
|
|
|
@ -27,7 +27,7 @@
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
@ -35,39 +35,38 @@
|
|
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
* -------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
#include "arm_math.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup groupFilters
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup groupFilters
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @addtogroup PartialConv
|
|
|
|
|
* @{
|
|
|
|
|
/**
|
|
|
|
|
* @addtogroup PartialConv
|
|
|
|
|
* @{
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Partial convolution of Q15 sequences.
|
|
|
|
|
* @param[in] *pSrcA points to the first input sequence.
|
|
|
|
|
* @param[in] srcALen length of the first input sequence.
|
|
|
|
|
* @param[in] *pSrcB points to the second input sequence.
|
|
|
|
|
* @param[in] srcBLen length of the second input sequence.
|
|
|
|
|
* @param[out] *pDst points to the location where the output result is written.
|
|
|
|
|
* @param[in] firstIndex is the first output sample to start with.
|
|
|
|
|
* @param[in] numPoints is the number of output points to be computed.
|
|
|
|
|
* @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
|
|
|
|
|
*
|
|
|
|
|
* Refer to <code>arm_conv_partial_fast_q15()</code> for a faster but less precise version of this function for Cortex-M3 and Cortex-M4.
|
|
|
|
|
*
|
|
|
|
|
* \par
|
|
|
|
|
/**
|
|
|
|
|
* @brief Partial convolution of Q15 sequences.
|
|
|
|
|
* @param[in] *pSrcA points to the first input sequence.
|
|
|
|
|
* @param[in] srcALen length of the first input sequence.
|
|
|
|
|
* @param[in] *pSrcB points to the second input sequence.
|
|
|
|
|
* @param[in] srcBLen length of the second input sequence.
|
|
|
|
|
* @param[out] *pDst points to the location where the output result is written.
|
|
|
|
|
* @param[in] firstIndex is the first output sample to start with.
|
|
|
|
|
* @param[in] numPoints is the number of output points to be computed.
|
|
|
|
|
* @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].
|
|
|
|
|
*
|
|
|
|
|
* Refer to <code>arm_conv_partial_fast_q15()</code> for a faster but less precise version of this function for Cortex-M3 and Cortex-M4.
|
|
|
|
|
*
|
|
|
|
|
* \par
|
|
|
|
|
* Refer the function <code>arm_conv_partial_opt_q15()</code> for a faster implementation of this function using scratch buffers.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arm_status arm_conv_partial_q15(
|
|
|
|
|
q15_t * pSrcA,
|
|
|
|
|
uint32_t srcALen,
|
|
|
|
|
@ -78,7 +77,8 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
uint32_t numPoints)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#if (defined(ARM_MATH_CM4) || defined(ARM_MATH_CM3)) && !defined(UNALIGNED_SUPPORT_DISABLE)
|
|
|
|
|
|
|
|
|
|
#if (defined(ARM_MATH_CM7) || defined(ARM_MATH_CM4) || defined(ARM_MATH_CM3)) && !defined(UNALIGNED_SUPPORT_DISABLE)
|
|
|
|
|
|
|
|
|
|
/* Run the below code for Cortex-M4 and Cortex-M3 */
|
|
|
|
|
|
|
|
|
|
@ -128,7 +128,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
srcALen = j;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Conditions to check which loopCounter holds
|
|
|
|
|
/* Conditions to check which loopCounter holds
|
|
|
|
|
* the first and last indices of the output samples to be calculated. */
|
|
|
|
|
check = firstIndex + numPoints;
|
|
|
|
|
blockSize3 = ((int32_t)check > (int32_t)srcALen) ? (int32_t)check - (int32_t)srcALen : 0;
|
|
|
|
|
@ -141,31 +141,31 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
blockSize2 = (blockSize2 > 0) ? blockSize2 : 0;
|
|
|
|
|
|
|
|
|
|
/* conv(x,y) at n = x[n] * y[0] + x[n-1] * y[1] + x[n-2] * y[2] + ...+ x[n-N+1] * y[N -1] */
|
|
|
|
|
/* The function is internally
|
|
|
|
|
* divided into three stages according to the number of multiplications that has to be
|
|
|
|
|
* taken place between inputA samples and inputB samples. In the first stage of the
|
|
|
|
|
* algorithm, the multiplications increase by one for every iteration.
|
|
|
|
|
* In the second stage of the algorithm, srcBLen number of multiplications are done.
|
|
|
|
|
* In the third stage of the algorithm, the multiplications decrease by one
|
|
|
|
|
/* The function is internally
|
|
|
|
|
* divided into three stages according to the number of multiplications that has to be
|
|
|
|
|
* taken place between inputA samples and inputB samples. In the first stage of the
|
|
|
|
|
* algorithm, the multiplications increase by one for every iteration.
|
|
|
|
|
* In the second stage of the algorithm, srcBLen number of multiplications are done.
|
|
|
|
|
* In the third stage of the algorithm, the multiplications decrease by one
|
|
|
|
|
* for every iteration. */
|
|
|
|
|
|
|
|
|
|
/* Set the output pointer to point to the firstIndex
|
|
|
|
|
/* Set the output pointer to point to the firstIndex
|
|
|
|
|
* of the output sample to be calculated. */
|
|
|
|
|
pOut = pDst + firstIndex;
|
|
|
|
|
|
|
|
|
|
/* --------------------------
|
|
|
|
|
* Initializations of stage1
|
|
|
|
|
/* --------------------------
|
|
|
|
|
* Initializations of stage1
|
|
|
|
|
* -------------------------*/
|
|
|
|
|
|
|
|
|
|
/* sum = x[0] * y[0]
|
|
|
|
|
* sum = x[0] * y[1] + x[1] * y[0]
|
|
|
|
|
* ....
|
|
|
|
|
* sum = x[0] * y[srcBlen - 1] + x[1] * y[srcBlen - 2] +...+ x[srcBLen - 1] * y[0]
|
|
|
|
|
/* sum = x[0] * y[0]
|
|
|
|
|
* sum = x[0] * y[1] + x[1] * y[0]
|
|
|
|
|
* ....
|
|
|
|
|
* sum = x[0] * y[srcBlen - 1] + x[1] * y[srcBlen - 2] +...+ x[srcBLen - 1] * y[0]
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* In this stage the MAC operations are increased by 1 for every iteration.
|
|
|
|
|
The count variable holds the number of MAC operations performed.
|
|
|
|
|
Since the partial convolution starts from firstIndex
|
|
|
|
|
/* In this stage the MAC operations are increased by 1 for every iteration.
|
|
|
|
|
The count variable holds the number of MAC operations performed.
|
|
|
|
|
Since the partial convolution starts from firstIndex
|
|
|
|
|
Number of Macs to be performed is firstIndex + 1 */
|
|
|
|
|
count = 1u + firstIndex;
|
|
|
|
|
|
|
|
|
|
@ -176,8 +176,8 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
pSrc2 = pIn2 + firstIndex;
|
|
|
|
|
py = pSrc2;
|
|
|
|
|
|
|
|
|
|
/* ------------------------
|
|
|
|
|
* Stage1 process
|
|
|
|
|
/* ------------------------
|
|
|
|
|
* Stage1 process
|
|
|
|
|
* ----------------------*/
|
|
|
|
|
|
|
|
|
|
/* For loop unrolling by 4, this stage is divided into two. */
|
|
|
|
|
@ -190,7 +190,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
/* Accumulator is made zero for every iteration */
|
|
|
|
|
sum = 0;
|
|
|
|
|
|
|
|
|
|
/* Loop over number of MAC operations between
|
|
|
|
|
/* Loop over number of MAC operations between
|
|
|
|
|
* inputA samples and inputB samples */
|
|
|
|
|
k = count;
|
|
|
|
|
|
|
|
|
|
@ -219,7 +219,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
|
|
|
|
|
/* The second part of the stage starts here */
|
|
|
|
|
/* The internal loop, over count, is unrolled by 4 */
|
|
|
|
|
/* To, read the last two inputB samples using SIMD:
|
|
|
|
|
/* To, read the last two inputB samples using SIMD:
|
|
|
|
|
* y[srcBLen] and y[srcBLen-1] coefficients, py is decremented by 1 */
|
|
|
|
|
py = py - 1;
|
|
|
|
|
|
|
|
|
|
@ -231,7 +231,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
/* Apply loop unrolling and compute 4 MACs simultaneously. */
|
|
|
|
|
k = count >> 2u;
|
|
|
|
|
|
|
|
|
|
/* First part of the processing with loop unrolling. Compute 4 MACs at a time.
|
|
|
|
|
/* First part of the processing with loop unrolling. Compute 4 MACs at a time.
|
|
|
|
|
** a second loop below computes MACs for the remaining 1 to 3 samples. */
|
|
|
|
|
while(k > 0u)
|
|
|
|
|
{
|
|
|
|
|
@ -245,11 +245,11 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
k--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For the next MAC operations, the pointer py is used without SIMD
|
|
|
|
|
/* For the next MAC operations, the pointer py is used without SIMD
|
|
|
|
|
* So, py is incremented by 1 */
|
|
|
|
|
py = py + 1u;
|
|
|
|
|
|
|
|
|
|
/* If the count is not a multiple of 4, compute any remaining MACs here.
|
|
|
|
|
/* If the count is not a multiple of 4, compute any remaining MACs here.
|
|
|
|
|
** No loop unrolling is used. */
|
|
|
|
|
k = count % 0x4u;
|
|
|
|
|
|
|
|
|
|
@ -276,14 +276,14 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
blockSize1--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --------------------------
|
|
|
|
|
* Initializations of stage2
|
|
|
|
|
/* --------------------------
|
|
|
|
|
* Initializations of stage2
|
|
|
|
|
* ------------------------*/
|
|
|
|
|
|
|
|
|
|
/* sum = x[0] * y[srcBLen-1] + x[1] * y[srcBLen-2] +...+ x[srcBLen-1] * y[0]
|
|
|
|
|
* sum = x[1] * y[srcBLen-1] + x[2] * y[srcBLen-2] +...+ x[srcBLen] * y[0]
|
|
|
|
|
* ....
|
|
|
|
|
* sum = x[srcALen-srcBLen-2] * y[srcBLen-1] + x[srcALen] * y[srcBLen-2] +...+ x[srcALen-1] * y[0]
|
|
|
|
|
/* sum = x[0] * y[srcBLen-1] + x[1] * y[srcBLen-2] +...+ x[srcBLen-1] * y[0]
|
|
|
|
|
* sum = x[1] * y[srcBLen-1] + x[2] * y[srcBLen-2] +...+ x[srcBLen] * y[0]
|
|
|
|
|
* ....
|
|
|
|
|
* sum = x[srcALen-srcBLen-2] * y[srcBLen-1] + x[srcALen] * y[srcBLen-2] +...+ x[srcALen-1] * y[0]
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Working pointer of inputA */
|
|
|
|
|
@ -300,16 +300,16 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
pSrc2 = pIn2 + (srcBLen - 1u);
|
|
|
|
|
py = pSrc2;
|
|
|
|
|
|
|
|
|
|
/* count is the index by which the pointer pIn1 to be incremented */
|
|
|
|
|
count = 0u;
|
|
|
|
|
/* count is the index by which the pointer pIn1 to be incremented */
|
|
|
|
|
count = 0u;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* --------------------
|
|
|
|
|
* Stage2 process
|
|
|
|
|
/* --------------------
|
|
|
|
|
* Stage2 process
|
|
|
|
|
* -------------------*/
|
|
|
|
|
|
|
|
|
|
/* Stage2 depends on srcBLen as in this stage srcBLen number of MACS are performed.
|
|
|
|
|
* So, to loop unroll over blockSize2,
|
|
|
|
|
/* Stage2 depends on srcBLen as in this stage srcBLen number of MACS are performed.
|
|
|
|
|
* So, to loop unroll over blockSize2,
|
|
|
|
|
* srcBLen should be greater than or equal to 4 */
|
|
|
|
|
if(srcBLen >= 4u)
|
|
|
|
|
{
|
|
|
|
|
@ -331,17 +331,17 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
x0 = *__SIMD32(px);
|
|
|
|
|
/* read x[1], x[2] samples */
|
|
|
|
|
x1 = _SIMD32_OFFSET(px+1);
|
|
|
|
|
px+= 2u;
|
|
|
|
|
px+= 2u;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Apply loop unrolling and compute 4 MACs simultaneously. */
|
|
|
|
|
k = srcBLen >> 2u;
|
|
|
|
|
|
|
|
|
|
/* First part of the processing with loop unrolling. Compute 4 MACs at a time.
|
|
|
|
|
/* First part of the processing with loop unrolling. Compute 4 MACs at a time.
|
|
|
|
|
** a second loop below computes MACs for the remaining 1 to 3 samples. */
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
/* Read the last two inputB samples using SIMD:
|
|
|
|
|
/* Read the last two inputB samples using SIMD:
|
|
|
|
|
* y[srcBLen - 1] and y[srcBLen - 2] */
|
|
|
|
|
c0 = *__SIMD32(py)--;
|
|
|
|
|
|
|
|
|
|
@ -377,7 +377,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
|
|
|
|
|
/* Read x[5], x[6] */
|
|
|
|
|
x1 = _SIMD32_OFFSET(px+3);
|
|
|
|
|
px += 4u;
|
|
|
|
|
px += 4u;
|
|
|
|
|
|
|
|
|
|
/* acc2 += x[4] * y[srcBLen - 3] + x[5] * y[srcBLen - 4] */
|
|
|
|
|
acc2 = __SMLALDX(x0, c0, acc2);
|
|
|
|
|
@ -387,10 +387,10 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
|
|
|
|
|
} while(--k);
|
|
|
|
|
|
|
|
|
|
/* For the next MAC operations, SIMD is not used
|
|
|
|
|
/* For the next MAC operations, SIMD is not used
|
|
|
|
|
* So, the 16 bit pointer if inputB, py is updated */
|
|
|
|
|
|
|
|
|
|
/* If the srcBLen is not a multiple of 4, compute any remaining MACs here.
|
|
|
|
|
/* If the srcBLen is not a multiple of 4, compute any remaining MACs here.
|
|
|
|
|
** No loop unrolling is used. */
|
|
|
|
|
k = srcBLen % 0x4u;
|
|
|
|
|
|
|
|
|
|
@ -411,7 +411,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
|
|
|
|
|
/* Read x[7] */
|
|
|
|
|
x3 = *__SIMD32(px);
|
|
|
|
|
px++;
|
|
|
|
|
px++;
|
|
|
|
|
|
|
|
|
|
/* Perform the multiply-accumulates */
|
|
|
|
|
acc0 = __SMLALD(x0, c0, acc0);
|
|
|
|
|
@ -430,7 +430,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
|
|
|
|
|
/* Read x[9] */
|
|
|
|
|
x2 = _SIMD32_OFFSET(px+1);
|
|
|
|
|
px += 2u;
|
|
|
|
|
px += 2u;
|
|
|
|
|
|
|
|
|
|
/* Perform the multiply-accumulates */
|
|
|
|
|
acc0 = __SMLALDX(x0, c0, acc0);
|
|
|
|
|
@ -456,7 +456,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
acc2 = __SMLALDX(x3, c0, acc2);
|
|
|
|
|
acc3 = __SMLALDX(x2, c0, acc3);
|
|
|
|
|
|
|
|
|
|
c0 = *(py-1);
|
|
|
|
|
c0 = *(py-1);
|
|
|
|
|
|
|
|
|
|
#ifdef ARM_MATH_BIG_ENDIAN
|
|
|
|
|
|
|
|
|
|
@ -468,7 +468,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
|
|
|
|
|
/* Read x[10] */
|
|
|
|
|
x3 = _SIMD32_OFFSET(px+2);
|
|
|
|
|
px += 3u;
|
|
|
|
|
px += 3u;
|
|
|
|
|
|
|
|
|
|
/* Perform the multiply-accumulates */
|
|
|
|
|
acc0 = __SMLALDX(x1, c0, acc0);
|
|
|
|
|
@ -507,10 +507,10 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
blkCnt--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the blockSize2 is not a multiple of 4, compute any remaining output samples here.
|
|
|
|
|
/* If the blockSize2 is not a multiple of 4, compute any remaining output samples here.
|
|
|
|
|
** No loop unrolling is used. */
|
|
|
|
|
blkCnt = (uint32_t) blockSize2 % 0x4u;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(blkCnt > 0u)
|
|
|
|
|
{
|
|
|
|
|
/* Accumulator is made zero for every iteration */
|
|
|
|
|
@ -519,7 +519,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
/* Apply loop unrolling and compute 4 MACs simultaneously. */
|
|
|
|
|
k = srcBLen >> 2u;
|
|
|
|
|
|
|
|
|
|
/* First part of the processing with loop unrolling. Compute 4 MACs at a time.
|
|
|
|
|
/* First part of the processing with loop unrolling. Compute 4 MACs at a time.
|
|
|
|
|
** a second loop below computes MACs for the remaining 1 to 3 samples. */
|
|
|
|
|
while(k > 0u)
|
|
|
|
|
{
|
|
|
|
|
@ -533,7 +533,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
k--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the srcBLen is not a multiple of 4, compute any remaining MACs here.
|
|
|
|
|
/* If the srcBLen is not a multiple of 4, compute any remaining MACs here.
|
|
|
|
|
** No loop unrolling is used. */
|
|
|
|
|
k = srcBLen % 0x4u;
|
|
|
|
|
|
|
|
|
|
@ -562,7 +562,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* If the srcBLen is not a multiple of 4,
|
|
|
|
|
/* If the srcBLen is not a multiple of 4,
|
|
|
|
|
* the blockSize2 loop cannot be unrolled by 4 */
|
|
|
|
|
blkCnt = (uint32_t) blockSize2;
|
|
|
|
|
|
|
|
|
|
@ -592,25 +592,25 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
/* Update the inputA and inputB pointers for next MAC calculation */
|
|
|
|
|
px = pIn1 + count;
|
|
|
|
|
py = pSrc2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Decrement the loop counter */
|
|
|
|
|
blkCnt--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* --------------------------
|
|
|
|
|
* Initializations of stage3
|
|
|
|
|
/* --------------------------
|
|
|
|
|
* Initializations of stage3
|
|
|
|
|
* -------------------------*/
|
|
|
|
|
|
|
|
|
|
/* sum += x[srcALen-srcBLen+1] * y[srcBLen-1] + x[srcALen-srcBLen+2] * y[srcBLen-2] +...+ x[srcALen-1] * y[1]
|
|
|
|
|
* sum += x[srcALen-srcBLen+2] * y[srcBLen-1] + x[srcALen-srcBLen+3] * y[srcBLen-2] +...+ x[srcALen-1] * y[2]
|
|
|
|
|
* ....
|
|
|
|
|
* sum += x[srcALen-2] * y[srcBLen-1] + x[srcALen-1] * y[srcBLen-2]
|
|
|
|
|
* sum += x[srcALen-1] * y[srcBLen-1]
|
|
|
|
|
/* sum += x[srcALen-srcBLen+1] * y[srcBLen-1] + x[srcALen-srcBLen+2] * y[srcBLen-2] +...+ x[srcALen-1] * y[1]
|
|
|
|
|
* sum += x[srcALen-srcBLen+2] * y[srcBLen-1] + x[srcALen-srcBLen+3] * y[srcBLen-2] +...+ x[srcALen-1] * y[2]
|
|
|
|
|
* ....
|
|
|
|
|
* sum += x[srcALen-2] * y[srcBLen-1] + x[srcALen-1] * y[srcBLen-2]
|
|
|
|
|
* sum += x[srcALen-1] * y[srcBLen-1]
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* In this stage the MAC operations are decreased by 1 for every iteration.
|
|
|
|
|
/* In this stage the MAC operations are decreased by 1 for every iteration.
|
|
|
|
|
The count variable holds the number of MAC operations performed */
|
|
|
|
|
count = srcBLen - 1u;
|
|
|
|
|
|
|
|
|
|
@ -623,8 +623,8 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
pIn2 = pSrc2 - 1u;
|
|
|
|
|
py = pIn2;
|
|
|
|
|
|
|
|
|
|
/* -------------------
|
|
|
|
|
* Stage3 process
|
|
|
|
|
/* -------------------
|
|
|
|
|
* Stage3 process
|
|
|
|
|
* ------------------*/
|
|
|
|
|
|
|
|
|
|
/* For loop unrolling by 4, this stage is divided into two. */
|
|
|
|
|
@ -642,14 +642,14 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
/* Apply loop unrolling and compute 4 MACs simultaneously. */
|
|
|
|
|
k = count >> 2u;
|
|
|
|
|
|
|
|
|
|
/* First part of the processing with loop unrolling. Compute 4 MACs at a time.
|
|
|
|
|
/* First part of the processing with loop unrolling. Compute 4 MACs at a time.
|
|
|
|
|
** a second loop below computes MACs for the remaining 1 to 3 samples. */
|
|
|
|
|
while(k > 0u)
|
|
|
|
|
{
|
|
|
|
|
/* x[srcALen - srcBLen + 1], x[srcALen - srcBLen + 2] are multiplied
|
|
|
|
|
/* x[srcALen - srcBLen + 1], x[srcALen - srcBLen + 2] are multiplied
|
|
|
|
|
* with y[srcBLen - 1], y[srcBLen - 2] respectively */
|
|
|
|
|
sum = __SMLALDX(*__SIMD32(px)++, *__SIMD32(py)--, sum);
|
|
|
|
|
/* x[srcALen - srcBLen + 3], x[srcALen - srcBLen + 4] are multiplied
|
|
|
|
|
/* x[srcALen - srcBLen + 3], x[srcALen - srcBLen + 4] are multiplied
|
|
|
|
|
* with y[srcBLen - 3], y[srcBLen - 4] respectively */
|
|
|
|
|
sum = __SMLALDX(*__SIMD32(px)++, *__SIMD32(py)--, sum);
|
|
|
|
|
|
|
|
|
|
@ -657,11 +657,11 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
k--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* For the next MAC operations, the pointer py is used without SIMD
|
|
|
|
|
/* For the next MAC operations, the pointer py is used without SIMD
|
|
|
|
|
* So, py is incremented by 1 */
|
|
|
|
|
py = py + 1u;
|
|
|
|
|
|
|
|
|
|
/* If the count is not a multiple of 4, compute any remaining MACs here.
|
|
|
|
|
/* If the count is not a multiple of 4, compute any remaining MACs here.
|
|
|
|
|
** No loop unrolling is used. */
|
|
|
|
|
k = count % 0x4u;
|
|
|
|
|
|
|
|
|
|
@ -691,7 +691,7 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The second part of the stage starts here */
|
|
|
|
|
/* SIMD is not used for the next MAC operations,
|
|
|
|
|
/* SIMD is not used for the next MAC operations,
|
|
|
|
|
* so pointer py is updated to read only one sample at a time */
|
|
|
|
|
py = py + 1u;
|
|
|
|
|
|
|
|
|
|
@ -777,10 +777,10 @@ arm_status arm_conv_partial_q15(
|
|
|
|
|
}
|
|
|
|
|
return (status);
|
|
|
|
|
|
|
|
|
|
#endif /* #if (defined(ARM_MATH_CM4) || defined(ARM_MATH_CM3)) && !defined(UNALIGNED_SUPPORT_DISABLE) */
|
|
|
|
|
#endif /* #if (defined(ARM_MATH_CM7) || defined(ARM_MATH_CM4) || defined(ARM_MATH_CM3)) && !defined(UNALIGNED_SUPPORT_DISABLE) */
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @} end of PartialConv group
|
|
|
|
|
/**
|
|
|
|
|
* @} end of PartialConv group
|
|
|
|
|
*/
|
|
|
|
|
|