avg_ssse3_x86_64.asm 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ;
  2. ; Copyright (c) 2014 The WebM project authors. All Rights Reserved.
  3. ;
  4. ; Use of this source code is governed by a BSD-style license
  5. ; that can be found in the LICENSE file in the root of the source
  6. ; tree. An additional intellectual property rights grant can be found
  7. ; in the file PATENTS. All contributing project authors may
  8. ; be found in the AUTHORS file in the root of the source tree.
  9. ;
  10. %include "third_party/x86inc/x86inc.asm"
  11. %include "vpx_dsp/x86/bitdepth_conversion_sse2.asm"
  12. SECTION .text
  13. %if ARCH_X86_64
  14. ; matrix transpose
  15. %macro TRANSPOSE8X8 10
  16. ; stage 1
  17. punpcklwd m%9, m%1, m%2
  18. punpcklwd m%10, m%3, m%4
  19. punpckhwd m%1, m%2
  20. punpckhwd m%3, m%4
  21. punpcklwd m%2, m%5, m%6
  22. punpcklwd m%4, m%7, m%8
  23. punpckhwd m%5, m%6
  24. punpckhwd m%7, m%8
  25. ; stage 2
  26. punpckldq m%6, m%9, m%10
  27. punpckldq m%8, m%1, m%3
  28. punpckhdq m%9, m%10
  29. punpckhdq m%1, m%3
  30. punpckldq m%10, m%2, m%4
  31. punpckldq m%3, m%5, m%7
  32. punpckhdq m%2, m%4
  33. punpckhdq m%5, m%7
  34. ; stage 3
  35. punpckhqdq m%4, m%9, m%2 ; out3
  36. punpcklqdq m%9, m%2 ; out2
  37. punpcklqdq m%7, m%1, m%5 ; out6
  38. punpckhqdq m%1, m%5 ; out7
  39. punpckhqdq m%2, m%6, m%10 ; out1
  40. punpcklqdq m%6, m%10 ; out0
  41. punpcklqdq m%5, m%8, m%3 ; out4
  42. punpckhqdq m%8, m%3 ; out5
  43. SWAP %6, %1
  44. SWAP %3, %9
  45. SWAP %8, %6
  46. %endmacro
  47. %macro HMD8_1D 0
  48. psubw m8, m0, m1
  49. psubw m9, m2, m3
  50. paddw m0, m1
  51. paddw m2, m3
  52. SWAP 1, 8
  53. SWAP 3, 9
  54. psubw m8, m4, m5
  55. psubw m9, m6, m7
  56. paddw m4, m5
  57. paddw m6, m7
  58. SWAP 5, 8
  59. SWAP 7, 9
  60. psubw m8, m0, m2
  61. psubw m9, m1, m3
  62. paddw m0, m2
  63. paddw m1, m3
  64. SWAP 2, 8
  65. SWAP 3, 9
  66. psubw m8, m4, m6
  67. psubw m9, m5, m7
  68. paddw m4, m6
  69. paddw m5, m7
  70. SWAP 6, 8
  71. SWAP 7, 9
  72. psubw m8, m0, m4
  73. psubw m9, m1, m5
  74. paddw m0, m4
  75. paddw m1, m5
  76. SWAP 4, 8
  77. SWAP 5, 9
  78. psubw m8, m2, m6
  79. psubw m9, m3, m7
  80. paddw m2, m6
  81. paddw m3, m7
  82. SWAP 6, 8
  83. SWAP 7, 9
  84. %endmacro
  85. INIT_XMM ssse3
  86. cglobal hadamard_8x8, 3, 5, 11, input, stride, output
  87. lea r3, [2 * strideq]
  88. lea r4, [4 * strideq]
  89. mova m0, [inputq]
  90. mova m1, [inputq + r3]
  91. lea inputq, [inputq + r4]
  92. mova m2, [inputq]
  93. mova m3, [inputq + r3]
  94. lea inputq, [inputq + r4]
  95. mova m4, [inputq]
  96. mova m5, [inputq + r3]
  97. lea inputq, [inputq + r4]
  98. mova m6, [inputq]
  99. mova m7, [inputq + r3]
  100. HMD8_1D
  101. TRANSPOSE8X8 0, 1, 2, 3, 4, 5, 6, 7, 9, 10
  102. HMD8_1D
  103. STORE_TRAN_LOW 0, outputq, 0, 8, 9
  104. STORE_TRAN_LOW 1, outputq, 8, 8, 9
  105. STORE_TRAN_LOW 2, outputq, 16, 8, 9
  106. STORE_TRAN_LOW 3, outputq, 24, 8, 9
  107. STORE_TRAN_LOW 4, outputq, 32, 8, 9
  108. STORE_TRAN_LOW 5, outputq, 40, 8, 9
  109. STORE_TRAN_LOW 6, outputq, 48, 8, 9
  110. STORE_TRAN_LOW 7, outputq, 56, 8, 9
  111. RET
  112. %endif