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.

110 lines
3.0KB

  1. ;******************************************************************************
  2. ;* SIMD-optimized fullpel functions
  3. ;* Copyright (c) 2008 Loren Merritt
  4. ;* Copyright (c) 2003-2013 Michael Niedermayer
  5. ;* Copyright (c) 2013 Daniel Kang
  6. ;*
  7. ;* This file is part of Libav.
  8. ;*
  9. ;* Libav is free software; you can redistribute it and/or
  10. ;* modify it under the terms of the GNU Lesser General Public
  11. ;* License as published by the Free Software Foundation; either
  12. ;* version 2.1 of the License, or (at your option) any later version.
  13. ;*
  14. ;* Libav is distributed in the hope that it will be useful,
  15. ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. ;* Lesser General Public License for more details.
  18. ;*
  19. ;* You should have received a copy of the GNU Lesser General Public
  20. ;* License along with Libav; if not, write to the Free Software
  21. ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. ;******************************************************************************
  23. %include "libavutil/x86/x86util.asm"
  24. SECTION .text
  25. INIT_MMX mmxext
  26. ; void ff_put/avg_pixels(uint8_t *block, const uint8_t *pixels,
  27. ; ptrdiff_t line_size, int h)
  28. %macro PIXELS48 2
  29. %if %2 == 4
  30. %define OP movh
  31. %else
  32. %define OP mova
  33. %endif
  34. cglobal %1_pixels%2, 4,5
  35. movsxdifnidn r2, r2d
  36. lea r4, [r2*3]
  37. .loop:
  38. OP m0, [r1]
  39. OP m1, [r1+r2]
  40. OP m2, [r1+r2*2]
  41. OP m3, [r1+r4]
  42. lea r1, [r1+r2*4]
  43. %ifidn %1, avg
  44. pavgb m0, [r0]
  45. pavgb m1, [r0+r2]
  46. pavgb m2, [r0+r2*2]
  47. pavgb m3, [r0+r4]
  48. %endif
  49. OP [r0], m0
  50. OP [r0+r2], m1
  51. OP [r0+r2*2], m2
  52. OP [r0+r4], m3
  53. sub r3d, 4
  54. lea r0, [r0+r2*4]
  55. jne .loop
  56. RET
  57. %endmacro
  58. PIXELS48 put, 4
  59. PIXELS48 avg, 4
  60. PIXELS48 put, 8
  61. PIXELS48 avg, 8
  62. INIT_XMM sse2
  63. ; void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
  64. ; ptrdiff_t line_size, int h)
  65. cglobal put_pixels16, 4,5,4
  66. lea r4, [r2*3]
  67. .loop:
  68. movu m0, [r1]
  69. movu m1, [r1+r2]
  70. movu m2, [r1+r2*2]
  71. movu m3, [r1+r4]
  72. lea r1, [r1+r2*4]
  73. mova [r0], m0
  74. mova [r0+r2], m1
  75. mova [r0+r2*2], m2
  76. mova [r0+r4], m3
  77. sub r3d, 4
  78. lea r0, [r0+r2*4]
  79. jnz .loop
  80. REP_RET
  81. ; void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
  82. ; ptrdiff_t line_size, int h)
  83. cglobal avg_pixels16, 4,5,4
  84. lea r4, [r2*3]
  85. .loop:
  86. movu m0, [r1]
  87. movu m1, [r1+r2]
  88. movu m2, [r1+r2*2]
  89. movu m3, [r1+r4]
  90. lea r1, [r1+r2*4]
  91. pavgb m0, [r0]
  92. pavgb m1, [r0+r2]
  93. pavgb m2, [r0+r2*2]
  94. pavgb m3, [r0+r4]
  95. mova [r0], m0
  96. mova [r0+r2], m1
  97. mova [r0+r2*2], m2
  98. mova [r0+r4], m3
  99. sub r3d, 4
  100. lea r0, [r0+r2*4]
  101. jnz .loop
  102. REP_RET