Statistics
| Branch: | Revision:

ffmpeg / libavcodec / arm / vp8_armv6.S @ 4ae3ee4a

History | View | Annotate | Download (7.61 KB)

1
/**
2
 * Copyright (C) 2010 Mans Rullgard
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

    
21
#include "asm.S"
22

    
23
        .syntax         unified
24

    
25
.macro rac_get_prob     h, bs, buf, cw, pr, t0, t1
26
        adds            \bs, \bs, \t0
27
        lsl             \cw, \cw, \t0
28
        lsl             \t0, \h,  \t0
29
        rsb             \h,  \pr, #256
30
        ldrhcs          \t1, [\buf], #2
31
        smlabb          \h,  \t0, \pr, \h
32
        rev16cs         \t1, \t1
33
        orrcs           \cw, \cw, \t1, lsl \bs
34
        subcs           \bs, \bs, #16
35
        lsr             \h,  \h,  #8
36
        cmp             \cw, \h,  lsl #16
37
        subge           \cw, \cw, \h,  lsl #16
38
        subge           \h,  \t0, \h
39
.endm
40

    
41
.macro rac_get_128      h, bs, buf, cw, t0, t1
42
        adds            \bs, \bs, \t0
43
        lsl             \cw, \cw, \t0
44
        lsl             \t0, \h,  \t0
45
        ldrhcs          \t1, [\buf], #2
46
        mov             \h,  #128
47
        rev16cs         \t1, \t1
48
        add             \h,  \h,  \t0, lsl #7
49
        orrcs           \cw, \cw, \t1, lsl \bs
50
        subcs           \bs, \bs, #16
51
        lsr             \h,  \h,  #8
52
        cmp             \cw, \h,  lsl #16
53
        subge           \cw, \cw, \h,  lsl #16
54
        subge           \h,  \t0, \h
55
.endm
56

    
57
function ff_decode_block_coeffs_armv6, export=1
58
        push            {r0,r1,r4-r11,lr}
59
        movrel          lr,  ff_vp56_norm_shift
60
        ldrd            r4,  r5,  [sp, #44]             @ token_prob, qmul
61
        cmp             r3,  #0
62
        ldr             r11, [r5]
63
        ldm             r0,  {r5-r7}                    @ high, bits, buf
64
        pkhtbne         r11, r11, r11, asr #16
65
        ldr             r8,  [r0, #16]                  @ code_word
66
0:
67
        ldrb            r9,  [lr, r5]
68
        add             r3,  r3,  #1
69
        ldrb            r0,  [r4, #1]
70
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
71
        blt             2f
72

    
73
        ldrb            r9,  [lr, r5]
74
        ldrb            r0,  [r4, #2]
75
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
76
        ldrb            r9,  [lr, r5]
77
        bge             3f
78

    
79
        add             r4,  r3,  r3,  lsl #5
80
        sxth            r12, r11
81
        add             r4,  r2,  r4
82
        adds            r6,  r6,  r9
83
        add             r4,  r4,  #11
84
        lsl             r8,  r8,  r9
85
        ldrhcs          r10, [r7], #2
86
        lsl             r9,  r5,  r9
87
        mov             r5,  #128
88
        rev16cs         r10, r10
89
        add             r5,  r5,  r9,  lsl #7
90
        orrcs           r8,  r8,  r10, lsl r6
91
        subcs           r6,  r6,  #16
92
        lsr             r5,  r5,  #8
93
        cmp             r8,  r5,  lsl #16
94
        movrel          r10, zigzag_scan-1
95
        subge           r8,  r8,  r5,  lsl #16
96
        subge           r5,  r9,  r5
97
        ldrb            r10, [r10, r3]
98
        rsbge           r12, r12, #0
99
        cmp             r3,  #16
100
        strh            r12, [r1, r10]
101
        bge             6f
102
5:
103
        ldrb            r9,  [lr, r5]
104
        ldrb            r0,  [r4]
105
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
106
        pkhtb           r11, r11, r11, asr #16
107
        bge             0b
108

    
109
6:
110
        ldr             r0,  [sp]
111
        ldr             r9,  [r0, #12]
112
        cmp             r7,  r9
113
        movhi           r7,  r9
114
        stm             r0,  {r5-r7}                    @ high, bits, buf
115
        str             r8,  [r0, #16]                  @ code_word
116

    
117
        add             sp,  sp,  #8
118
        mov             r0,  r3
119
        pop             {r4-r11,pc}
120
2:
121
        add             r4,  r3,  r3,  lsl #5
122
        cmp             r3,  #16
123
        add             r4,  r2,  r4
124
        pkhtb           r11, r11, r11, asr #16
125
        bne             0b
126
        b               6b
127
3:
128
        ldrb            r0,  [r4, #3]
129
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
130
        ldrb            r9,  [lr, r5]
131
        bge             1f
132

    
133
        mov             r12, #2
134
        ldrb            r0,  [r4, #4]
135
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
136
        addge           r12, #1
137
        ldrb            r9,  [lr, r5]
138
        blt             4f
139
        ldrb            r0,  [r4, #5]
140
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
141
        addge           r12, #1
142
        ldrb            r9,  [lr, r5]
143
        b               4f
144
1:
145
        ldrb            r0,  [r4, #6]
146
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
147
        ldrb            r9,  [lr, r5]
148
        bge             3f
149

    
150
        ldrb            r0,  [r4, #7]
151
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
152
        ldrb            r9,  [lr, r5]
153
        bge             2f
154

    
155
        mov             r12, #5
156
        mov             r0,  #159
157
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
158
        addge           r12, r12, #1
159
        ldrb            r9,  [lr, r5]
160
        b               4f
161
2:
162
        mov             r12, #7
163
        mov             r0,  #165
164
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
165
        addge           r12, r12, #2
166
        ldrb            r9,  [lr, r5]
167
        mov             r0,  #145
168
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
169
        addge           r12, r12, #1
170
        ldrb            r9,  [lr, r5]
171
        b               4f
172
3:
173
        ldrb            r0,  [r4, #8]
174
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
175
        addge           r4,  r4,  #1
176
        ldrb            r9,  [lr, r5]
177
        movge           r12, #2
178
        movlt           r12, #0
179
        ldrb            r0,  [r4, #9]
180
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
181
        mov             r9,  #8
182
        addge           r12, r12, #1
183
        movrel          r4,  ff_vp8_dct_cat_prob
184
        lsl             r9,  r9,  r12
185
        ldr             r4,  [r4, r12, lsl #2]
186
        add             r12, r9,  #3
187
        mov             r1,  #0
188
        ldrb            r0,  [r4], #1
189
1:
190
        ldrb            r9,  [lr, r5]
191
        lsl             r1,  r1,  #1
192
        rac_get_prob    r5,  r6,  r7,  r8,  r0,  r9,  r10
193
        ldrb            r0,  [r4], #1
194
        addge           r1,  r1,  #1
195
        cmp             r0,  #0
196
        bne             1b
197
        ldrb            r9,  [lr, r5]
198
        add             r12, r12, r1
199
        ldr             r1,  [sp, #4]
200
4:
201
        add             r4,  r3,  r3,  lsl #5
202
        add             r4,  r2,  r4
203
        add             r4,  r4,  #22
204
        rac_get_128     r5,  r6,  r7,  r8,  r9,  r10
205
        rsbge           r12, r12, #0
206
        smulbb          r12, r12, r11
207
        movrel          r9,  zigzag_scan-1
208
        ldrb            r9,  [r9, r3]
209
        cmp             r3,  #16
210
        strh            r12, [r1, r9]
211
        bge             6b
212
        b               5b
213
endfunc
214

    
215
        .section        .rodata
216
zigzag_scan:
217
        .byte            0,  2,  8, 16
218
        .byte           10,  4,  6, 12
219
        .byte           18, 24, 26, 20
220
        .byte           14, 22, 28, 30