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.

71 lines
2.2KB

  1. ;******************************************************************************
  2. ;* x86 optimized Format Conversion Utils
  3. ;* Copyright (c) 2008 Loren Merritt
  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_TEXT
  23. ;------------------------------------------------------------------------------
  24. ; void ff_int32_to_float_fmul_scalar(float *dst, const int32_t *src, float mul,
  25. ; int len);
  26. ;------------------------------------------------------------------------------
  27. %macro INT32_TO_FLOAT_FMUL_SCALAR 1
  28. %if UNIX64
  29. cglobal int32_to_float_fmul_scalar, 3, 3, %1, dst, src, len
  30. %else
  31. cglobal int32_to_float_fmul_scalar, 4, 4, %1, dst, src, mul, len
  32. %endif
  33. %if WIN64
  34. SWAP 0, 2
  35. %elif ARCH_X86_32
  36. movss m0, mulm
  37. %endif
  38. SPLATD m0
  39. shl lenq, 2
  40. add srcq, lenq
  41. add dstq, lenq
  42. neg lenq
  43. .loop:
  44. %if cpuflag(sse2)
  45. cvtdq2ps m1, [srcq+lenq ]
  46. cvtdq2ps m2, [srcq+lenq+16]
  47. %else
  48. cvtpi2ps m1, [srcq+lenq ]
  49. cvtpi2ps m3, [srcq+lenq+ 8]
  50. cvtpi2ps m2, [srcq+lenq+16]
  51. cvtpi2ps m4, [srcq+lenq+24]
  52. movlhps m1, m3
  53. movlhps m2, m4
  54. %endif
  55. mulps m1, m0
  56. mulps m2, m0
  57. mova [dstq+lenq ], m1
  58. mova [dstq+lenq+16], m2
  59. add lenq, 32
  60. jl .loop
  61. REP_RET
  62. %endmacro
  63. INIT_XMM sse
  64. INT32_TO_FLOAT_FMUL_SCALAR 5
  65. INIT_XMM sse2
  66. INT32_TO_FLOAT_FMUL_SCALAR 3