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.

94 lines
3.2KB

  1. /*
  2. * ARM NEON optimised integer operations
  3. * Copyright (c) 2009 Kostya Shishkov
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * Libav is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "libavutil/arm/asm.S"
  22. preserve8
  23. .fpu neon
  24. function ff_scalarproduct_int16_neon, export=1
  25. vmov.i16 q0, #0
  26. vmov.i16 q1, #0
  27. vmov.i16 q2, #0
  28. vmov.i16 q3, #0
  29. 1: vld1.16 {d16-d17}, [r0]!
  30. vld1.16 {d20-d21}, [r1,:128]!
  31. vmlal.s16 q0, d16, d20
  32. vld1.16 {d18-d19}, [r0]!
  33. vmlal.s16 q1, d17, d21
  34. vld1.16 {d22-d23}, [r1,:128]!
  35. vmlal.s16 q2, d18, d22
  36. vmlal.s16 q3, d19, d23
  37. subs r2, r2, #16
  38. bne 1b
  39. vpadd.s32 d16, d0, d1
  40. vpadd.s32 d17, d2, d3
  41. vpadd.s32 d10, d4, d5
  42. vpadd.s32 d11, d6, d7
  43. vpadd.s32 d0, d16, d17
  44. vpadd.s32 d1, d10, d11
  45. vpadd.s32 d2, d0, d1
  46. vpaddl.s32 d3, d2
  47. vmov.32 r0, d3[0]
  48. bx lr
  49. endfunc
  50. @ scalarproduct_and_madd_int16(/*aligned*/v0,v1,v2,order,mul)
  51. function ff_scalarproduct_and_madd_int16_neon, export=1
  52. vld1.16 {d28[],d29[]}, [sp]
  53. vmov.i16 q0, #0
  54. vmov.i16 q1, #0
  55. vmov.i16 q2, #0
  56. vmov.i16 q3, #0
  57. mov r12, r0
  58. 1: vld1.16 {d16-d17}, [r0,:128]!
  59. vld1.16 {d18-d19}, [r1]!
  60. vld1.16 {d20-d21}, [r2]!
  61. vld1.16 {d22-d23}, [r0,:128]!
  62. vld1.16 {d24-d25}, [r1]!
  63. vld1.16 {d26-d27}, [r2]!
  64. vmul.s16 q10, q10, q14
  65. vmul.s16 q13, q13, q14
  66. vmlal.s16 q0, d16, d18
  67. vmlal.s16 q1, d17, d19
  68. vadd.s16 q10, q8, q10
  69. vadd.s16 q13, q11, q13
  70. vmlal.s16 q2, d22, d24
  71. vmlal.s16 q3, d23, d25
  72. vst1.16 {q10}, [r12,:128]!
  73. subs r3, r3, #16
  74. vst1.16 {q13}, [r12,:128]!
  75. bne 1b
  76. vpadd.s32 d16, d0, d1
  77. vpadd.s32 d17, d2, d3
  78. vpadd.s32 d10, d4, d5
  79. vpadd.s32 d11, d6, d7
  80. vpadd.s32 d0, d16, d17
  81. vpadd.s32 d1, d10, d11
  82. vpadd.s32 d2, d0, d1
  83. vpaddl.s32 d3, d2
  84. vmov.32 r0, d3[0]
  85. bx lr
  86. endfunc