af_afir.asm 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ;*****************************************************************************
  2. ;* x86-optimized functions for afir filter
  3. ;* Copyright (c) 2017 Paul B Mahol
  4. ;*
  5. ;* This file is part of FFmpeg.
  6. ;*
  7. ;* FFmpeg is free software; you can redistribute it and/or
  8. ;* modify it under the terms of the GNU Lesser General Public
  9. ;* License as published by the Free Software Foundation; either
  10. ;* version 2.1 of the License, or (at your option) any later version.
  11. ;*
  12. ;* FFmpeg is distributed in the hope that it will be useful,
  13. ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. ;* Lesser General Public License for more details.
  16. ;*
  17. ;* You should have received a copy of the GNU Lesser General Public
  18. ;* License along with FFmpeg; if not, write to the Free Software
  19. ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. ;******************************************************************************
  21. %include "libavutil/x86/x86util.asm"
  22. SECTION .text
  23. ;------------------------------------------------------------------------------
  24. ; void ff_fcmul_add(float *sum, const float *t, const float *c, int len)
  25. ;------------------------------------------------------------------------------
  26. %macro FCMUL_ADD 0
  27. cglobal fcmul_add, 4,4,6, sum, t, c, len
  28. shl lend, 3
  29. add tq, lenq
  30. add cq, lenq
  31. add sumq, lenq
  32. neg lenq
  33. ALIGN 16
  34. .loop:
  35. movsldup m0, [tq + lenq]
  36. movsldup m3, [tq + lenq+mmsize]
  37. movaps m1, [cq + lenq]
  38. movaps m4, [cq + lenq+mmsize]
  39. mulps m0, m0, m1
  40. mulps m3, m3, m4
  41. shufps m1, m1, m1, 0xb1
  42. shufps m4, m4, m4, 0xb1
  43. movshdup m2, [tq + lenq]
  44. movshdup m5, [tq + lenq+mmsize]
  45. mulps m2, m2, m1
  46. mulps m5, m5, m4
  47. addsubps m0, m0, m2
  48. addsubps m3, m3, m5
  49. addps m0, m0, [sumq + lenq]
  50. addps m3, m3, [sumq + lenq+mmsize]
  51. movaps [sumq + lenq], m0
  52. movaps [sumq + lenq+mmsize], m3
  53. add lenq, mmsize*2
  54. jl .loop
  55. movss xm0, [tq + lenq]
  56. mulss xm0, [cq + lenq]
  57. addss xm0, [sumq + lenq]
  58. movss [sumq + lenq], xm0
  59. RET
  60. %endmacro
  61. INIT_XMM sse3
  62. FCMUL_ADD
  63. INIT_YMM avx
  64. FCMUL_ADD