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.

89 lines
2.5KB

  1. ;******************************************************************************
  2. ;* SIMD-optimized clear block functions
  3. ;* Copyright (c) 2002 Michael Niedermayer
  4. ;* Copyright (c) 2008 Loren Merritt
  5. ;* Copyright (c) 2009 Fiona Glaser
  6. ;*
  7. ;* AVX version by Jokyo Images
  8. ;*
  9. ;* This file is part of FFmpeg.
  10. ;*
  11. ;* FFmpeg is free software; you can redistribute it and/or
  12. ;* modify it under the terms of the GNU Lesser General Public
  13. ;* License as published by the Free Software Foundation; either
  14. ;* version 2.1 of the License, or (at your option) any later version.
  15. ;*
  16. ;* FFmpeg is distributed in the hope that it will be useful,
  17. ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. ;* Lesser General Public License for more details.
  20. ;*
  21. ;* You should have received a copy of the GNU Lesser General Public
  22. ;* License along with FFmpeg; if not, write to the Free Software
  23. ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. ;******************************************************************************
  25. %include "libavutil/x86/x86util.asm"
  26. SECTION .text
  27. ;----------------------------------------
  28. ; void ff_clear_block(int16_t *blocks);
  29. ;----------------------------------------
  30. ; %1 = number of xmm registers used
  31. ; %2 = number of inline store loops
  32. %macro CLEAR_BLOCK 2
  33. cglobal clear_block, 1, 1, %1, blocks
  34. ZERO m0, m0
  35. %assign %%i 0
  36. %rep %2
  37. mova [blocksq+mmsize*(0+%%i)], m0
  38. mova [blocksq+mmsize*(1+%%i)], m0
  39. mova [blocksq+mmsize*(2+%%i)], m0
  40. mova [blocksq+mmsize*(3+%%i)], m0
  41. %assign %%i %%i+4
  42. %endrep
  43. RET
  44. %endmacro
  45. INIT_MMX mmx
  46. %define ZERO pxor
  47. CLEAR_BLOCK 0, 4
  48. INIT_XMM sse
  49. %define ZERO xorps
  50. CLEAR_BLOCK 1, 2
  51. INIT_YMM avx
  52. CLEAR_BLOCK 1, 1
  53. ;-----------------------------------------
  54. ; void ff_clear_blocks(int16_t *blocks);
  55. ;-----------------------------------------
  56. ; %1 = number of xmm registers used
  57. %macro CLEAR_BLOCKS 1
  58. cglobal clear_blocks, 1, 2, %1, blocks, len
  59. add blocksq, 768
  60. mov lenq, -768
  61. ZERO m0, m0
  62. .loop:
  63. mova [blocksq+lenq+mmsize*0], m0
  64. mova [blocksq+lenq+mmsize*1], m0
  65. mova [blocksq+lenq+mmsize*2], m0
  66. mova [blocksq+lenq+mmsize*3], m0
  67. mova [blocksq+lenq+mmsize*4], m0
  68. mova [blocksq+lenq+mmsize*5], m0
  69. mova [blocksq+lenq+mmsize*6], m0
  70. mova [blocksq+lenq+mmsize*7], m0
  71. add lenq, mmsize*8
  72. js .loop
  73. RET
  74. %endmacro
  75. INIT_MMX mmx
  76. %define ZERO pxor
  77. CLEAR_BLOCKS 0
  78. INIT_XMM sse
  79. %define ZERO xorps
  80. CLEAR_BLOCKS 1
  81. INIT_YMM avx
  82. CLEAR_BLOCKS 1