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.

115 lines
3.2KB

  1. ;******************************************************************************
  2. ;* AAC Spectral Band Replication decoding functions
  3. ;* Copyright (C) 2012 Christophe Gisquet <christophe.gisquet@gmail.com>
  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/x86/x86util.asm"
  22. ;SECTION_RODATA
  23. SECTION .text
  24. INIT_XMM sse
  25. cglobal sbr_sum_square, 2, 3, 6
  26. mov r2, r1
  27. xorps m0, m0
  28. xorps m1, m1
  29. sar r2, 3
  30. jz .prepare
  31. .loop:
  32. movu m2, [r0 + 0]
  33. movu m3, [r0 + 16]
  34. movu m4, [r0 + 32]
  35. movu m5, [r0 + 48]
  36. mulps m2, m2
  37. mulps m3, m3
  38. mulps m4, m4
  39. mulps m5, m5
  40. addps m0, m2
  41. addps m1, m3
  42. addps m0, m4
  43. addps m1, m5
  44. add r0, 64
  45. dec r2
  46. jnz .loop
  47. .prepare:
  48. and r1, 7
  49. sar r1, 1
  50. jz .end
  51. ; len is a multiple of 2, thus there are at least 4 elements to process
  52. .endloop:
  53. movu m2, [r0]
  54. add r0, 16
  55. mulps m2, m2
  56. dec r1
  57. addps m0, m2
  58. jnz .endloop
  59. .end:
  60. addps m0, m1
  61. movhlps m2, m0
  62. addps m0, m2
  63. movss m1, m0
  64. shufps m0, m0, 1
  65. addss m0, m1
  66. %if ARCH_X86_64 == 0
  67. movss r0m, m0
  68. fld dword r0m
  69. %endif
  70. RET
  71. %define STEP 40*4*2
  72. cglobal sbr_hf_g_filt, 5, 6, 5
  73. lea r1, [r1 + 8*r4] ; offset by ixh elements into X_high
  74. mov r5, r3
  75. and r3, 0xFC
  76. lea r2, [r2 + r3*4]
  77. lea r0, [r0 + r3*8]
  78. neg r3
  79. jz .loop1
  80. .loop4:
  81. movlps m0, [r2 + 4*r3 + 0]
  82. movlps m1, [r2 + 4*r3 + 8]
  83. movlps m2, [r1 + 0*STEP]
  84. movlps m3, [r1 + 2*STEP]
  85. movhps m2, [r1 + 1*STEP]
  86. movhps m3, [r1 + 3*STEP]
  87. unpcklps m0, m0
  88. unpcklps m1, m1
  89. mulps m0, m2
  90. mulps m1, m3
  91. movu [r0 + 8*r3 + 0], m0
  92. movu [r0 + 8*r3 + 16], m1
  93. add r1, 4*STEP
  94. add r3, 4
  95. jnz .loop4
  96. and r5, 3 ; number of single element loops
  97. jz .end
  98. .loop1: ; element 0 and 1 can be computed at the same time
  99. movss m0, [r2]
  100. movlps m2, [r1]
  101. unpcklps m0, m0
  102. mulps m2, m0
  103. movlps [r0], m2
  104. add r0, 8
  105. add r2, 4
  106. add r1, STEP
  107. dec r5
  108. jnz .loop1
  109. .end:
  110. RET