arm cmplx dot prod f32 8c source


CMSIS DSP Software Library: arm_cmplx_dot_prod_f32.c Source File Main Page Modules Data Structures Files Examples File List Globals arm_cmplx_dot_prod_f32.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_dot_prod_f32.c 00009 * 00010 * Description: Floating-point complex dot product 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 00074 void arm_cmplx_dot_prod_f32( 00075 float32_t * pSrcA, 00076 float32_t * pSrcB, 00077 uint32_t numSamples, 00078 float32_t * realResult, 00079 float32_t * imagResult) 00080 { 00081 float32_t real_sum = 0.0f, imag_sum = 0.0f; /* Temporary result storage */ 00082 uint32_t blkCnt; /* loop counter */ 00083 00084 /*loop Unrolling */ 00085 blkCnt = numSamples >> 2u; 00086 00087 /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 00088 ** a second loop below computes the remaining 1 to 3 samples. */ 00089 while(blkCnt > 0u) 00090 { 00091 /* CReal = A[0]* B[0] + A[2]* B[2] + A[4]* B[4] + .....+ A[numSamples-2]* B[numSamples-2] */ 00092 real_sum += (*pSrcA++) * (*pSrcB++); 00093 /* CImag = A[1]* B[1] + A[3]* B[3] + A[5]* B[5] + .....+ A[numSamples-1]* B[numSamples-1] */ 00094 imag_sum += (*pSrcA++) * (*pSrcB++); 00095 00096 real_sum += (*pSrcA++) * (*pSrcB++); 00097 imag_sum += (*pSrcA++) * (*pSrcB++); 00098 00099 real_sum += (*pSrcA++) * (*pSrcB++); 00100 imag_sum += (*pSrcA++) * (*pSrcB++); 00101 00102 real_sum += (*pSrcA++) * (*pSrcB++); 00103 imag_sum += (*pSrcA++) * (*pSrcB++); 00104 00105 /* Decrement the loop counter */ 00106 blkCnt--; 00107 } 00108 00109 /* If the numSamples is not a multiple of 4, compute any remaining output samples here. 00110 ** No loop unrolling is used. */ 00111 blkCnt = numSamples % 0x4u; 00112 00113 while(blkCnt > 0u) 00114 { 00115 /* CReal = A[0]* B[0] + A[2]* B[2] + A[4]* B[4] + .....+ A[numSamples-2]* B[numSamples-2] */ 00116 real_sum += (*pSrcA++) * (*pSrcB++); 00117 /* CImag = A[1]* B[1] + A[3]* B[3] + A[5]* B[5] + .....+ A[numSamples-1]* B[numSamples-1] */ 00118 imag_sum += (*pSrcA++) * (*pSrcB++); 00119 00120 00121 /* Decrement the loop counter */ 00122 blkCnt--; 00123 } 00124 00125 /* Store the real and imaginary results in the destination buffers */ 00126 *realResult = real_sum; 00127 *imagResult = imag_sum; 00128 } 00129  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