g722dsp.asm 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ;******************************************************************************
  2. ;* SIMD optimized DSP functions for G722 coding
  3. ;*
  4. ;* Copyright (c) 2014 James Almer
  5. ;*
  6. ;* This file is part of FFmpeg.
  7. ;*
  8. ;* FFmpeg 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. ;* FFmpeg 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 FFmpeg; 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_RODATA
  24. pw_qmf_coeffs: dw 3, -210, -11, -805, -11, 951, 53, 3876
  25. pw_qmf_coeffs2: dw 12, 3876, -156, 951, 32, -805, 362, -210
  26. pw_qmf_coeffs3: dw 362, 0 , 32, 0, -156, 0, 12, 0
  27. pw_qmf_coeffs4: dw 53, 0, -11, 0, -11, 0, 3, 0
  28. SECTION .text
  29. INIT_XMM sse2
  30. cglobal g722_apply_qmf, 2, 2, 5, prev, out
  31. movu m0, [prevq+mmsize*0]
  32. movu m1, [prevq+mmsize*1]
  33. movu m2, [prevq+mmsize*2]
  34. punpcklwd m3, m0, m1
  35. punpckhwd m0, m1
  36. punpcklwd m4, m2, m2
  37. punpckhwd m2, m2
  38. pmaddwd m3, [pw_qmf_coeffs ]
  39. pmaddwd m0, [pw_qmf_coeffs2]
  40. pmaddwd m4, [pw_qmf_coeffs3]
  41. pmaddwd m2, [pw_qmf_coeffs4]
  42. paddd m0, m3
  43. paddd m2, m4
  44. paddd m0, m2
  45. pshufd m2, m0, q0032
  46. paddd m0, m2
  47. pshufd m0, m0, q0001
  48. movq [outq], m0
  49. RET