Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

arm_conv_fast_q31.c 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. /* ----------------------------------------------------------------------
  2. * Copyright (C) 2010-2013 ARM Limited. All rights reserved.
  3. *
  4. * $Date: 17. January 2013
  5. * $Revision: V1.4.1
  6. *
  7. * Project: CMSIS DSP Library
  8. * Title: arm_conv_fast_q31.c
  9. *
  10. * Description: Q31 Convolution (fast version).
  11. *
  12. * Target Processor: Cortex-M4/Cortex-M3
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions
  16. * are met:
  17. * - Redistributions of source code must retain the above copyright
  18. * notice, this list of conditions and the following disclaimer.
  19. * - Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in
  21. * the documentation and/or other materials provided with the
  22. * distribution.
  23. * - Neither the name of ARM LIMITED nor the names of its contributors
  24. * may be used to endorse or promote products derived from this
  25. * software without specific prior written permission.
  26. *
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  28. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  29. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  30. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  31. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  32. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  33. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  34. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  35. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  37. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. * POSSIBILITY OF SUCH DAMAGE.
  39. * -------------------------------------------------------------------- */
  40. #include "arm_math.h"
  41. /**
  42. * @ingroup groupFilters
  43. */
  44. /**
  45. * @addtogroup Conv
  46. * @{
  47. */
  48. /**
  49. * @param[in] *pSrcA points to the first input sequence.
  50. * @param[in] srcALen length of the first input sequence.
  51. * @param[in] *pSrcB points to the second input sequence.
  52. * @param[in] srcBLen length of the second input sequence.
  53. * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
  54. * @return none.
  55. *
  56. * @details
  57. * <b>Scaling and Overflow Behavior:</b>
  58. *
  59. * \par
  60. * This function is optimized for speed at the expense of fixed-point precision and overflow protection.
  61. * The result of each 1.31 x 1.31 multiplication is truncated to 2.30 format.
  62. * These intermediate results are accumulated in a 32-bit register in 2.30 format.
  63. * Finally, the accumulator is saturated and converted to a 1.31 result.
  64. *
  65. * \par
  66. * The fast version has the same overflow behavior as the standard version but provides less precision since it discards the low 32 bits of each multiplication result.
  67. * In order to avoid overflows completely the input signals must be scaled down.
  68. * Scale down the inputs by log2(min(srcALen, srcBLen)) (log2 is read as log to the base 2) times to avoid overflows,
  69. * as maximum of min(srcALen, srcBLen) number of additions are carried internally.
  70. *
  71. * \par
  72. * See <code>arm_conv_q31()</code> for a slower implementation of this function which uses 64-bit accumulation to provide higher precision.
  73. */
  74. void arm_conv_fast_q31(
  75. q31_t * pSrcA,
  76. uint32_t srcALen,
  77. q31_t * pSrcB,
  78. uint32_t srcBLen,
  79. q31_t * pDst)
  80. {
  81. q31_t *pIn1; /* inputA pointer */
  82. q31_t *pIn2; /* inputB pointer */
  83. q31_t *pOut = pDst; /* output pointer */
  84. q31_t *px; /* Intermediate inputA pointer */
  85. q31_t *py; /* Intermediate inputB pointer */
  86. q31_t *pSrc1, *pSrc2; /* Intermediate pointers */
  87. q31_t sum, acc0, acc1, acc2, acc3; /* Accumulator */
  88. q31_t x0, x1, x2, x3, c0; /* Temporary variables to hold state and coefficient values */
  89. uint32_t j, k, count, blkCnt, blockSize1, blockSize2, blockSize3; /* loop counter */
  90. /* The algorithm implementation is based on the lengths of the inputs. */
  91. /* srcB is always made to slide across srcA. */
  92. /* So srcBLen is always considered as shorter or equal to srcALen */
  93. if(srcALen >= srcBLen)
  94. {
  95. /* Initialization of inputA pointer */
  96. pIn1 = pSrcA;
  97. /* Initialization of inputB pointer */
  98. pIn2 = pSrcB;
  99. }
  100. else
  101. {
  102. /* Initialization of inputA pointer */
  103. pIn1 = pSrcB;
  104. /* Initialization of inputB pointer */
  105. pIn2 = pSrcA;
  106. /* srcBLen is always considered as shorter or equal to srcALen */
  107. j = srcBLen;
  108. srcBLen = srcALen;
  109. srcALen = j;
  110. }
  111. /* conv(x,y) at n = x[n] * y[0] + x[n-1] * y[1] + x[n-2] * y[2] + ...+ x[n-N+1] * y[N -1] */
  112. /* The function is internally
  113. * divided into three stages according to the number of multiplications that has to be
  114. * taken place between inputA samples and inputB samples. In the first stage of the
  115. * algorithm, the multiplications increase by one for every iteration.
  116. * In the second stage of the algorithm, srcBLen number of multiplications are done.
  117. * In the third stage of the algorithm, the multiplications decrease by one
  118. * for every iteration. */
  119. /* The algorithm is implemented in three stages.
  120. The loop counters of each stage is initiated here. */
  121. blockSize1 = srcBLen - 1u;
  122. blockSize2 = srcALen - (srcBLen - 1u);
  123. blockSize3 = blockSize1;
  124. /* --------------------------
  125. * Initializations of stage1
  126. * -------------------------*/
  127. /* sum = x[0] * y[0]
  128. * sum = x[0] * y[1] + x[1] * y[0]
  129. * ....
  130. * sum = x[0] * y[srcBlen - 1] + x[1] * y[srcBlen - 2] +...+ x[srcBLen - 1] * y[0]
  131. */
  132. /* In this stage the MAC operations are increased by 1 for every iteration.
  133. The count variable holds the number of MAC operations performed */
  134. count = 1u;
  135. /* Working pointer of inputA */
  136. px = pIn1;
  137. /* Working pointer of inputB */
  138. py = pIn2;
  139. /* ------------------------
  140. * Stage1 process
  141. * ----------------------*/
  142. /* The first stage starts here */
  143. while(blockSize1 > 0u)
  144. {
  145. /* Accumulator is made zero for every iteration */
  146. sum = 0;
  147. /* Apply loop unrolling and compute 4 MACs simultaneously. */
  148. k = count >> 2u;
  149. /* First part of the processing with loop unrolling. Compute 4 MACs at a time.
  150. ** a second loop below computes MACs for the remaining 1 to 3 samples. */
  151. while(k > 0u)
  152. {
  153. /* x[0] * y[srcBLen - 1] */
  154. sum = (q31_t) ((((q63_t) sum << 32) +
  155. ((q63_t) * px++ * (*py--))) >> 32);
  156. /* x[1] * y[srcBLen - 2] */
  157. sum = (q31_t) ((((q63_t) sum << 32) +
  158. ((q63_t) * px++ * (*py--))) >> 32);
  159. /* x[2] * y[srcBLen - 3] */
  160. sum = (q31_t) ((((q63_t) sum << 32) +
  161. ((q63_t) * px++ * (*py--))) >> 32);
  162. /* x[3] * y[srcBLen - 4] */
  163. sum = (q31_t) ((((q63_t) sum << 32) +
  164. ((q63_t) * px++ * (*py--))) >> 32);
  165. /* Decrement the loop counter */
  166. k--;
  167. }
  168. /* If the count is not a multiple of 4, compute any remaining MACs here.
  169. ** No loop unrolling is used. */
  170. k = count % 0x4u;
  171. while(k > 0u)
  172. {
  173. /* Perform the multiply-accumulate */
  174. sum = (q31_t) ((((q63_t) sum << 32) +
  175. ((q63_t) * px++ * (*py--))) >> 32);
  176. /* Decrement the loop counter */
  177. k--;
  178. }
  179. /* Store the result in the accumulator in the destination buffer. */
  180. *pOut++ = sum << 1;
  181. /* Update the inputA and inputB pointers for next MAC calculation */
  182. py = pIn2 + count;
  183. px = pIn1;
  184. /* Increment the MAC count */
  185. count++;
  186. /* Decrement the loop counter */
  187. blockSize1--;
  188. }
  189. /* --------------------------
  190. * Initializations of stage2
  191. * ------------------------*/
  192. /* sum = x[0] * y[srcBLen-1] + x[1] * y[srcBLen-2] +...+ x[srcBLen-1] * y[0]
  193. * sum = x[1] * y[srcBLen-1] + x[2] * y[srcBLen-2] +...+ x[srcBLen] * y[0]
  194. * ....
  195. * sum = x[srcALen-srcBLen-2] * y[srcBLen-1] + x[srcALen] * y[srcBLen-2] +...+ x[srcALen-1] * y[0]
  196. */
  197. /* Working pointer of inputA */
  198. px = pIn1;
  199. /* Working pointer of inputB */
  200. pSrc2 = pIn2 + (srcBLen - 1u);
  201. py = pSrc2;
  202. /* count is index by which the pointer pIn1 to be incremented */
  203. count = 0u;
  204. /* -------------------
  205. * Stage2 process
  206. * ------------------*/
  207. /* Stage2 depends on srcBLen as in this stage srcBLen number of MACS are performed.
  208. * So, to loop unroll over blockSize2,
  209. * srcBLen should be greater than or equal to 4 */
  210. if(srcBLen >= 4u)
  211. {
  212. /* Loop unroll over blockSize2, by 4 */
  213. blkCnt = blockSize2 >> 2u;
  214. while(blkCnt > 0u)
  215. {
  216. /* Set all accumulators to zero */
  217. acc0 = 0;
  218. acc1 = 0;
  219. acc2 = 0;
  220. acc3 = 0;
  221. /* read x[0], x[1], x[2] samples */
  222. x0 = *(px++);
  223. x1 = *(px++);
  224. x2 = *(px++);
  225. /* Apply loop unrolling and compute 4 MACs simultaneously. */
  226. k = srcBLen >> 2u;
  227. /* First part of the processing with loop unrolling. Compute 4 MACs at a time.
  228. ** a second loop below computes MACs for the remaining 1 to 3 samples. */
  229. do
  230. {
  231. /* Read y[srcBLen - 1] sample */
  232. c0 = *(py--);
  233. /* Read x[3] sample */
  234. x3 = *(px++);
  235. /* Perform the multiply-accumulates */
  236. /* acc0 += x[0] * y[srcBLen - 1] */
  237. acc0 = (q31_t) ((((q63_t) acc0 << 32) + ((q63_t) x0 * c0)) >> 32);
  238. /* acc1 += x[1] * y[srcBLen - 1] */
  239. acc1 = (q31_t) ((((q63_t) acc1 << 32) + ((q63_t) x1 * c0)) >> 32);
  240. /* acc2 += x[2] * y[srcBLen - 1] */
  241. acc2 = (q31_t) ((((q63_t) acc2 << 32) + ((q63_t) x2 * c0)) >> 32);
  242. /* acc3 += x[3] * y[srcBLen - 1] */
  243. acc3 = (q31_t) ((((q63_t) acc3 << 32) + ((q63_t) x3 * c0)) >> 32);
  244. /* Read y[srcBLen - 2] sample */
  245. c0 = *(py--);
  246. /* Read x[4] sample */
  247. x0 = *(px++);
  248. /* Perform the multiply-accumulate */
  249. /* acc0 += x[1] * y[srcBLen - 2] */
  250. acc0 = (q31_t) ((((q63_t) acc0 << 32) + ((q63_t) x1 * c0)) >> 32);
  251. /* acc1 += x[2] * y[srcBLen - 2] */
  252. acc1 = (q31_t) ((((q63_t) acc1 << 32) + ((q63_t) x2 * c0)) >> 32);
  253. /* acc2 += x[3] * y[srcBLen - 2] */
  254. acc2 = (q31_t) ((((q63_t) acc2 << 32) + ((q63_t) x3 * c0)) >> 32);
  255. /* acc3 += x[4] * y[srcBLen - 2] */
  256. acc3 = (q31_t) ((((q63_t) acc3 << 32) + ((q63_t) x0 * c0)) >> 32);
  257. /* Read y[srcBLen - 3] sample */
  258. c0 = *(py--);
  259. /* Read x[5] sample */
  260. x1 = *(px++);
  261. /* Perform the multiply-accumulates */
  262. /* acc0 += x[2] * y[srcBLen - 3] */
  263. acc0 = (q31_t) ((((q63_t) acc0 << 32) + ((q63_t) x2 * c0)) >> 32);
  264. /* acc1 += x[3] * y[srcBLen - 3] */
  265. acc1 = (q31_t) ((((q63_t) acc1 << 32) + ((q63_t) x3 * c0)) >> 32);
  266. /* acc2 += x[4] * y[srcBLen - 3] */
  267. acc2 = (q31_t) ((((q63_t) acc2 << 32) + ((q63_t) x0 * c0)) >> 32);
  268. /* acc3 += x[5] * y[srcBLen - 3] */
  269. acc3 = (q31_t) ((((q63_t) acc3 << 32) + ((q63_t) x1 * c0)) >> 32);
  270. /* Read y[srcBLen - 4] sample */
  271. c0 = *(py--);
  272. /* Read x[6] sample */
  273. x2 = *(px++);
  274. /* Perform the multiply-accumulates */
  275. /* acc0 += x[3] * y[srcBLen - 4] */
  276. acc0 = (q31_t) ((((q63_t) acc0 << 32) + ((q63_t) x3 * c0)) >> 32);
  277. /* acc1 += x[4] * y[srcBLen - 4] */
  278. acc1 = (q31_t) ((((q63_t) acc1 << 32) + ((q63_t) x0 * c0)) >> 32);
  279. /* acc2 += x[5] * y[srcBLen - 4] */
  280. acc2 = (q31_t) ((((q63_t) acc2 << 32) + ((q63_t) x1 * c0)) >> 32);
  281. /* acc3 += x[6] * y[srcBLen - 4] */
  282. acc3 = (q31_t) ((((q63_t) acc3 << 32) + ((q63_t) x2 * c0)) >> 32);
  283. } while(--k);
  284. /* If the srcBLen is not a multiple of 4, compute any remaining MACs here.
  285. ** No loop unrolling is used. */
  286. k = srcBLen % 0x4u;
  287. while(k > 0u)
  288. {
  289. /* Read y[srcBLen - 5] sample */
  290. c0 = *(py--);
  291. /* Read x[7] sample */
  292. x3 = *(px++);
  293. /* Perform the multiply-accumulates */
  294. /* acc0 += x[4] * y[srcBLen - 5] */
  295. acc0 = (q31_t) ((((q63_t) acc0 << 32) + ((q63_t) x0 * c0)) >> 32);
  296. /* acc1 += x[5] * y[srcBLen - 5] */
  297. acc1 = (q31_t) ((((q63_t) acc1 << 32) + ((q63_t) x1 * c0)) >> 32);
  298. /* acc2 += x[6] * y[srcBLen - 5] */
  299. acc2 = (q31_t) ((((q63_t) acc2 << 32) + ((q63_t) x2 * c0)) >> 32);
  300. /* acc3 += x[7] * y[srcBLen - 5] */
  301. acc3 = (q31_t) ((((q63_t) acc3 << 32) + ((q63_t) x3 * c0)) >> 32);
  302. /* Reuse the present samples for the next MAC */
  303. x0 = x1;
  304. x1 = x2;
  305. x2 = x3;
  306. /* Decrement the loop counter */
  307. k--;
  308. }
  309. /* Store the results in the accumulators in the destination buffer. */
  310. *pOut++ = (q31_t) (acc0 << 1);
  311. *pOut++ = (q31_t) (acc1 << 1);
  312. *pOut++ = (q31_t) (acc2 << 1);
  313. *pOut++ = (q31_t) (acc3 << 1);
  314. /* Increment the pointer pIn1 index, count by 4 */
  315. count += 4u;
  316. /* Update the inputA and inputB pointers for next MAC calculation */
  317. px = pIn1 + count;
  318. py = pSrc2;
  319. /* Decrement the loop counter */
  320. blkCnt--;
  321. }
  322. /* If the blockSize2 is not a multiple of 4, compute any remaining output samples here.
  323. ** No loop unrolling is used. */
  324. blkCnt = blockSize2 % 0x4u;
  325. while(blkCnt > 0u)
  326. {
  327. /* Accumulator is made zero for every iteration */
  328. sum = 0;
  329. /* Apply loop unrolling and compute 4 MACs simultaneously. */
  330. k = srcBLen >> 2u;
  331. /* First part of the processing with loop unrolling. Compute 4 MACs at a time.
  332. ** a second loop below computes MACs for the remaining 1 to 3 samples. */
  333. while(k > 0u)
  334. {
  335. /* Perform the multiply-accumulates */
  336. sum = (q31_t) ((((q63_t) sum << 32) +
  337. ((q63_t) * px++ * (*py--))) >> 32);
  338. sum = (q31_t) ((((q63_t) sum << 32) +
  339. ((q63_t) * px++ * (*py--))) >> 32);
  340. sum = (q31_t) ((((q63_t) sum << 32) +
  341. ((q63_t) * px++ * (*py--))) >> 32);
  342. sum = (q31_t) ((((q63_t) sum << 32) +
  343. ((q63_t) * px++ * (*py--))) >> 32);
  344. /* Decrement the loop counter */
  345. k--;
  346. }
  347. /* If the srcBLen is not a multiple of 4, compute any remaining MACs here.
  348. ** No loop unrolling is used. */
  349. k = srcBLen % 0x4u;
  350. while(k > 0u)
  351. {
  352. /* Perform the multiply-accumulate */
  353. sum = (q31_t) ((((q63_t) sum << 32) +
  354. ((q63_t) * px++ * (*py--))) >> 32);
  355. /* Decrement the loop counter */
  356. k--;
  357. }
  358. /* Store the result in the accumulator in the destination buffer. */
  359. *pOut++ = sum << 1;
  360. /* Increment the MAC count */
  361. count++;
  362. /* Update the inputA and inputB pointers for next MAC calculation */
  363. px = pIn1 + count;
  364. py = pSrc2;
  365. /* Decrement the loop counter */
  366. blkCnt--;
  367. }
  368. }
  369. else
  370. {
  371. /* If the srcBLen is not a multiple of 4,
  372. * the blockSize2 loop cannot be unrolled by 4 */
  373. blkCnt = blockSize2;
  374. while(blkCnt > 0u)
  375. {
  376. /* Accumulator is made zero for every iteration */
  377. sum = 0;
  378. /* srcBLen number of MACS should be performed */
  379. k = srcBLen;
  380. while(k > 0u)
  381. {
  382. /* Perform the multiply-accumulate */
  383. sum = (q31_t) ((((q63_t) sum << 32) +
  384. ((q63_t) * px++ * (*py--))) >> 32);
  385. /* Decrement the loop counter */
  386. k--;
  387. }
  388. /* Store the result in the accumulator in the destination buffer. */
  389. *pOut++ = sum << 1;
  390. /* Increment the MAC count */
  391. count++;
  392. /* Update the inputA and inputB pointers for next MAC calculation */
  393. px = pIn1 + count;
  394. py = pSrc2;
  395. /* Decrement the loop counter */
  396. blkCnt--;
  397. }
  398. }
  399. /* --------------------------
  400. * Initializations of stage3
  401. * -------------------------*/
  402. /* sum += x[srcALen-srcBLen+1] * y[srcBLen-1] + x[srcALen-srcBLen+2] * y[srcBLen-2] +...+ x[srcALen-1] * y[1]
  403. * sum += x[srcALen-srcBLen+2] * y[srcBLen-1] + x[srcALen-srcBLen+3] * y[srcBLen-2] +...+ x[srcALen-1] * y[2]
  404. * ....
  405. * sum += x[srcALen-2] * y[srcBLen-1] + x[srcALen-1] * y[srcBLen-2]
  406. * sum += x[srcALen-1] * y[srcBLen-1]
  407. */
  408. /* In this stage the MAC operations are decreased by 1 for every iteration.
  409. The blockSize3 variable holds the number of MAC operations performed */
  410. /* Working pointer of inputA */
  411. pSrc1 = (pIn1 + srcALen) - (srcBLen - 1u);
  412. px = pSrc1;
  413. /* Working pointer of inputB */
  414. pSrc2 = pIn2 + (srcBLen - 1u);
  415. py = pSrc2;
  416. /* -------------------
  417. * Stage3 process
  418. * ------------------*/
  419. while(blockSize3 > 0u)
  420. {
  421. /* Accumulator is made zero for every iteration */
  422. sum = 0;
  423. /* Apply loop unrolling and compute 4 MACs simultaneously. */
  424. k = blockSize3 >> 2u;
  425. /* First part of the processing with loop unrolling. Compute 4 MACs at a time.
  426. ** a second loop below computes MACs for the remaining 1 to 3 samples. */
  427. while(k > 0u)
  428. {
  429. /* sum += x[srcALen - srcBLen + 1] * y[srcBLen - 1] */
  430. sum = (q31_t) ((((q63_t) sum << 32) +
  431. ((q63_t) * px++ * (*py--))) >> 32);
  432. /* sum += x[srcALen - srcBLen + 2] * y[srcBLen - 2] */
  433. sum = (q31_t) ((((q63_t) sum << 32) +
  434. ((q63_t) * px++ * (*py--))) >> 32);
  435. /* sum += x[srcALen - srcBLen + 3] * y[srcBLen - 3] */
  436. sum = (q31_t) ((((q63_t) sum << 32) +
  437. ((q63_t) * px++ * (*py--))) >> 32);
  438. /* sum += x[srcALen - srcBLen + 4] * y[srcBLen - 4] */
  439. sum = (q31_t) ((((q63_t) sum << 32) +
  440. ((q63_t) * px++ * (*py--))) >> 32);
  441. /* Decrement the loop counter */
  442. k--;
  443. }
  444. /* If the blockSize3 is not a multiple of 4, compute any remaining MACs here.
  445. ** No loop unrolling is used. */
  446. k = blockSize3 % 0x4u;
  447. while(k > 0u)
  448. {
  449. /* Perform the multiply-accumulate */
  450. sum = (q31_t) ((((q63_t) sum << 32) +
  451. ((q63_t) * px++ * (*py--))) >> 32);
  452. /* Decrement the loop counter */
  453. k--;
  454. }
  455. /* Store the result in the accumulator in the destination buffer. */
  456. *pOut++ = sum << 1;
  457. /* Update the inputA and inputB pointers for next MAC calculation */
  458. px = ++pSrc1;
  459. py = pSrc2;
  460. /* Decrement the loop counter */
  461. blockSize3--;
  462. }
  463. }
  464. /**
  465. * @} end of Conv group
  466. */