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.

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