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.

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