CMSISDSP
Version 1.5.2
CMSIS DSP Software Library

Functions  
void  arm_correlate_f32 (float32_t *pSrcA, uint32_t srcALen, float32_t *pSrcB, uint32_t srcBLen, float32_t *pDst) 
Correlation of floatingpoint sequences. More...  
void  arm_correlate_fast_opt_q15 (q15_t *pSrcA, uint32_t srcALen, q15_t *pSrcB, uint32_t srcBLen, q15_t *pDst, q15_t *pScratch) 
Correlation of Q15 sequences (fast version) for CortexM3 and CortexM4. More...  
void  arm_correlate_fast_q15 (q15_t *pSrcA, uint32_t srcALen, q15_t *pSrcB, uint32_t srcBLen, q15_t *pDst) 
Correlation of Q15 sequences (fast version) for CortexM3 and CortexM4. More...  
void  arm_correlate_fast_q31 (q31_t *pSrcA, uint32_t srcALen, q31_t *pSrcB, uint32_t srcBLen, q31_t *pDst) 
Correlation of Q31 sequences (fast version) for CortexM3 and CortexM4. More...  
void  arm_correlate_opt_q15 (q15_t *pSrcA, uint32_t srcALen, q15_t *pSrcB, uint32_t srcBLen, q15_t *pDst, q15_t *pScratch) 
Correlation of Q15 sequences. More...  
void  arm_correlate_opt_q7 (q7_t *pSrcA, uint32_t srcALen, q7_t *pSrcB, uint32_t srcBLen, q7_t *pDst, q15_t *pScratch1, q15_t *pScratch2) 
Correlation of Q7 sequences. More...  
void  arm_correlate_q15 (q15_t *pSrcA, uint32_t srcALen, q15_t *pSrcB, uint32_t srcBLen, q15_t *pDst) 
Correlation of Q15 sequences. More...  
void  arm_correlate_q31 (q31_t *pSrcA, uint32_t srcALen, q31_t *pSrcB, uint32_t srcBLen, q31_t *pDst) 
Correlation of Q31 sequences. More...  
void  arm_correlate_q7 (q7_t *pSrcA, uint32_t srcALen, q7_t *pSrcB, uint32_t srcBLen, q7_t *pDst) 
Correlation of Q7 sequences. More...  
Correlation is a mathematical operation that is similar to convolution. As with convolution, correlation uses two signals to produce a third signal. The underlying algorithms in correlation and convolution are identical except that one of the inputs is flipped in convolution. Correlation is commonly used to measure the similarity between two signals. It has applications in pattern recognition, cryptanalysis, and searching. The CMSIS library provides correlation functions for Q7, Q15, Q31 and floatingpoint data types. Fast versions of the Q15 and Q31 functions are also provided.
a[n]
and b[n]
be sequences of length srcALen
and srcBLen
samples respectively. The convolution of the two signals is denoted by c[n] = a[n] * b[n]In correlation, one of the signals is flipped in time
c[n] = a[n] * b[n]
pSrcA
points to the first input vector of length srcALen
and pSrcB
points to the second input vector of length srcBLen
. The result c[n]
is of length 2 * max(srcALen, srcBLen)  1
and is defined over the interval n=0, 1, 2, ..., (2 * max(srcALen, srcBLen)  2)
. The output result is written to pDst
and the calling function must allocate 2 * max(srcALen, srcBLen)  1
words for the result.Note
pDst
should be initialized to all zeros before being used.FixedPoint Behavior
Fast Versions
Opt Versions
void arm_correlate_f32  (  float32_t *  pSrcA, 
uint32_t  srcALen,  
float32_t *  pSrcB,  
uint32_t  srcBLen,  
float32_t *  pDst  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
void arm_correlate_fast_opt_q15  (  q15_t *  pSrcA, 
uint32_t  srcALen,  
q15_t *  pSrcB,  
uint32_t  srcBLen,  
q15_t *  pDst,  
q15_t *  pScratch  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
[in]  *pScratch  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen)  2. 
Scaling and Overflow Behavior:
arm_correlate_q15()
for a slower implementation of this function which uses a 64bit accumulator to avoid wrap around distortion. References __PKHBT, __SIMD32, __SMLAD(), __SMLADX(), _SIMD32_OFFSET, arm_copy_q15(), arm_fill_q15(), srcALen, and srcBLen.
void arm_correlate_fast_q15  (  q15_t *  pSrcA, 
uint32_t  srcALen,  
q15_t *  pSrcB,  
uint32_t  srcBLen,  
q15_t *  pDst  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
Scaling and Overflow Behavior:
arm_correlate_q15()
for a slower implementation of this function which uses a 64bit accumulator to avoid wrap around distortion. References __PKHBT, __SIMD32, __SMLAD(), __SMLADX(), _SIMD32_OFFSET, srcALen, and srcBLen.
void arm_correlate_fast_q31  (  q31_t *  pSrcA, 
uint32_t  srcALen,  
q31_t *  pSrcB,  
uint32_t  srcBLen,  
q31_t *  pDst  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
Scaling and Overflow Behavior:
arm_correlate_q31()
for a slower implementation of this function which uses 64bit accumulation to provide higher precision. void arm_correlate_opt_q15  (  q15_t *  pSrcA, 
uint32_t  srcALen,  
q15_t *  pSrcB,  
uint32_t  srcBLen,  
q15_t *  pDst,  
q15_t *  pScratch  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
[in]  *pScratch  points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen)  2. 
Scaling and Overflow Behavior:
arm_correlate_fast_q15()
for a faster but less precise version of this function for CortexM3 and CortexM4. References __PKHBT, __SIMD32, __SMLALD(), __SMLALDX(), _SIMD32_OFFSET, arm_copy_q15(), arm_fill_q15(), srcALen, and srcBLen.
void arm_correlate_opt_q7  (  q7_t *  pSrcA, 
uint32_t  srcALen,  
q7_t *  pSrcB,  
uint32_t  srcBLen,  
q7_t *  pDst,  
q15_t *  pScratch1,  
q15_t *  pScratch2  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
[in]  *pScratch1  points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen)  2. 
[in]  *pScratch2  points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). 
Scaling and Overflow Behavior:
max(srcALen, srcBLen)<131072
. The 18.14 result is then truncated to 18.7 format by discarding the low 7 bits and saturated to 1.7 format. References __PKHBT, __SIMD32, __SMLAD(), __SMLADX(), _SIMD32_OFFSET, arm_fill_q15(), srcALen, and srcBLen.
void arm_correlate_q15  (  q15_t *  pSrcA, 
uint32_t  srcALen,  
q15_t *  pSrcB,  
uint32_t  srcBLen,  
q15_t *  pDst  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
Scaling and Overflow Behavior:
arm_correlate_fast_q15()
for a faster but less precise version of this function for CortexM3 and CortexM4.arm_correlate_opt_q15()
for a faster implementation of this function using scratch buffers. References __SIMD32, __SMLALD(), __SMLALDX(), _SIMD32_OFFSET, srcALen, and srcBLen.
void arm_correlate_q31  (  q31_t *  pSrcA, 
uint32_t  srcALen,  
q31_t *  pSrcB,  
uint32_t  srcBLen,  
q31_t *  pDst  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
Scaling and Overflow Behavior:
arm_correlate_fast_q31()
for a faster but less precise implementation of this function for CortexM3 and CortexM4. void arm_correlate_q7  (  q7_t *  pSrcA, 
uint32_t  srcALen,  
q7_t *  pSrcB,  
uint32_t  srcBLen,  
q7_t *  pDst  
) 
[in]  *pSrcA  points to the first input sequence. 
[in]  srcALen  length of the first input sequence. 
[in]  *pSrcB  points to the second input sequence. 
[in]  srcBLen  length of the second input sequence. 
[out]  *pDst  points to the location where the output result is written. Length 2 * max(srcALen, srcBLen)  1. 
Scaling and Overflow Behavior:
max(srcALen, srcBLen)<131072
. The 18.14 result is then truncated to 18.7 format by discarding the low 7 bits and saturated to 1.7 format.arm_correlate_opt_q7()
for a faster implementation of this function.