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.

85 lines
3.4KB

  1. /*
  2. * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
  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 "libavutil/arm/asm.S"
  21. function ff_ac3_bit_alloc_calc_bap_armv6, export=1
  22. ldr r12, [sp]
  23. cmp r12, #-960
  24. beq 4f
  25. push {r4-r11,lr}
  26. add r5, sp, #40
  27. movrelx r4, X(ff_ac3_bin_to_band_tab), r11
  28. movrelx lr, X(ff_ac3_band_start_tab)
  29. ldm r5, {r5-r7}
  30. ldrb r4, [r4, r2]
  31. add r1, r1, r2, lsl #1 @ psd + start
  32. add r0, r0, r4, lsl #1 @ mask + band
  33. add r4, lr, r4
  34. add r7, r7, r2 @ bap + start
  35. 1:
  36. ldrsh r9, [r0], #2 @ mask[band]
  37. mov r8, #0xff0
  38. sub r9, r9, r12 @ - snr_offset
  39. ldrb r10, [r4, #1]! @ band_start_tab[++band]
  40. subs r9, r9, r5 @ - floor
  41. it lt
  42. movlt r9, #0
  43. cmp r10, r3 @ - end
  44. and r9, r9, r8, lsl #1 @ & 0x1fe0
  45. ite gt
  46. subgt r8, r3, r2
  47. suble r8, r10, r2
  48. mov r2, r10
  49. add r9, r9, r5 @ + floor => m
  50. tst r8, #1
  51. add r11, r7, r8
  52. bne 3f
  53. b 5f
  54. 2:
  55. ldrsh r8, [r1], #2
  56. ldrsh lr, [r1], #2
  57. sub r8, r8, r9
  58. sub lr, lr, r9
  59. usat r8, #6, r8, asr #5 @ address
  60. usat lr, #6, lr, asr #5
  61. ldrb r8, [r6, r8] @ bap_tab[address]
  62. ldrb lr, [r6, lr]
  63. strb r8, [r7], #1 @ bap[bin]
  64. strb lr, [r7], #1
  65. 5: cmp r7, r11
  66. blo 2b
  67. cmp r3, r10
  68. bgt 1b
  69. pop {r4-r11,pc}
  70. 3:
  71. ldrsh r8, [r1], #2 @ psd[bin]
  72. sub r8, r8, r9 @ - m
  73. usat r8, #6, r8, asr #5 @ address
  74. ldrb r8, [r6, r8] @ bap_tab[address]
  75. strb r8, [r7], #1 @ bap[bin]
  76. b 5b
  77. 4:
  78. ldr r0, [sp, #12]
  79. mov r1, #0
  80. mov r2, #256
  81. b X(memset)
  82. endfunc