arm_not_q7.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_not_q7.c
  4. * Description: Q7 bitwise NOT
  5. *
  6. * $Date: 14 November 2019
  7. * $Revision: V1.6.0
  8. *
  9. * Target Processor: Cortex-M cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the License); you may
  17. * not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  24. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. */
  28. #include "arm_math.h"
  29. /**
  30. @ingroup groupMath
  31. */
  32. /**
  33. @addtogroup Not
  34. @{
  35. */
  36. /**
  37. @brief Compute the logical bitwise NOT of a fixed-point vector.
  38. @param[in] pSrc points to input vector
  39. @param[out] pDst points to output vector
  40. @param[in] blockSize number of samples in each vector
  41. @return none
  42. */
  43. void arm_not_q7(
  44. const q7_t * pSrc,
  45. q7_t * pDst,
  46. uint32_t blockSize)
  47. {
  48. uint32_t blkCnt; /* Loop counter */
  49. #if defined(ARM_MATH_NEON)
  50. int8x16_t inV;
  51. /* Compute 16 outputs at a time */
  52. blkCnt = blockSize >> 4U;
  53. while (blkCnt > 0U)
  54. {
  55. inV = vld1q_s8(pSrc);
  56. vst1q_s8(pDst, vmvnq_s8(inV) );
  57. pSrc += 16;
  58. pDst += 16;
  59. /* Decrement the loop counter */
  60. blkCnt--;
  61. }
  62. /* Tail */
  63. blkCnt = blockSize & 0xF;
  64. #else
  65. /* Initialize blkCnt with number of samples */
  66. blkCnt = blockSize;
  67. #endif
  68. while (blkCnt > 0U)
  69. {
  70. *pDst++ = ~(*pSrc++);
  71. /* Decrement the loop counter */
  72. blkCnt--;
  73. }
  74. }
  75. /**
  76. @} end of Not group
  77. */