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_q7.c 00009 * 00010 * Description: Negates Q7 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 00052 void arm_negate_q7( 00053 q7_t * pSrc, 00054 q7_t * pDst, 00055 uint32_t blockSize) 00056 { 00057 uint32_t blkCnt; /* loop counter */ 00058 q7_t in; /* Input value1 */ 00059 q31_t in1, in2, in3, in4; 00060 00061 /*loop Unrolling */ 00062 blkCnt = blockSize >> 4u; 00063 00064 /* First part of the processing with loop unrolling. Compute 16 outputs at a time. 00065 ** a second loop below computes the remaining 1 to 15 samples. */ 00066 while(blkCnt > 0u) 00067 { 00068 /* C = -A */ 00069 /* Read four inputs at a time */ 00070 in1 = _SIMD32_OFFSET(pSrc); 00071 in2 = _SIMD32_OFFSET(pSrc + 4); 00072 00073 /* negate four samples at a time */ 00074 in1 = __QSUB8(0, in1); 00075 00076 /* Read four inputs at a time */ 00077 in3 = _SIMD32_OFFSET(pSrc + 8); 00078 00079 /* negate four samples at a time */ 00080 in2 = __QSUB8(0, in2); 00081 00082 /* Read four inputs at a time */ 00083 in4 = _SIMD32_OFFSET(pSrc + 12); 00084 00085 /* store the result to destination four samples at a time */ 00086 _SIMD32_OFFSET(pDst) = in1; 00087 00088 /* negate four samples at a time */ 00089 in3 = __QSUB8(0, in3); 00090 00091 /* store the result to destination four samples at a time */ 00092 _SIMD32_OFFSET(pDst + 4) = in2; 00093 00094 /* negate four samples at a time */ 00095 in4 = __QSUB8(0, in4); 00096 00097 /* store the result to destination four samples at a time */ 00098 _SIMD32_OFFSET(pDst + 8) = in3; 00099 00100 /* increment source pointer by 16 to process next samples */ 00101 pSrc += 16u; 00102 00103 /* store the result to destination 4 samples at a time */ 00104 _SIMD32_OFFSET(pDst + 12) = in4; 00105 00106 /* increment destination pointer by 16 */ 00107 pDst += 16u; 00108 00109 /* Decrement the loop counter */ 00110 blkCnt--; 00111 } 00112 00113 /* If the blockSize is not a multiple of 16, compute any remaining output samples here. 00114 ** No loop unrolling is used. */ 00115 blkCnt = blockSize % 0x10u; 00116 00117 while(blkCnt > 0u) 00118 { 00119 /* C = -A */ 00120 in = *pSrc++; 00121 00122 *pDst++ = __QSUB8(0, in); 00123 00124 /* Decrement the loop counter */ 00125 blkCnt--; 00126 } 00127 } 00128