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.6KB

  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. ;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. ;******************************************************************************
  21. %include "x86inc.asm"
  22. section .text align=16
  23. %macro PSWAPD_SSE 2
  24. pshufw %1, %2, 0x4e
  25. %endmacro
  26. %macro PSWAPD_3DN1 2
  27. movq %1, %2
  28. psrlq %1, 32
  29. punpckldq %1, %2
  30. %endmacro
  31. %macro FLOAT_TO_INT16_INTERLEAVE6 1
  32. ; void float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
  33. cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5
  34. %ifdef ARCH_X86_64
  35. %define lend r10d
  36. mov lend, r2d
  37. %else
  38. %define lend dword r2m
  39. %endif
  40. mov src1q, [srcq+1*gprsize]
  41. mov src2q, [srcq+2*gprsize]
  42. mov src3q, [srcq+3*gprsize]
  43. mov src4q, [srcq+4*gprsize]
  44. mov src5q, [srcq+5*gprsize]
  45. mov srcq, [srcq]
  46. sub src1q, srcq
  47. sub src2q, srcq
  48. sub src3q, srcq
  49. sub src4q, srcq
  50. sub src5q, srcq
  51. .loop:
  52. cvtps2pi mm0, [srcq]
  53. cvtps2pi mm1, [srcq+src1q]
  54. cvtps2pi mm2, [srcq+src2q]
  55. cvtps2pi mm3, [srcq+src3q]
  56. cvtps2pi mm4, [srcq+src4q]
  57. cvtps2pi mm5, [srcq+src5q]
  58. packssdw mm0, mm3
  59. packssdw mm1, mm4
  60. packssdw mm2, mm5
  61. pswapd mm3, mm0
  62. punpcklwd mm0, mm1
  63. punpckhwd mm1, mm2
  64. punpcklwd mm2, mm3
  65. pswapd mm3, mm0
  66. punpckldq mm0, mm2
  67. punpckhdq mm2, mm1
  68. punpckldq mm1, mm3
  69. movq [dstq ], mm0
  70. movq [dstq+16], mm2
  71. movq [dstq+ 8], mm1
  72. add srcq, 8
  73. add dstq, 24
  74. sub lend, 2
  75. jg .loop
  76. emms
  77. RET
  78. %endmacro ; FLOAT_TO_INT16_INTERLEAVE6
  79. %define pswapd PSWAPD_SSE
  80. FLOAT_TO_INT16_INTERLEAVE6 sse
  81. %define cvtps2pi pf2id
  82. %define pswapd PSWAPD_3DN1
  83. FLOAT_TO_INT16_INTERLEAVE6 3dnow
  84. %undef pswapd
  85. FLOAT_TO_INT16_INTERLEAVE6 3dn2
  86. %undef cvtps2pi