CMSIS DSP Software Library: arm_cmplx_mag_q31.c Source File
Main Page
Modules
Data Structures
Files
Examples
File List
Globals
arm_cmplx_mag_q31.c
Go to the documentation of this file.00001 /* ----------------------------------------------------------------------
00002 * Copyright (C) 2010 ARM Limited. All rights reserved.
00003 *
00004 * $Date: 29. November 2010
00005 * $Revision: V1.0.3
00006 *
00007 * Project: CMSIS DSP Library
00008 * Title: arm_cmplx_mag_q31.c
00009 *
00010 * Description: Q31 complex magnitude
00011 *
00012 * Target Processor: Cortex-M4/Cortex-M3
00013 *
00014 * Version 1.0.3 2010/11/29
00015 * Re-organized the CMSIS folders and updated documentation.
00016 *
00017 * Version 1.0.2 2010/11/11
00018 * Documentation updated.
00019 *
00020 * Version 1.0.1 2010/10/05
00021 * Production release and review comments incorporated.
00022 *
00023 * Version 1.0.0 2010/09/20
00024 * Production release and review comments incorporated.
00025 * ---------------------------------------------------------------------------- */
00026
00027 #include "arm_math.h"
00028
00051 void arm_cmplx_mag_q31(
00052 q31_t * pSrc,
00053 q31_t * pDst,
00054 uint32_t numSamples)
00055 {
00056 q31_t real, imag; /* Temporary variables to hold input values */
00057 q31_t acc0, acc1; /* Accumulators */
00058 uint32_t blkCnt; /* loop counter */
00059
00060
00061 /*loop Unrolling */
00062 blkCnt = numSamples >> 2u;
00063
00064 /* First part of the processing with loop unrolling. Compute 4 outputs at a time.
00065 ** a second loop below computes the remaining 1 to 3 samples. */
00066 while(blkCnt > 0u)
00067 {
00068
00069 /* C[0] = sqrt(A[0] * A[0] + A[1] * A[1]) */
00070 real = *pSrc++;
00071 imag = *pSrc++;
00072 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00073 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00074 /* store the result in 2.30 format in the destination buffer. */
00075 arm_sqrt_q31(acc0 + acc1, pDst++);
00076
00077 real = *pSrc++;
00078 imag = *pSrc++;
00079 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00080 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00081 /* store the result in 2.30 format in the destination buffer. */
00082 arm_sqrt_q31(acc0 + acc1, pDst++);
00083
00084 real = *pSrc++;
00085 imag = *pSrc++;
00086 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00087 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00088 /* store the result in 2.30 format in the destination buffer. */
00089 arm_sqrt_q31(acc0 + acc1, pDst++);
00090
00091 real = *pSrc++;
00092 imag = *pSrc++;
00093 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00094 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00095 /* store the result in 2.30 format in the destination buffer. */
00096 arm_sqrt_q31(acc0 + acc1, pDst++);
00097
00098 /* Decrement the loop counter */
00099 blkCnt--;
00100 }
00101
00102 /* If the numSamples is not a multiple of 4, compute any remaining output samples here.
00103 ** No loop unrolling is used. */
00104 blkCnt = numSamples % 0x4u;
00105
00106 while(blkCnt > 0u)
00107 {
00108 /* C[0] = sqrt(A[0] * A[0] + A[1] * A[1]) */
00109 real = *pSrc++;
00110 imag = *pSrc++;
00111 acc0 = (q31_t) (((q63_t) real * real) >> 33);
00112 acc1 = (q31_t) (((q63_t) imag * imag) >> 33);
00113 /* store the result in 2.30 format in the destination buffer. */
00114 arm_sqrt_q31(acc0 + acc1, pDst++);
00115
00116 /* Decrement the loop counter */
00117 blkCnt--;
00118 }
00119 }
00120
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Mon Nov 29 2010 17:19:56 for CMSIS DSP Software Library by
1.7.2
Wyszukiwarka
Podobne podstrony:
arm cmplx mag ?2? sourcearm cmplx mag q31?arm cmplx conj q31? sourcearm cmplx mag q15? sourcearm cmplx mag squared q31? sourcearm cmplx mag squared q15? sourcearm cmplx mag squared ?2? sourcearm cmplx mag squared q31?arm dot prod q31? sourcearm sin cos q31? sourcearm pid init q31? sourcearm conv partial q31? sourcearm mat ?d q31? sourcearm fir interpolate q31? sourcearm ?ft radix4 q31? sourcearm cmplx conj q15? sourcearm fir ?cimate q31? sourcearm mat mult q31? sourcearm ?t4 init q31? sourcewięcej podobnych podstron