vp9_dct_sse2.asm 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ;
  2. ; Copyright (c) 2016 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. %define private_prefix vp9
  11. %include "third_party/x86inc/x86inc.asm"
  12. SECTION .text
  13. %macro TRANSFORM_COLS 0
  14. paddw m0, m1
  15. movq m4, m0
  16. psubw m3, m2
  17. psubw m4, m3
  18. psraw m4, 1
  19. movq m5, m4
  20. psubw m5, m1 ;b1
  21. psubw m4, m2 ;c1
  22. psubw m0, m4
  23. paddw m3, m5
  24. ; m0 a0
  25. SWAP 1, 4 ; m1 c1
  26. SWAP 2, 3 ; m2 d1
  27. SWAP 3, 5 ; m3 b1
  28. %endmacro
  29. %macro TRANSPOSE_4X4 0
  30. ; 00 01 02 03
  31. ; 10 11 12 13
  32. ; 20 21 22 23
  33. ; 30 31 32 33
  34. punpcklwd m0, m1 ; 00 10 01 11 02 12 03 13
  35. punpcklwd m2, m3 ; 20 30 21 31 22 32 23 33
  36. mova m1, m0
  37. punpckldq m0, m2 ; 00 10 20 30 01 11 21 31
  38. punpckhdq m1, m2 ; 02 12 22 32 03 13 23 33
  39. %endmacro
  40. INIT_XMM sse2
  41. cglobal fwht4x4, 3, 4, 8, input, output, stride
  42. lea r3q, [inputq + strideq*4]
  43. movq m0, [inputq] ;a1
  44. movq m1, [inputq + strideq*2] ;b1
  45. movq m2, [r3q] ;c1
  46. movq m3, [r3q + strideq*2] ;d1
  47. TRANSFORM_COLS
  48. TRANSPOSE_4X4
  49. SWAP 1, 2
  50. psrldq m1, m0, 8
  51. psrldq m3, m2, 8
  52. TRANSFORM_COLS
  53. TRANSPOSE_4X4
  54. psllw m0, 2
  55. psllw m1, 2
  56. %if CONFIG_VP9_HIGHBITDEPTH
  57. ; sign extension
  58. mova m2, m0
  59. mova m3, m1
  60. punpcklwd m0, m0
  61. punpcklwd m1, m1
  62. punpckhwd m2, m2
  63. punpckhwd m3, m3
  64. psrad m0, 16
  65. psrad m1, 16
  66. psrad m2, 16
  67. psrad m3, 16
  68. mova [outputq], m0
  69. mova [outputq + 16], m2
  70. mova [outputq + 32], m1
  71. mova [outputq + 48], m3
  72. %else
  73. mova [outputq], m0
  74. mova [outputq + 16], m1
  75. %endif
  76. RET