Statistics
| Branch: | Revision:

ffmpeg / libavcodec / arm / ac3dsp_armv6.S @ 05c062e9

History | View | Annotate | Download (3.4 KB)

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

    
21
#include "asm.S"
22

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