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
2.9KB

  1. ;*******************************************************************************
  2. ;* SIMD-optimized IDCT functions for HEVC decoding
  3. ;* Copyright (c) 2014 Pierre-Edouard LEPERE
  4. ;* Copyright (c) 2014 James Almer
  5. ;*
  6. ;* This file is part of Libav.
  7. ;*
  8. ;* Libav is free software; you can redistribute it and/or
  9. ;* modify it under the terms of the GNU Lesser General Public
  10. ;* License as published by the Free Software Foundation; either
  11. ;* version 2.1 of the License, or (at your option) any later version.
  12. ;*
  13. ;* Libav is distributed in the hope that it will be useful,
  14. ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. ;* Lesser General Public License for more details.
  17. ;*
  18. ;* You should have received a copy of the GNU Lesser General Public
  19. ;* License along with Libav; if not, write to the Free Software
  20. ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. ;******************************************************************************
  22. %include "libavutil/x86/x86util.asm"
  23. section .text
  24. ; void ff_hevc_idctHxW_dc_{8,10}_<opt>(int16_t *coeffs)
  25. ; %1 = HxW
  26. ; %2 = number of loops
  27. ; %3 = bitdepth
  28. %macro IDCT_DC 3
  29. cglobal hevc_idct_%1x%1_dc_%3, 1, 2, 1, coeff, tmp
  30. movsx tmpd, word [coeffq]
  31. add tmpd, (1 << (14 - %3)) + 1
  32. sar tmpd, (15 - %3)
  33. movd xm0, tmpd
  34. SPLATW m0, xm0
  35. DEFINE_ARGS coeff, cnt
  36. mov cntd, %2
  37. .loop:
  38. mova [coeffq+mmsize*0], m0
  39. mova [coeffq+mmsize*1], m0
  40. mova [coeffq+mmsize*2], m0
  41. mova [coeffq+mmsize*3], m0
  42. add coeffq, mmsize*8
  43. mova [coeffq+mmsize*-4], m0
  44. mova [coeffq+mmsize*-3], m0
  45. mova [coeffq+mmsize*-2], m0
  46. mova [coeffq+mmsize*-1], m0
  47. dec cntd
  48. jg .loop
  49. RET
  50. %endmacro
  51. ; %1 = HxW
  52. ; %2 = bitdepth
  53. %macro IDCT_DC_NL 2 ; No loop
  54. cglobal hevc_idct_%1x%1_dc_%2, 1, 2, 1, coeff, tmp
  55. movsx tmpd, word [coeffq]
  56. add tmpd, (1 << (14 - %2)) + 1
  57. sar tmpd, (15 - %2)
  58. movd m0, tmpd
  59. SPLATW m0, xm0
  60. mova [coeffq+mmsize*0], m0
  61. mova [coeffq+mmsize*1], m0
  62. mova [coeffq+mmsize*2], m0
  63. mova [coeffq+mmsize*3], m0
  64. %if mmsize == 16
  65. mova [coeffq+mmsize*4], m0
  66. mova [coeffq+mmsize*5], m0
  67. mova [coeffq+mmsize*6], m0
  68. mova [coeffq+mmsize*7], m0
  69. %endif
  70. RET
  71. %endmacro
  72. ; 8-bit
  73. INIT_MMX mmxext
  74. IDCT_DC_NL 4, 8
  75. IDCT_DC 8, 2, 8
  76. INIT_XMM sse2
  77. IDCT_DC_NL 8, 8
  78. IDCT_DC 16, 4, 8
  79. IDCT_DC 32, 16, 8
  80. %if HAVE_AVX2_EXTERNAL
  81. INIT_YMM avx2
  82. IDCT_DC 16, 2, 8
  83. IDCT_DC 32, 8, 8
  84. %endif ;HAVE_AVX2_EXTERNAL
  85. ; 10-bit
  86. INIT_MMX mmxext
  87. IDCT_DC_NL 4, 10
  88. IDCT_DC 8, 2, 10
  89. INIT_XMM sse2
  90. IDCT_DC_NL 8, 10
  91. IDCT_DC 16, 4, 10
  92. IDCT_DC 32, 16, 10
  93. %if HAVE_AVX2_EXTERNAL
  94. INIT_YMM avx2
  95. IDCT_DC 16, 2, 10
  96. IDCT_DC 32, 8, 10
  97. %endif ;HAVE_AVX2_EXTERNAL