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.

copyTranspose.c 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*!
  2. * \file copyTranspose.c
  3. *
  4. * \brief Copy with transpose function.
  5. *
  6. * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
  7. *
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. *
  16. * Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the
  19. * distribution.
  20. *
  21. * Neither the name of Texas Instruments Incorporated nor the names of
  22. * its contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  28. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  29. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  30. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  31. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  32. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  34. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  35. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36. *
  37. */
  38. #include <common/src/dpu/capon3d/include/copyTranspose.h>
  39. #if 0
  40. uint32_t copyTranspose(uint32_t * src, uint32_t * dest, uint32_t size, int32_t offset, uint32_t stride, uint32_t pairs)
  41. {
  42. int32_t i, j, k;
  43. j = 0;
  44. for(i = 0; i < (int32_t)size; i++)
  45. {
  46. for (k = 0; k < (int32_t)pairs; k++)
  47. {
  48. dest[j+k+i*offset] = src[pairs * i + k];
  49. }
  50. j += (int32_t)stride;
  51. }
  52. return(1);
  53. }
  54. #else
  55. // for optimization purposes specific for 3D capon people counting, will ignore offset and pair parameter.
  56. uint32_t copyTranspose(uint32_t * RESTRICT src, uint32_t * RESTRICT dest, uint32_t size, int32_t offset, uint32_t stride, uint32_t pairs)
  57. {
  58. int32_t i;
  59. int32_t sizeOver4;
  60. uint64_t * RESTRICT input, lltemp1;
  61. uint32_t * RESTRICT output;
  62. uint32_t * RESTRICT input1;
  63. sizeOver4 = (int32_t) (size >> 2);
  64. input = (uint64_t *) src;
  65. output = dest;
  66. for(i = 0; i < sizeOver4; i++)
  67. {
  68. lltemp1 = _amem8(input++);
  69. * output = _loll(lltemp1);
  70. output += stride;
  71. * output = _hill(lltemp1);
  72. output += stride;
  73. lltemp1 = _amem8(input++);
  74. * output = _loll(lltemp1);
  75. output += stride;
  76. * output = _hill(lltemp1);
  77. output += stride;
  78. }
  79. input1 = (uint32_t *) src;
  80. i = i * 4;
  81. for(; i < (int32_t)size; i++)
  82. {
  83. * output = input1[i];
  84. output += stride;
  85. }
  86. return(1);
  87. }
  88. #endif