inv_wht_sse2.asm 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ;
  2. ; Copyright (c) 2015 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. %macro REORDER_INPUTS 0
  14. ; a c d b to a b c d
  15. SWAP 1, 3, 2
  16. %endmacro
  17. %macro TRANSFORM_COLS 0
  18. ; input:
  19. ; m0 a
  20. ; m1 b
  21. ; m2 c
  22. ; m3 d
  23. paddw m0, m2
  24. psubw m3, m1
  25. ; wide subtract
  26. punpcklwd m4, m0
  27. punpcklwd m5, m3
  28. psrad m4, 16
  29. psrad m5, 16
  30. psubd m4, m5
  31. psrad m4, 1
  32. packssdw m4, m4 ; e
  33. psubw m5, m4, m1 ; b
  34. psubw m4, m2 ; c
  35. psubw m0, m5
  36. paddw m3, m4
  37. ; m0 a
  38. SWAP 1, 5 ; m1 b
  39. SWAP 2, 4 ; m2 c
  40. ; m3 d
  41. %endmacro
  42. %macro TRANSPOSE_4X4 0
  43. punpcklwd m0, m2
  44. punpcklwd m1, m3
  45. mova m2, m0
  46. punpcklwd m0, m1
  47. punpckhwd m2, m1
  48. pshufd m1, m0, 0x0e
  49. pshufd m3, m2, 0x0e
  50. %endmacro
  51. ; transpose a 4x4 int16 matrix in xmm0 and xmm1 to the bottom half of xmm0-xmm3
  52. %macro TRANSPOSE_4X4_WIDE 0
  53. mova m3, m0
  54. punpcklwd m0, m1
  55. punpckhwd m3, m1
  56. mova m2, m0
  57. punpcklwd m0, m3
  58. punpckhwd m2, m3
  59. pshufd m1, m0, 0x0e
  60. pshufd m3, m2, 0x0e
  61. %endmacro
  62. %macro ADD_STORE_4P_2X 5 ; src1, src2, tmp1, tmp2, zero
  63. movd m%3, [outputq]
  64. movd m%4, [outputq + strideq]
  65. punpcklbw m%3, m%5
  66. punpcklbw m%4, m%5
  67. paddw m%1, m%3
  68. paddw m%2, m%4
  69. packuswb m%1, m%5
  70. packuswb m%2, m%5
  71. movd [outputq], m%1
  72. movd [outputq + strideq], m%2
  73. %endmacro
  74. INIT_XMM sse2
  75. cglobal iwht4x4_16_add, 3, 3, 7, input, output, stride
  76. LOAD_TRAN_LOW 0, inputq, 0
  77. LOAD_TRAN_LOW 1, inputq, 8
  78. psraw m0, 2
  79. psraw m1, 2
  80. TRANSPOSE_4X4_WIDE
  81. REORDER_INPUTS
  82. TRANSFORM_COLS
  83. TRANSPOSE_4X4
  84. REORDER_INPUTS
  85. TRANSFORM_COLS
  86. pxor m4, m4
  87. ADD_STORE_4P_2X 0, 1, 5, 6, 4
  88. lea outputq, [outputq + 2 * strideq]
  89. ADD_STORE_4P_2X 2, 3, 5, 6, 4
  90. RET