comparison arm/mpegvideo_neon.S @ 11797:77243f47f39e libavcodec

ARM: NEON optimised dct_unquantize_h263_{intra,inter}
author mru
date Sat, 29 May 2010 15:29:40 +0000
parents
children fda5ab5d31bb
comparison
equal deleted inserted replaced
11796:f917cd286e41 11797:77243f47f39e
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 #define Y_DC_SCALE 0xa54
24 #define C_DC_SCALE 0xa58
25 #define AC_PRED 0xa80
26 #define BLOCK_LAST_INDEX 0x2278
27 #define INTER_SCANTAB_RASTER_END 0x2478
28 #define H263_AIC 0x2728
29
30 function ff_dct_unquantize_h263_inter_neon, export=1
31 add r0, r0, #0x2200
32 add r12, r0, #BLOCK_LAST_INDEX-0x2200
33 ldr r12, [r12, r2, lsl #2]
34 add r0, r0, #INTER_SCANTAB_RASTER_END-0x2200
35 ldrb r12, [r0, r12]
36 sub r2, r3, #1
37 lsl r0, r3, #1
38 orr r2, r2, #1
39 add r3, r12, #1
40 endfunc
41
42 function ff_dct_unquantize_h263_neon, export=1
43 vdup.16 q15, r0 @ qmul
44 vdup.16 q14, r2 @ qadd
45 vneg.s16 q13, q14
46 cmp r3, #4
47 mov r0, r1
48 ble 2f
49 1:
50 vld1.16 {q0}, [r0,:128]!
51 vclt.s16 q3, q0, #0
52 vld1.16 {q8}, [r0,:128]!
53 vceq.s16 q1, q0, #0
54 vmul.s16 q2, q0, q15
55 vclt.s16 q11, q8, #0
56 vmul.s16 q10, q8, q15
57 vbsl q3, q13, q14
58 vbsl q11, q13, q14
59 vadd.s16 q2, q2, q3
60 vceq.s16 q9, q8, #0
61 vadd.s16 q10, q10, q11
62 vbif q0, q2, q1
63 vbif q8, q10, q9
64 subs r3, r3, #16
65 vst1.16 {q0}, [r1,:128]!
66 vst1.16 {q8}, [r1,:128]!
67 bxle lr
68 cmp r3, #8
69 bgt 1b
70 2:
71 vld1.16 {d0}, [r0,:64]
72 vclt.s16 d3, d0, #0
73 vceq.s16 d1, d0, #0
74 vmul.s16 d2, d0, d30
75 vbsl d3, d26, d28
76 vadd.s16 d2, d2, d3
77 vbif d0, d2, d1
78 vst1.16 {d0}, [r1,:64]
79 bx lr
80 endfunc
81
82 function ff_dct_unquantize_h263_intra_neon, export=1
83 push {r4-r6,lr}
84 ldr r6, [r0, #AC_PRED]
85 add r5, r0, #0x2700
86 cmp r6, #0
87 movne r12, #63
88 bne 1f
89 add lr, r0, #0x2200
90 add r12, lr, #BLOCK_LAST_INDEX-0x2200
91 add lr, lr, #INTER_SCANTAB_RASTER_END-0x2200
92 ldr r12, [r12, r2, lsl #2]
93 ldrb r12, [lr, r12]
94 1: ldr r5, [r5, #H263_AIC-0x2700]
95 ldrsh r4, [r1]
96 cmp r5, #0
97 mov r5, r1
98 movne r2, #0
99 bne 2f
100 cmp r2, #4
101 addge r0, r0, #4
102 sub r2, r3, #1
103 ldr r6, [r0, #Y_DC_SCALE]
104 orr r2, r2, #1
105 smulbb r4, r4, r6
106 2: lsl r0, r3, #1
107 add r3, r12, #1
108 bl ff_dct_unquantize_h263_neon
109 vmov.16 d0[0], r4
110 vst1.16 {d0[0]}, [r5]
111 pop {r4-r6,pc}
112 endfunc