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.

144 lines
4.9KB

  1. /*
  2. * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * Libav is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "asm.S"
  21. .macro skip args:vararg
  22. .endm
  23. .macro sum8 lo, hi, w, p, t1, t2, t3, t4, rsb=skip, offs=0
  24. ldr \t1, [\w, #4*\offs]
  25. ldr \t2, [\p, #4]!
  26. \rsb \t1, \t1, #0
  27. .irpc i, 135
  28. ldr \t3, [\w, #4*64*\i+4*\offs]
  29. ldr \t4, [\p, #4*64*\i]
  30. smlal \lo, \hi, \t1, \t2
  31. \rsb \t3, \t3, #0
  32. ldr \t1, [\w, #4*64*(\i+1)+4*\offs]
  33. ldr \t2, [\p, #4*64*(\i+1)]
  34. smlal \lo, \hi, \t3, \t4
  35. \rsb \t1, \t1, #0
  36. .endr
  37. ldr \t3, [\w, #4*64*7+4*\offs]
  38. ldr \t4, [\p, #4*64*7]
  39. smlal \lo, \hi, \t1, \t2
  40. \rsb \t3, \t3, #0
  41. smlal \lo, \hi, \t3, \t4
  42. .endm
  43. .macro round rd, lo, hi
  44. lsr \rd, \lo, #24
  45. bic \lo, \lo, #0xff000000
  46. orr \rd, \rd, \hi, lsl #8
  47. mov \hi, #0
  48. ssat \rd, #16, \rd
  49. .endm
  50. function ff_mpadsp_apply_window_fixed_armv6, export=1
  51. push {r2,r4-r11,lr}
  52. add r4, r0, #4*512 @ synth_buf + 512
  53. .rept 4
  54. ldm r0!, {r5-r12}
  55. stm r4!, {r5-r12}
  56. .endr
  57. ldr r4, [sp, #40] @ incr
  58. sub r0, r0, #4*17 @ synth_buf + 16
  59. ldr r8, [r2] @ sum:low
  60. add r2, r0, #4*32 @ synth_buf + 48
  61. rsb r5, r4, r4, lsl #5 @ 31 * incr
  62. lsl r4, r4, #1
  63. asr r9, r8, #31 @ sum:high
  64. add r5, r3, r5, lsl #1 @ samples2
  65. add r6, r1, #4*32 @ w2
  66. str r4, [sp, #40]
  67. sum8 r8, r9, r1, r0, r10, r11, r12, lr
  68. sum8 r8, r9, r1, r2, r10, r11, r12, lr, rsb, 32
  69. round r10, r8, r9
  70. strh_post r10, r3, r4
  71. mov lr, #15
  72. 1:
  73. ldr r12, [r0, #4]!
  74. ldr r11, [r6, #-4]!
  75. ldr r10, [r1, #4]!
  76. .irpc i, 0246
  77. .if \i
  78. ldr r11, [r6, #4*64*\i]
  79. ldr r10, [r1, #4*64*\i]
  80. .endif
  81. rsb r11, r11, #0
  82. smlal r8, r9, r10, r12
  83. ldr r10, [r0, #4*64*(\i+1)]
  84. .ifeq \i
  85. smull r4, r7, r11, r12
  86. .else
  87. smlal r4, r7, r11, r12
  88. .endif
  89. ldr r11, [r6, #4*64*(\i+1)]
  90. ldr r12, [r1, #4*64*(\i+1)]
  91. rsb r11, r11, #0
  92. smlal r8, r9, r12, r10
  93. .iflt \i-6
  94. ldr r12, [r0, #4*64*(\i+2)]
  95. .else
  96. ldr r12, [r2, #-4]!
  97. .endif
  98. smlal r4, r7, r11, r10
  99. .endr
  100. .irpc i, 0246
  101. ldr r10, [r1, #4*64*\i+4*32]
  102. rsb r12, r12, #0
  103. ldr r11, [r6, #4*64*\i+4*32]
  104. smlal r8, r9, r10, r12
  105. ldr r10, [r2, #4*64*(\i+1)]
  106. smlal r4, r7, r11, r12
  107. ldr r12, [r1, #4*64*(\i+1)+4*32]
  108. rsb r10, r10, #0
  109. ldr r11, [r6, #4*64*(\i+1)+4*32]
  110. smlal r8, r9, r12, r10
  111. .iflt \i-6
  112. ldr r12, [r2, #4*64*(\i+2)]
  113. .else
  114. ldr r12, [sp, #40]
  115. .endif
  116. smlal r4, r7, r11, r10
  117. .endr
  118. round r10, r8, r9
  119. adds r8, r8, r4
  120. adc r9, r9, r7
  121. strh_post r10, r3, r12
  122. round r11, r8, r9
  123. subs lr, lr, #1
  124. strh_dpost r11, r5, r12
  125. bgt 1b
  126. sum8 r8, r9, r1, r0, r10, r11, r12, lr, rsb, 33
  127. pop {r4}
  128. round r10, r8, r9
  129. str r8, [r4]
  130. strh r10, [r3]
  131. pop {r4-r11,pc}
  132. endfunc