- Main Page
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

# arm_cmplx_dot_prod_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_dot_prod_q31.c
    00009 *
    00010 * Description:  Q31 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
    00057 void arm_cmplx_dot_prod_q31(
    00058   q31_t * pSrcA,
    00059   q31_t * pSrcB,
    00060   uint32_t numSamples,
    00061   q63_t * realResult,
    00062   q63_t * imagResult)
    00063 {
    00064   q63_t real_sum = 0, imag_sum = 0;              /* Temporary result storage */
    00065   uint32_t blkCnt;                               /* loop counter */
    00066
    00067
    00068   /*loop Unrolling */
    00069   blkCnt = numSamples >> 2u;
    00070
    00071   /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.
    00072    ** a second loop below computes the remaining 1 to 3 samples. */
    00073   while(blkCnt > 0u)
    00074   {
    00075     /* CReal = A[0]* B[0] + A[2]* B[2] + A[4]* B[4] + .....+ A[numSamples-2]* B[numSamples-2] */
    00076     /* Convert real data in 2.62 to 16.48 by 14 right shifts */
    00077     real_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00078     /* CImag = A[1]* B[1] + A[3]* B[3] + A[5]* B[5] + .....+ A[numSamples-1]* B[numSamples-1] */
    00079     /* Convert imag data in 2.62 to 16.48 by 14 right shifts */
    00080     imag_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00081
    00082     real_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00083     imag_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00084
    00085     real_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00086     imag_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00087
    00088     real_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00089     imag_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00090
    00091
    00092     /* Decrement the loop counter */
    00093     blkCnt--;
    00094   }
    00095
    00096   /* If the numSamples  is not a multiple of 4, compute any remaining output samples here.
    00097    ** No loop unrolling is used. */
    00098   blkCnt = numSamples % 0x4u;
    00099
    00100   while(blkCnt > 0u)
    00101   {
    00102     /* CReal = A[0]* B[0] + A[2]* B[2] + A[4]* B[4] + .....+ A[numSamples-2]* B[numSamples-2] */
    00103     real_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00104     /* CImag = A[1]* B[1] + A[3]* B[3] + A[5]* B[5] + .....+ A[numSamples-1]* B[numSamples-1] */
    00105     imag_sum += (q63_t) * pSrcA++ * (*pSrcB++) >> 14;
    00106
    00107     /* Decrement the loop counter */
    00108     blkCnt--;
    00109   }
    00110
    00111   /* Store the real and imaginary results in 16.48 format  */
    00112   *realResult = real_sum;
    00113   *imagResult = imag_sum;
    00114 }
    00115

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines