You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.8KB

  1. /*
  2. * Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * Libav is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "config.h"
  21. #include "libavutil/arm/asm.S"
  22. /**
  23. * ARM VFP optimized float to int16 conversion.
  24. * Assume that len is a positive number and is multiple of 8, destination
  25. * buffer is at least 4 bytes aligned (8 bytes alignment is better for
  26. * performance), little endian byte sex
  27. */
  28. @ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len)
  29. function ff_float_to_int16_vfp, export=1
  30. push {r4-r8,lr}
  31. vpush {d8-d11}
  32. vldmia r1!, {s16-s23}
  33. vcvt.s32.f32 s0, s16
  34. vcvt.s32.f32 s1, s17
  35. vcvt.s32.f32 s2, s18
  36. vcvt.s32.f32 s3, s19
  37. vcvt.s32.f32 s4, s20
  38. vcvt.s32.f32 s5, s21
  39. vcvt.s32.f32 s6, s22
  40. vcvt.s32.f32 s7, s23
  41. 1:
  42. subs r2, r2, #8
  43. vmov r3, r4, s0, s1
  44. vmov r5, r6, s2, s3
  45. vmov r7, r8, s4, s5
  46. vmov ip, lr, s6, s7
  47. it gt
  48. vldmiagt r1!, {s16-s23}
  49. ssat r4, #16, r4
  50. ssat r3, #16, r3
  51. ssat r6, #16, r6
  52. ssat r5, #16, r5
  53. pkhbt r3, r3, r4, lsl #16
  54. pkhbt r4, r5, r6, lsl #16
  55. itttt gt
  56. vcvtgt.s32.f32 s0, s16
  57. vcvtgt.s32.f32 s1, s17
  58. vcvtgt.s32.f32 s2, s18
  59. vcvtgt.s32.f32 s3, s19
  60. itttt gt
  61. vcvtgt.s32.f32 s4, s20
  62. vcvtgt.s32.f32 s5, s21
  63. vcvtgt.s32.f32 s6, s22
  64. vcvtgt.s32.f32 s7, s23
  65. ssat r8, #16, r8
  66. ssat r7, #16, r7
  67. ssat lr, #16, lr
  68. ssat ip, #16, ip
  69. pkhbt r5, r7, r8, lsl #16
  70. pkhbt r6, ip, lr, lsl #16
  71. stmia r0!, {r3-r6}
  72. bgt 1b
  73. vpop {d8-d11}
  74. pop {r4-r8,pc}
  75. endfunc