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.

147 lines
4.5KB

  1. /*
  2. * Copyright (c) 2012 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 "libavutil/arm/asm.S"
  21. function flac_lpc_16_1_arm
  22. ldr r12, [sp]
  23. push {r4, lr}
  24. ldr r1, [r1]
  25. subs r12, r12, #2
  26. ldr lr, [r0], #4
  27. beq 2f
  28. it lt
  29. poplt {r4, pc}
  30. 1:
  31. mul r4, lr, r1
  32. ldm r0, {r2, lr}
  33. add_sh r2, r2, r4, asr r3
  34. mul r4, r2, r1
  35. subs r12, r12, #2
  36. add_sh lr, lr, r4, asr r3
  37. stm r0!, {r2, lr}
  38. bgt 1b
  39. it lt
  40. poplt {r4, pc}
  41. 2:
  42. mul r4, lr, r1
  43. ldr r2, [r0]
  44. add_sh r2, r2, r4, asr r3
  45. str r2, [r0]
  46. pop {r4, pc}
  47. endfunc
  48. function flac_lpc_16_2_arm
  49. ldr r12, [sp]
  50. subs r12, r12, r2
  51. it le
  52. bxle lr
  53. push {r4-r9, lr}
  54. ldm r0!, {r6, r7}
  55. ldm r1, {r8, r9}
  56. subs r12, r12, #1
  57. beq 2f
  58. 1:
  59. mul r4, r6, r8
  60. mul r5, r7, r8
  61. mla r4, r7, r9, r4
  62. ldm r0, {r6, r7}
  63. add_sh r6, r6, r4, asr r3
  64. mla r5, r6, r9, r5
  65. add_sh r7, r7, r5, asr r3
  66. stm r0!, {r6, r7}
  67. subs r12, r12, #2
  68. bgt 1b
  69. it lt
  70. poplt {r4-r9, pc}
  71. 2:
  72. mul r4, r6, r8
  73. mla r4, r7, r9, r4
  74. ldr r5, [r0]
  75. add_sh r5, r5, r4, asr r3
  76. str r5, [r0]
  77. pop {r4-r9, pc}
  78. endfunc
  79. function ff_flac_lpc_16_arm, export=1
  80. cmp r2, #2
  81. blt flac_lpc_16_1_arm
  82. beq flac_lpc_16_2_arm
  83. ldr r12, [sp]
  84. subs r12, r12, r2
  85. it le
  86. bxle lr
  87. push {r4-r9, lr}
  88. subs r12, r12, #1
  89. beq 3f
  90. 1:
  91. sub lr, r2, #2
  92. mov r4, #0
  93. mov r5, #0
  94. ldr r7, [r0], #4
  95. ldr r9, [r1], #4
  96. 2:
  97. mla r4, r7, r9, r4
  98. ldm r0!, {r6, r7}
  99. mla r5, r6, r9, r5
  100. ldm r1!, {r8, r9}
  101. mla r4, r6, r8, r4
  102. subs lr, lr, #2
  103. mla r5, r7, r8, r5
  104. bgt 2b
  105. blt 6f
  106. mla r4, r7, r9, r4
  107. ldr r7, [r0], #4
  108. mla r5, r7, r9, r5
  109. ldr r9, [r1], #4
  110. 6:
  111. mla r4, r7, r9, r4
  112. ldm r0, {r6, r7}
  113. add_sh r6, r6, r4, asr r3
  114. mla r5, r6, r9, r5
  115. add_sh r7, r7, r5, asr r3
  116. stm r0!, {r6, r7}
  117. sub r0, r0, r2, lsl #2
  118. sub r1, r1, r2, lsl #2
  119. subs r12, r12, #2
  120. bgt 1b
  121. it lt
  122. poplt {r4-r9, pc}
  123. 3:
  124. mov r4, #0
  125. 4:
  126. ldr r5, [r1], #4
  127. ldr r6, [r0], #4
  128. mla r4, r5, r6, r4
  129. subs r2, r2, #1
  130. bgt 4b
  131. ldr r5, [r0]
  132. add_sh r5, r5, r4, asr r3
  133. str r5, [r0]
  134. pop {r4-r9, pc}
  135. endfunc