Browse code

ac3enc: ARM optimised ac3_compute_matissa_size

Signed-off-by: Mans Rullgard <mans@mansr.com>

Mans Rullgard authored on 2011/03/12 02:25:45
Showing 3 changed files
... ...
@@ -1,4 +1,6 @@
1
-OBJS-$(CONFIG_AC3DSP)                  += arm/ac3dsp_init_arm.o
1
+OBJS-$(CONFIG_AC3DSP)                  += arm/ac3dsp_init_arm.o         \
2
+                                          arm/ac3dsp_arm.o
3
+
2 4
 OBJS-$(CONFIG_DCA_DECODER)             += arm/dcadsp_init_arm.o         \
3 5
 
4 6
 ARMV6-OBJS-$(CONFIG_AC3DSP)            += arm/ac3dsp_armv6.o
5 7
new file mode 100644
... ...
@@ -0,0 +1,52 @@
0
+/*
1
+ * Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
2
+ *
3
+ * This file is part of Libav.
4
+ *
5
+ * Libav is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * Libav is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with Libav; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+#include "asm.S"
21
+
22
+function ff_ac3_compute_mantissa_size_arm, export=1
23
+        push            {r4-r8,lr}
24
+        ldm             r0,  {r4-r8}
25
+        mov             r3,  r0
26
+        mov             r0,  #0
27
+1:
28
+        ldrb            lr,  [r1], #1
29
+        subs            r2,  r2,  #1
30
+        blt             2f
31
+        cmp             lr,  #4
32
+        bgt             3f
33
+        subs            lr,  lr,  #1
34
+        addlt           r4,  r4,  #1
35
+        addeq           r5,  r5,  #1
36
+        ble             1b
37
+        subs            lr,  lr,  #2
38
+        addlt           r6,  r6,  #1
39
+        addeq           r7,  r7,  #1
40
+        addgt           r8,  r8,  #1
41
+        b               1b
42
+3:
43
+        cmp             lr,  #14
44
+        sublt           lr,  lr,  #1
45
+        addgt           r0,  r0,  #16
46
+        addle           r0,  r0,  lr
47
+        b               1b
48
+2:
49
+        stm             r3,  {r4-r8}
50
+        pop             {r4-r8,pc}
51
+endfunc
... ...
@@ -34,8 +34,12 @@ void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd,
34 34
                                      int snr_offset, int floor,
35 35
                                      const uint8_t *bap_tab, uint8_t *bap);
36 36
 
37
+int ff_ac3_compute_mantissa_size_arm(int cnt[5], uint8_t *bap, int nb_coefs);
38
+
37 39
 av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
38 40
 {
41
+    c->compute_mantissa_size     = ff_ac3_compute_mantissa_size_arm;
42
+
39 43
     if (HAVE_ARMV6) {
40 44
         c->bit_alloc_calc_bap    = ff_ac3_bit_alloc_calc_bap_armv6;
41 45
     }