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.

78 lines
2.7KB

  1. /*
  2. * Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg 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. * FFmpeg 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 FFmpeg; 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 "asm.S"
  22. .syntax unified
  23. /**
  24. * ARM VFP optimized float to int16 conversion.
  25. * Assume that len is a positive number and is multiple of 8, destination
  26. * buffer is at least 4 bytes aligned (8 bytes alignment is better for
  27. * performance), little endian byte sex
  28. */
  29. @ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len)
  30. function ff_float_to_int16_vfp, export=1
  31. push {r4-r8,lr}
  32. vpush {d8-d11}
  33. vldmia r1!, {s16-s23}
  34. vcvt.s32.f32 s0, s16
  35. vcvt.s32.f32 s1, s17
  36. vcvt.s32.f32 s2, s18
  37. vcvt.s32.f32 s3, s19
  38. vcvt.s32.f32 s4, s20
  39. vcvt.s32.f32 s5, s21
  40. vcvt.s32.f32 s6, s22
  41. vcvt.s32.f32 s7, s23
  42. 1:
  43. subs r2, r2, #8
  44. vmov r3, r4, s0, s1
  45. vmov r5, r6, s2, s3
  46. vmov r7, r8, s4, s5
  47. vmov ip, lr, s6, s7
  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. vcvtgt.s32.f32 s0, s16
  56. vcvtgt.s32.f32 s1, s17
  57. vcvtgt.s32.f32 s2, s18
  58. vcvtgt.s32.f32 s3, s19
  59. vcvtgt.s32.f32 s4, s20
  60. vcvtgt.s32.f32 s5, s21
  61. vcvtgt.s32.f32 s6, s22
  62. vcvtgt.s32.f32 s7, s23
  63. ssat r8, #16, r8
  64. ssat r7, #16, r7
  65. ssat lr, #16, lr
  66. ssat ip, #16, ip
  67. pkhbt r5, r7, r8, lsl #16
  68. pkhbt r6, ip, lr, lsl #16
  69. stmia r0!, {r3-r6}
  70. bgt 1b
  71. vpop {d8-d11}
  72. pop {r4-r8,pc}
  73. endfunc