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.

108 lines
3.1KB

  1. ;*****************************************************************************
  2. ;* SIMD-optimized pixel operations
  3. ;*****************************************************************************
  4. ;* Copyright (c) 2000, 2001 Fabrice Bellard
  5. ;* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  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 mmx
  26. ; void ff_get_pixels_mmx(int16_t *block, const uint8_t *pixels, ptrdiff_t stride)
  27. cglobal get_pixels, 3,4
  28. add r0, 128
  29. mov r3, -128
  30. pxor m7, m7
  31. .loop:
  32. mova m0, [r1]
  33. mova m2, [r1+r2]
  34. mova m1, m0
  35. mova m3, m2
  36. punpcklbw m0, m7
  37. punpckhbw m1, m7
  38. punpcklbw m2, m7
  39. punpckhbw m3, m7
  40. mova [r0+r3+ 0], m0
  41. mova [r0+r3+ 8], m1
  42. mova [r0+r3+16], m2
  43. mova [r0+r3+24], m3
  44. lea r1, [r1+r2*2]
  45. add r3, 32
  46. js .loop
  47. REP_RET
  48. INIT_XMM sse2
  49. cglobal get_pixels, 3, 4
  50. lea r3, [r2*3]
  51. pxor m4, m4
  52. movh m0, [r1]
  53. movh m1, [r1+r2]
  54. movh m2, [r1+r2*2]
  55. movh m3, [r1+r3]
  56. lea r1, [r1+r2*4]
  57. punpcklbw m0, m4
  58. punpcklbw m1, m4
  59. punpcklbw m2, m4
  60. punpcklbw m3, m4
  61. mova [r0], m0
  62. mova [r0+0x10], m1
  63. mova [r0+0x20], m2
  64. mova [r0+0x30], m3
  65. movh m0, [r1]
  66. movh m1, [r1+r2*1]
  67. movh m2, [r1+r2*2]
  68. movh m3, [r1+r3]
  69. punpcklbw m0, m4
  70. punpcklbw m1, m4
  71. punpcklbw m2, m4
  72. punpcklbw m3, m4
  73. mova [r0+0x40], m0
  74. mova [r0+0x50], m1
  75. mova [r0+0x60], m2
  76. mova [r0+0x70], m3
  77. RET
  78. INIT_MMX mmx
  79. ; void ff_diff_pixels_mmx(int16_t *block, const uint8_t *s1, const uint8_t *s2,
  80. ; ptrdiff_t stride);
  81. cglobal diff_pixels, 4,5
  82. pxor m7, m7
  83. add r0, 128
  84. mov r4, -128
  85. .loop:
  86. mova m0, [r1]
  87. mova m2, [r2]
  88. mova m1, m0
  89. mova m3, m2
  90. punpcklbw m0, m7
  91. punpckhbw m1, m7
  92. punpcklbw m2, m7
  93. punpckhbw m3, m7
  94. psubw m0, m2
  95. psubw m1, m3
  96. mova [r0+r4+0], m0
  97. mova [r0+r4+8], m1
  98. add r1, r3
  99. add r2, r3
  100. add r4, 16
  101. jne .loop
  102. REP_RET