00001 /* ---------------------------------------------------------------------- 00002 * Copyright (C) 2011 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 15. December 2011 00005 * $Revision: V2.0.0 00006 * 00007 * Project: Cortex-R DSP Library 00008 * Title: arm_negate_q31.c 00009 * 00010 * Description: Negates Q31 vectors. 00011 * 00012 * Target Processor: Cortex-R4/R5 00013 * 00014 * Version 1.0.0 2011/03/08 00015 * Alpha release. 00016 * 00017 * Version 1.0.1 2011/09/30 00018 * Beta release. 00019 * 00020 * Version 2.0.0 2011/12/15 00021 * Final release. 00022 * 00023 * -------------------------------------------------------------------- */ 00024 #include "arm_math.h" 00025 00048 void arm_negate_q31( 00049 q31_t * pSrc, 00050 q31_t * pDst, 00051 uint32_t blockSize) 00052 { 00053 q31_t in1, in2, in3, in4; /* Temporary variables */ 00054 uint32_t blkCnt; /* loop counter */ 00055 00056 00057 /*loop Unrolling */ 00058 blkCnt = blockSize >> 3u; 00059 00060 /* First part of the processing with loop unrolling. Compute 8 outputs at a time. 00061 ** a second loop below computes the remaining 1 to 7 samples. */ 00062 while(blkCnt > 0u) 00063 { 00064 /* C = -A */ 00065 /* Negate and then store the results in the destination buffer. */ 00066 /* read samples from source */ 00067 in1 = *pSrc; 00068 in2 = *(pSrc + 1); 00069 00070 /* negate input */ 00071 in1 = __QSUB(0, in1); 00072 00073 /* read samples from source */ 00074 in3 = *(pSrc + 2); 00075 00076 /* negate input */ 00077 in2 = __QSUB(0, in2); 00078 00079 /* read samples from source */ 00080 in4 = *(pSrc + 3); 00081 00082 /* negate input */ 00083 in3 = __QSUB(0, in3); 00084 00085 /* store result to destination */ 00086 *pDst = in1; 00087 00088 /* negate input */ 00089 in4 = __QSUB(0, in4); 00090 00091 /* store result to destination */ 00092 *(pDst + 1) = in2; 00093 *(pDst + 2) = in3; 00094 *(pDst + 3) = in4; 00095 00096 /* read samples from source */ 00097 in1 = *(pSrc + 4); 00098 in2 = *(pSrc + 5); 00099 00100 /* negate input */ 00101 in1 = __QSUB(0, in1); 00102 00103 /* read samples from source */ 00104 in3 = *(pSrc + 6); 00105 00106 /* negate input */ 00107 in2 = __QSUB(0, in2); 00108 00109 /* read samples from source */ 00110 in4 = *(pSrc + 7); 00111 00112 /* negate input */ 00113 in3 = __QSUB(0, in3); 00114 00115 /* store result to destination */ 00116 *(pDst + 4) = in1; 00117 00118 /* negate input */ 00119 in4 = __QSUB(0, in4); 00120 00121 /* store result to destination */ 00122 *(pDst + 5) = in2; 00123 00124 /* increment source by 8 to process next samples */ 00125 pSrc += 8u; 00126 00127 /* store result to destination */ 00128 *(pDst + 6) = in3; 00129 *(pDst + 7) = in4; 00130 00131 /* increment destination by 8 */ 00132 pDst += 8u; 00133 00134 /* Decrement the loop counter */ 00135 blkCnt--; 00136 } 00137 00138 /* If the blockSize is not a multiple of 8, compute any remaining output samples here. 00139 ** No loop unrolling is used. */ 00140 blkCnt = blockSize % 0x8u; 00141 00142 while(blkCnt > 0u) 00143 { 00144 /* C = -A */ 00145 /* Negate and then store the result in the destination buffer. */ 00146 in1 = *pSrc++; 00147 *pDst++ = __QSUB(0, in1); 00148 00149 /* Decrement the loop counter */ 00150 blkCnt--; 00151 } 00152 } 00153