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.

93 lines
2.7KB

  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. REP_RET
  40. %endmacro
  41. INIT_XMM sse
  42. VECTOR_FMUL
  43. %if HAVE_AVX_EXTERNAL
  44. INIT_YMM avx
  45. VECTOR_FMUL
  46. %endif
  47. ;------------------------------------------------------------------------------
  48. ; void ff_vector_fmac_scalar(float *dst, const float *src, float mul, int len)
  49. ;------------------------------------------------------------------------------
  50. %macro VECTOR_FMAC_SCALAR 0
  51. %if UNIX64
  52. cglobal vector_fmac_scalar, 3,3,3, dst, src, len
  53. %else
  54. cglobal vector_fmac_scalar, 4,4,3, dst, src, mul, len
  55. %endif
  56. %if ARCH_X86_32
  57. VBROADCASTSS m0, mulm
  58. %else
  59. %if WIN64
  60. mova xmm0, xmm2
  61. %endif
  62. shufps xmm0, xmm0, 0
  63. %if cpuflag(avx)
  64. vinsertf128 m0, m0, xmm0, 1
  65. %endif
  66. %endif
  67. lea lenq, [lend*4-2*mmsize]
  68. .loop:
  69. mulps m1, m0, [srcq+lenq ]
  70. mulps m2, m0, [srcq+lenq+mmsize]
  71. addps m1, m1, [dstq+lenq ]
  72. addps m2, m2, [dstq+lenq+mmsize]
  73. mova [dstq+lenq ], m1
  74. mova [dstq+lenq+mmsize], m2
  75. sub lenq, 2*mmsize
  76. jge .loop
  77. REP_RET
  78. %endmacro
  79. INIT_XMM sse
  80. VECTOR_FMAC_SCALAR
  81. %if HAVE_AVX_EXTERNAL
  82. INIT_YMM avx
  83. VECTOR_FMAC_SCALAR
  84. %endif