bitstream-a.S 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*****************************************************************************
  2. * bitstream-a.S: arm bitstream functions
  3. *****************************************************************************
  4. * Copyright (C) 2014-2018 x264 project
  5. *
  6. * Authors: Janne Grunau <janne-x264@jannau.net>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program 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
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
  21. *
  22. * This program is also available under a commercial proprietary license.
  23. * For more information, contact us at licensing@x264.com.
  24. *****************************************************************************/
  25. #include "asm.S"
  26. function nal_escape_neon
  27. push {r4-r5,lr}
  28. vmov.u8 q0, #0xff
  29. vmov.u8 q8, #4
  30. mov r3, #3
  31. subs lr, r1, r2
  32. beq 99f
  33. 0:
  34. cmn lr, #15
  35. blt 16f
  36. mov r1, r2
  37. b 100f
  38. 16:
  39. vld1.8 {q1}, [r1]!
  40. vext.8 q2, q0, q1, #14
  41. vext.8 q3, q0, q1, #15
  42. vcgt.u8 q11, q8, q1
  43. vceq.u8 q9, q2, #0
  44. vceq.u8 q10, q3, #0
  45. vand q9, q9, q11
  46. vand q9, q9, q10
  47. vshrn.u16 d22, q9, #4
  48. vmov ip, lr, d22
  49. orrs ip, ip, lr
  50. beq 16f
  51. mov lr, #-16
  52. 100:
  53. vmov.u8 r5, d1[6]
  54. vmov.u8 r4, d1[7]
  55. orr r5, r4, r5, lsl #8
  56. 101:
  57. ldrb r4, [r1, lr]
  58. orr ip, r4, r5, lsl #16
  59. cmp ip, #3
  60. bhi 102f
  61. strb r3, [r0], #1
  62. orr r5, r3, r5, lsl #8
  63. 102:
  64. adds lr, lr, #1
  65. strb r4, [r0], #1
  66. orr r5, r4, r5, lsl #8
  67. blt 101b
  68. subs lr, r1, r2
  69. lsr ip, r5, #8
  70. vmov.u8 d1[6], ip
  71. vmov.u8 d1[7], r5
  72. blt 0b
  73. pop {r4-r5,pc}
  74. 16:
  75. subs lr, r1, r2
  76. vst1.8 {q1}, [r0]!
  77. vmov q0, q1
  78. blt 0b
  79. 99:
  80. pop {r4-r5,pc}
  81. endfunc