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.

109 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. lea r4, [r2*3]
  36. .loop:
  37. OP m0, [r1]
  38. OP m1, [r1+r2]
  39. OP m2, [r1+r2*2]
  40. OP m3, [r1+r4]
  41. lea r1, [r1+r2*4]
  42. %ifidn %1, avg
  43. pavgb m0, [r0]
  44. pavgb m1, [r0+r2]
  45. pavgb m2, [r0+r2*2]
  46. pavgb m3, [r0+r4]
  47. %endif
  48. OP [r0], m0
  49. OP [r0+r2], m1
  50. OP [r0+r2*2], m2
  51. OP [r0+r4], m3
  52. sub r3d, 4
  53. lea r0, [r0+r2*4]
  54. jne .loop
  55. RET
  56. %endmacro
  57. PIXELS48 put, 4
  58. PIXELS48 avg, 4
  59. PIXELS48 put, 8
  60. PIXELS48 avg, 8
  61. INIT_XMM sse2
  62. ; void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
  63. ; ptrdiff_t line_size, int h)
  64. cglobal put_pixels16, 4,5,4
  65. lea r4, [r2*3]
  66. .loop:
  67. movu m0, [r1]
  68. movu m1, [r1+r2]
  69. movu m2, [r1+r2*2]
  70. movu m3, [r1+r4]
  71. lea r1, [r1+r2*4]
  72. mova [r0], m0
  73. mova [r0+r2], m1
  74. mova [r0+r2*2], m2
  75. mova [r0+r4], m3
  76. sub r3d, 4
  77. lea r0, [r0+r2*4]
  78. jnz .loop
  79. REP_RET
  80. ; void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels,
  81. ; ptrdiff_t line_size, int h)
  82. cglobal avg_pixels16, 4,5,4
  83. lea r4, [r2*3]
  84. .loop:
  85. movu m0, [r1]
  86. movu m1, [r1+r2]
  87. movu m2, [r1+r2*2]
  88. movu m3, [r1+r4]
  89. lea r1, [r1+r2*4]
  90. pavgb m0, [r0]
  91. pavgb m1, [r0+r2]
  92. pavgb m2, [r0+r2*2]
  93. pavgb m3, [r0+r4]
  94. mova [r0], m0
  95. mova [r0+r2], m1
  96. mova [r0+r2*2], m2
  97. mova [r0+r4], m3
  98. sub r3d, 4
  99. lea r0, [r0+r2*4]
  100. jnz .loop
  101. REP_RET