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.

103 lines
2.8KB

  1. ;*****************************************************************************
  2. ;* x86-optimized Float DSP functions
  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 "x86inc.asm"
  21. %include "x86util.asm"
  22. SECTION .text
  23. ;-----------------------------------------------------------------------------
  24. ; void vector_fmul(float *dst, const float *src0, const float *src1, int len)
  25. ;-----------------------------------------------------------------------------
  26. %macro VECTOR_FMUL 0
  27. cglobal vector_fmul, 4,4,2, dst, src0, src1, len
  28. lea lenq, [lend*4 - 2*mmsize]
  29. ALIGN 16
  30. .loop
  31. mova m0, [src0q + lenq]
  32. mova m1, [src0q + lenq + mmsize]
  33. mulps m0, m0, [src1q + lenq]
  34. mulps m1, m1, [src1q + lenq + mmsize]
  35. mova [dstq + lenq], m0
  36. mova [dstq + lenq + mmsize], m1
  37. sub lenq, 2*mmsize
  38. jge .loop
  39. %if mmsize == 32
  40. vzeroupper
  41. RET
  42. %else
  43. REP_RET
  44. %endif
  45. %endmacro
  46. INIT_XMM sse
  47. VECTOR_FMUL
  48. %if HAVE_AVX
  49. INIT_YMM avx
  50. VECTOR_FMUL
  51. %endif
  52. ;------------------------------------------------------------------------------
  53. ; void ff_vector_fmac_scalar(float *dst, const float *src, float mul, int len)
  54. ;------------------------------------------------------------------------------
  55. %macro VECTOR_FMAC_SCALAR 0
  56. %if UNIX64
  57. cglobal vector_fmac_scalar, 3,3,3, dst, src, len
  58. %else
  59. cglobal vector_fmac_scalar, 4,4,3, dst, src, mul, len
  60. %endif
  61. %if WIN64
  62. SWAP 0, 2
  63. %endif
  64. %if ARCH_X86_32
  65. VBROADCASTSS m0, mulm
  66. %else
  67. shufps xmm0, xmm0, 0
  68. %if cpuflag(avx)
  69. vinsertf128 m0, m0, xmm0, 1
  70. %endif
  71. %endif
  72. lea lenq, [lend*4-2*mmsize]
  73. .loop
  74. mulps m1, m0, [srcq+lenq ]
  75. mulps m2, m0, [srcq+lenq+mmsize]
  76. addps m1, m1, [dstq+lenq ]
  77. addps m2, m2, [dstq+lenq+mmsize]
  78. mova [dstq+lenq ], m1
  79. mova [dstq+lenq+mmsize], m2
  80. sub lenq, 2*mmsize
  81. jge .loop
  82. %if mmsize == 32
  83. vzeroupper
  84. RET
  85. %else
  86. REP_RET
  87. %endif
  88. %endmacro
  89. INIT_XMM sse
  90. VECTOR_FMAC_SCALAR
  91. %if HAVE_AVX
  92. INIT_YMM avx
  93. VECTOR_FMAC_SCALAR
  94. %endif