Rearange menu of mpegplayer. Add new menu with "settings" and "quit", and remove...
[kugel-rb.git] / apps / plugins / mpegplayer / motion_comp_arm_s.S
blob36c3fec06a61cc4694bf3e65c8668669966e6df4
1 @ motion_comp_arm_s.S
2 @ Copyright (C) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
4 @ This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
5 @ See http://libmpeg2.sourceforge.net/ for updates.
7 @ mpeg2dec is free software; you can redistribute it and/or modify
8 @ it under the terms of the GNU General Public License as published by
9 @ the Free Software Foundation; either version 2 of the License, or
10 @ (at your option) any later version.
12 @ mpeg2dec is distributed in the hope that it will be useful,
13 @ but WITHOUT ANY WARRANTY; without even the implied warranty of
14 @ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 @ GNU General Public License for more details.
17 @ You should have received a copy of the GNU General Public License
18 @ along with this program; if not, write to the Free Software
19 @ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 @ $Id$
23         .text
24         
25 @ ----------------------------------------------------------------
26         .align
27         .global MC_put_o_16
28 MC_put_o_16:
29         @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
30         @@ pld [r1]
31         stmfd sp!, {r4-r11, lr} @ R14 is also called LR
32         and r4, r1, #3
33         adr r5, MC_put_o_16_align_jt
34         add r5, r5, r4, lsl #2
35         ldr pc, [r5]
37 MC_put_o_16_align0:
38         ldmia r1, {r4-r7}
39         add r1, r1, r2
40         @@ pld [r1]
41         stmia r0, {r4-r7}
42         subs r3, r3, #1
43         add r0, r0, r2
44         bne MC_put_o_16_align0
45         ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
47 .macro  PROC shift
48         ldmia r1, {r4-r8}
49         add r1, r1, r2
50         mov r9, r4, lsr #(\shift)
51         @@ pld [r1]
52         mov r10, r5, lsr #(\shift)
53         orr r9, r9, r5, lsl #(32-\shift)
54         mov r11, r6, lsr #(\shift)
55         orr r10, r10, r6, lsl #(32-\shift)
56         mov r12, r7, lsr #(\shift)
57         orr r11, r11, r7, lsl #(32-\shift)
58         orr r12, r12, r8, lsl #(32-\shift)
59         stmia r0, {r9-r12}
60         subs r3, r3, #1
61         add r0, r0, r2
62 .endm
64 MC_put_o_16_align1:
65         and r1, r1, #0xFFFFFFFC
66 1:      PROC(8)
67         bne 1b
68         ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
69 MC_put_o_16_align2:
70         and r1, r1, #0xFFFFFFFC
71 1:      PROC(16)
72         bne 1b
73         ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
74 MC_put_o_16_align3:
75         and r1, r1, #0xFFFFFFFC
76 1:      PROC(24)
77         bne 1b
78         ldmfd sp!, {r4-r11, pc} @@ update PC with LR content.
79 MC_put_o_16_align_jt:
80         .word MC_put_o_16_align0
81         .word MC_put_o_16_align1
82         .word MC_put_o_16_align2
83         .word MC_put_o_16_align3
85 @ ----------------------------------------------------------------
86         .align
87         .global MC_put_o_8
88 MC_put_o_8:
89         @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
90         @@ pld [r1]
91         stmfd sp!, {r4-r10, lr} @ R14 is also called LR
92         and r4, r1, #3
93         adr r5, MC_put_o_8_align_jt
94         add r5, r5, r4, lsl #2
95         ldr pc, [r5]
96 MC_put_o_8_align0:
97         ldmia r1, {r4-r5}
98         add r1, r1, r2
99         @@ pld [r1]
100         stmia r0, {r4-r5}
101         add r0, r0, r2
102         subs r3, r3, #1
103         bne MC_put_o_8_align0
104         ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
106 .macro  PROC8 shift
107         ldmia r1, {r4-r6}
108         add r1, r1, r2
109         mov r9, r4, lsr #(\shift)
110         @@ pld [r1]
111         mov r10, r5, lsr #(\shift)
112         orr r9, r9, r5, lsl #(32-\shift)
113         orr r10, r10, r6, lsl #(32-\shift)
114         stmia r0, {r9-r10}
115         subs r3, r3, #1
116         add r0, r0, r2
117 .endm
119 MC_put_o_8_align1:
120         and r1, r1, #0xFFFFFFFC
121 1:      PROC8(8)
122         bne 1b
123         ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
125 MC_put_o_8_align2:
126         and r1, r1, #0xFFFFFFFC
127 1:      PROC8(16)
128         bne 1b
129         ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
131 MC_put_o_8_align3:
132         and r1, r1, #0xFFFFFFFC
133 1:      PROC8(24)
134         bne 1b
135         ldmfd sp!, {r4-r10, pc} @@ update PC with LR content.
137 MC_put_o_8_align_jt:
138         .word MC_put_o_8_align0
139         .word MC_put_o_8_align1
140         .word MC_put_o_8_align2
141         .word MC_put_o_8_align3
143 @ ----------------------------------------------------------------
144 .macro  AVG_PW rW1, rW2
145         mov \rW2, \rW2, lsl #24
146         orr \rW2, \rW2, \rW1, lsr #8
147         eor r9, \rW1, \rW2
148         and \rW2, \rW1, \rW2
149         and r10, r9, r12
150         add \rW2, \rW2, r10, lsr #1
151         and r10, r9, r11
152         add \rW2, \rW2, r10
153 .endm
155         .align
156         .global MC_put_x_16
157 MC_put_x_16:
158         @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
159         @@ pld [r1]
160         stmfd sp!, {r4-r11,lr} @ R14 is also called LR
161         and r4, r1, #3
162         adr r5, MC_put_x_16_align_jt
163         ldr r11, [r5]
164         mvn r12, r11
165         add r5, r5, r4, lsl #2
166         ldr pc, [r5, #4]
168 .macro  ADJ_ALIGN_QW shift, R0, R1, R2, R3, R4
169         mov \R0, \R0, lsr #(\shift)
170         orr \R0, \R0, \R1, lsl #(32 - \shift)
171         mov \R1, \R1, lsr #(\shift)
172         orr \R1, \R1, \R2, lsl #(32 - \shift)
173         mov \R2, \R2, lsr #(\shift)
174         orr \R2, \R2, \R3, lsl #(32 - \shift)
175         mov \R3, \R3, lsr #(\shift)
176         orr \R3, \R3, \R4, lsl #(32 - \shift)
177         mov \R4, \R4, lsr #(\shift)
178 @       and \R4, \R4, #0xFF
179 .endm
181 MC_put_x_16_align0:
182         ldmia r1, {r4-r8}
183         add r1, r1, r2
184         @@ pld [r1]
185         AVG_PW r7, r8
186         AVG_PW r6, r7
187         AVG_PW r5, r6
188         AVG_PW r4, r5
189         stmia r0, {r5-r8}
190         subs r3, r3, #1
191         add r0, r0, r2
192         bne MC_put_x_16_align0
193         ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
194 MC_put_x_16_align1:
195         and r1, r1, #0xFFFFFFFC
196 1:      ldmia r1, {r4-r8}
197         add r1, r1, r2
198         @@ pld [r1]
199         ADJ_ALIGN_QW 8, r4, r5, r6, r7, r8
200         AVG_PW r7, r8
201         AVG_PW r6, r7
202         AVG_PW r5, r6
203         AVG_PW r4, r5
204         stmia r0, {r5-r8}
205         subs r3, r3, #1
206         add r0, r0, r2
207         bne 1b
208         ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
209 MC_put_x_16_align2:
210         and r1, r1, #0xFFFFFFFC
211 1:      ldmia r1, {r4-r8}
212         add r1, r1, r2
213         @@ pld [r1]
214         ADJ_ALIGN_QW 16, r4, r5, r6, r7, r8
215         AVG_PW r7, r8
216         AVG_PW r6, r7
217         AVG_PW r5, r6
218         AVG_PW r4, r5
219         stmia r0, {r5-r8}
220         subs r3, r3, #1
221         add r0, r0, r2
222         bne 1b
223         ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
224 MC_put_x_16_align3:
225         and r1, r1, #0xFFFFFFFC
226 1:      ldmia r1, {r4-r8}
227         add r1, r1, r2
228         @@ pld [r1]
229         ADJ_ALIGN_QW 24, r4, r5, r6, r7, r8
230         AVG_PW r7, r8
231         AVG_PW r6, r7
232         AVG_PW r5, r6
233         AVG_PW r4, r5
234         stmia r0, {r5-r8}
235         subs r3, r3, #1
236         add r0, r0, r2
237         bne 1b
238         ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
239 MC_put_x_16_align_jt:
240         .word 0x01010101
241         .word MC_put_x_16_align0
242         .word MC_put_x_16_align1
243         .word MC_put_x_16_align2
244         .word MC_put_x_16_align3
246 @ ----------------------------------------------------------------
247         .align
248         .global MC_put_x_8
249 MC_put_x_8:
250         @@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
251         @@ pld [r1]
252         stmfd sp!, {r4-r11,lr} @ R14 is also called LR
253         and r4, r1, #3
254         adr r5, MC_put_x_8_align_jt
255         ldr r11, [r5]
256         mvn r12, r11
257         add r5, r5, r4, lsl #2
258         ldr pc, [r5, #4]
260 .macro  ADJ_ALIGN_DW shift, R0, R1, R2
261         mov \R0, \R0, lsr #(\shift)
262         orr \R0, \R0, \R1, lsl #(32 - \shift)
263         mov \R1, \R1, lsr #(\shift)
264         orr \R1, \R1, \R2, lsl #(32 - \shift)
265         mov \R2, \R2, lsr #(\shift)
266 @       and \R4, \R4, #0xFF
267 .endm
269 MC_put_x_8_align0:
270         ldmia r1, {r4-r6}
271         add r1, r1, r2
272         @@ pld [r1]
273         AVG_PW r5, r6
274         AVG_PW r4, r5
275         stmia r0, {r5-r6}
276         subs r3, r3, #1
277         add r0, r0, r2
278         bne MC_put_x_8_align0
279         ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
280 MC_put_x_8_align1:
281         and r1, r1, #0xFFFFFFFC
282 1:      ldmia r1, {r4-r6}
283         add r1, r1, r2
284         @@ pld [r1]
285         ADJ_ALIGN_DW 8, r4, r5, r6
286         AVG_PW r5, r6
287         AVG_PW r4, r5
288         stmia r0, {r5-r6}
289         subs r3, r3, #1
290         add r0, r0, r2
291         bne 1b
292         ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
293 MC_put_x_8_align2:
294         and r1, r1, #0xFFFFFFFC
295 1:      ldmia r1, {r4-r6}
296         add r1, r1, r2
297         @@ pld [r1]
298         ADJ_ALIGN_DW 16, r4, r5, r6
299         AVG_PW r5, r6
300         AVG_PW r4, r5
301         stmia r0, {r5-r6}
302         subs r3, r3, #1
303         add r0, r0, r2
304         bne 1b
305         ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
306 MC_put_x_8_align3:
307         and r1, r1, #0xFFFFFFFC
308 1:      ldmia r1, {r4-r6}
309         add r1, r1, r2
310         @@ pld [r1]
311         ADJ_ALIGN_DW 24, r4, r5, r6
312         AVG_PW r5, r6
313         AVG_PW r4, r5
314         stmia r0, {r5-r6}
315         subs r3, r3, #1
316         add r0, r0, r2
317         bne 1b
318         ldmfd sp!, {r4-r11,pc} @@ update PC with LR content.
319 MC_put_x_8_align_jt:
320         .word 0x01010101
321         .word MC_put_x_8_align0
322         .word MC_put_x_8_align1
323         .word MC_put_x_8_align2
324         .word MC_put_x_8_align3