fmtconvert.asm 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ;******************************************************************************
  2. ;* x86 optimized Format Conversion Utils
  3. ;* Copyright (c) 2008 Loren Merritt
  4. ;*
  5. ;* This file is part of FFmpeg.
  6. ;*
  7. ;* FFmpeg 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. ;* FFmpeg 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 FFmpeg; 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 lend, 2
  40. add srcq, lenq
  41. add dstq, lenq
  42. neg lenq
  43. .loop:
  44. cvtdq2ps m1, [srcq+lenq ]
  45. cvtdq2ps m2, [srcq+lenq+16]
  46. mulps m1, m0
  47. mulps m2, m0
  48. mova [dstq+lenq ], m1
  49. mova [dstq+lenq+16], m2
  50. add lenq, 32
  51. jl .loop
  52. RET
  53. %endmacro
  54. INIT_XMM sse2
  55. INT32_TO_FLOAT_FMUL_SCALAR 3
  56. ;------------------------------------------------------------------------------
  57. ; void ff_int32_to_float_fmul_array8(FmtConvertContext *c, float *dst, const int32_t *src,
  58. ; const float *mul, int len);
  59. ;------------------------------------------------------------------------------
  60. %macro INT32_TO_FLOAT_FMUL_ARRAY8 0
  61. cglobal int32_to_float_fmul_array8, 5, 5, 5, c, dst, src, mul, len
  62. shl lend, 2
  63. add srcq, lenq
  64. add dstq, lenq
  65. neg lenq
  66. .loop:
  67. movss m0, [mulq]
  68. SPLATD m0
  69. cvtdq2ps m1, [srcq+lenq ]
  70. cvtdq2ps m2, [srcq+lenq+16]
  71. mulps m1, m0
  72. mulps m2, m0
  73. mova [dstq+lenq ], m1
  74. mova [dstq+lenq+16], m2
  75. add mulq, 4
  76. add lenq, 32
  77. jl .loop
  78. RET
  79. %endmacro
  80. INIT_XMM sse2
  81. INT32_TO_FLOAT_FMUL_ARRAY8