Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
arm_cmplx_conj_q15.c
00001 /* ---------------------------------------------------------------------- 00002 * Project: CMSIS DSP Library 00003 * Title: arm_cmplx_conj_q15.c 00004 * Description: Q15 complex conjugate 00005 * 00006 * $Date: 27. January 2017 00007 * $Revision: V.1.5.1 00008 * 00009 * Target Processor: Cortex-M cores 00010 * -------------------------------------------------------------------- */ 00011 /* 00012 * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. 00013 * 00014 * SPDX-License-Identifier: Apache-2.0 00015 * 00016 * Licensed under the Apache License, Version 2.0 (the License); you may 00017 * not use this file except in compliance with the License. 00018 * You may obtain a copy of the License at 00019 * 00020 * www.apache.org/licenses/LICENSE-2.0 00021 * 00022 * Unless required by applicable law or agreed to in writing, software 00023 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00024 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00025 * See the License for the specific language governing permissions and 00026 * limitations under the License. 00027 */ 00028 00029 #include "arm_math.h" 00030 00031 /** 00032 * @ingroup groupCmplxMath 00033 */ 00034 00035 /** 00036 * @addtogroup cmplx_conj 00037 * @{ 00038 */ 00039 00040 /** 00041 * @brief Q15 complex conjugate. 00042 * @param *pSrc points to the input vector 00043 * @param *pDst points to the output vector 00044 * @param numSamples number of complex samples in each vector 00045 * @return none. 00046 * 00047 * <b>Scaling and Overflow Behavior:</b> 00048 * \par 00049 * The function uses saturating arithmetic. 00050 * The Q15 value -1 (0x8000) will be saturated to the maximum allowable positive value 0x7FFF. 00051 */ 00052 00053 void arm_cmplx_conj_q15( 00054 q15_t * pSrc, 00055 q15_t * pDst, 00056 uint32_t numSamples) 00057 { 00058 00059 #if defined (ARM_MATH_DSP) 00060 00061 /* Run the below code for Cortex-M4 and Cortex-M3 */ 00062 uint32_t blkCnt; /* loop counter */ 00063 q31_t in1, in2, in3, in4; 00064 q31_t zero = 0; 00065 00066 /*loop Unrolling */ 00067 blkCnt = numSamples >> 2U; 00068 00069 /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 00070 ** a second loop below computes the remaining 1 to 3 samples. */ 00071 while (blkCnt > 0U) 00072 { 00073 /* C[0]+jC[1] = A[0]+ j (-1) A[1] */ 00074 /* Calculate Complex Conjugate and then store the results in the destination buffer. */ 00075 in1 = *__SIMD32(pSrc)++; 00076 in2 = *__SIMD32(pSrc)++; 00077 in3 = *__SIMD32(pSrc)++; 00078 in4 = *__SIMD32(pSrc)++; 00079 00080 #ifndef ARM_MATH_BIG_ENDIAN 00081 00082 in1 = __QASX(zero, in1); 00083 in2 = __QASX(zero, in2); 00084 in3 = __QASX(zero, in3); 00085 in4 = __QASX(zero, in4); 00086 00087 #else 00088 00089 in1 = __QSAX(zero, in1); 00090 in2 = __QSAX(zero, in2); 00091 in3 = __QSAX(zero, in3); 00092 in4 = __QSAX(zero, in4); 00093 00094 #endif /* #ifndef ARM_MATH_BIG_ENDIAN */ 00095 00096 in1 = ((uint32_t) in1 >> 16) | ((uint32_t) in1 << 16); 00097 in2 = ((uint32_t) in2 >> 16) | ((uint32_t) in2 << 16); 00098 in3 = ((uint32_t) in3 >> 16) | ((uint32_t) in3 << 16); 00099 in4 = ((uint32_t) in4 >> 16) | ((uint32_t) in4 << 16); 00100 00101 *__SIMD32(pDst)++ = in1; 00102 *__SIMD32(pDst)++ = in2; 00103 *__SIMD32(pDst)++ = in3; 00104 *__SIMD32(pDst)++ = in4; 00105 00106 /* Decrement the loop counter */ 00107 blkCnt--; 00108 } 00109 00110 /* If the numSamples is not a multiple of 4, compute any remaining output samples here. 00111 ** No loop unrolling is used. */ 00112 blkCnt = numSamples % 0x4U; 00113 00114 while (blkCnt > 0U) 00115 { 00116 /* C[0]+jC[1] = A[0]+ j (-1) A[1] */ 00117 /* Calculate Complex Conjugate and then store the results in the destination buffer. */ 00118 *pDst++ = *pSrc++; 00119 *pDst++ = __SSAT(-*pSrc++, 16); 00120 00121 /* Decrement the loop counter */ 00122 blkCnt--; 00123 } 00124 00125 #else 00126 00127 q15_t in; 00128 00129 /* Run the below code for Cortex-M0 */ 00130 00131 while (numSamples > 0U) 00132 { 00133 /* realOut + j (imagOut) = realIn+ j (-1) imagIn */ 00134 /* Calculate Complex Conjugate and then store the results in the destination buffer. */ 00135 *pDst++ = *pSrc++; 00136 in = *pSrc++; 00137 *pDst++ = (in == (q15_t) 0x8000) ? 0x7fff : -in; 00138 00139 /* Decrement the loop counter */ 00140 numSamples--; 00141 } 00142 00143 #endif /* #if defined (ARM_MATH_DSP) */ 00144 00145 } 00146 00147 /** 00148 * @} end of cmplx_conj group 00149 */ 00150
Generated on Tue Jul 12 2022 16:46:23 by
1.7.2