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.

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