|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtGui module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 /* Prevent the stack from becoming executable for no reason... */ |
|
43 #if defined(__linux__) && defined(__ELF__) |
|
44 .section .note.GNU-stack,"",%progbits |
|
45 #endif |
|
46 |
|
47 .text |
|
48 .fpu neon |
|
49 .arch armv7a |
|
50 .altmacro |
|
51 |
|
52 /* void blend_8_pixels_argb32_on_rgb16_neon(quint16 *dst, const quint32 *src, int const_alpha) */ |
|
53 |
|
54 .func blend_8_pixels_argb32_on_rgb16_neon |
|
55 .global blend_8_pixels_argb32_on_rgb16_neon |
|
56 /* For ELF format also set function visibility to hidden */ |
|
57 #ifdef __ELF__ |
|
58 .hidden blend_8_pixels_argb32_on_rgb16_neon |
|
59 .type blend_8_pixels_argb32_on_rgb16_neon, %function |
|
60 #endif |
|
61 blend_8_pixels_argb32_on_rgb16_neon: |
|
62 vld4.8 { d0, d1, d2, d3 }, [r1] |
|
63 vld1.16 { d4, d5 }, [r0] |
|
64 |
|
65 cmp r2, #256 |
|
66 beq .blend_32_inner |
|
67 |
|
68 vdup.8 d6, r2 |
|
69 |
|
70 /* multiply by const_alpha */ |
|
71 vmull.u8 q8, d6, d0 |
|
72 vmull.u8 q9, d6, d1 |
|
73 vmull.u8 q10, d6, d2 |
|
74 vmull.u8 q11, d6, d3 |
|
75 |
|
76 vshrn.u16 d0, q8, #8 |
|
77 vshrn.u16 d1, q9, #8 |
|
78 vshrn.u16 d2, q10, #8 |
|
79 vshrn.u16 d3, q11, #8 |
|
80 |
|
81 .blend_32_inner: |
|
82 /* convert 8 r5g6b5 pixel data from {d4, d5} to planar 8-bit format |
|
83 and put data into d6 - red, d7 - green, d30 - blue */ |
|
84 vshrn.u16 d6, q2, #8 |
|
85 vshrn.u16 d7, q2, #3 |
|
86 vsli.u16 q2, q2, #5 |
|
87 vsri.u8 d6, d6, #5 |
|
88 vmvn.8 d3, d3 |
|
89 vsri.u8 d7, d7, #6 |
|
90 vshrn.u16 d30, q2, #2 |
|
91 |
|
92 pld [r0, #128] |
|
93 |
|
94 /* now do alpha blending, storing results in 8-bit planar format |
|
95 into d16 - red, d19 - green, d18 - blue */ |
|
96 vmull.u8 q10, d3, d6 |
|
97 vmull.u8 q11, d3, d7 |
|
98 vmull.u8 q12, d3, d30 |
|
99 vrshr.u16 q13, q10, #8 |
|
100 vrshr.u16 q3, q11, #8 |
|
101 vrshr.u16 q15, q12, #8 |
|
102 vraddhn.u16 d20, q10, q13 |
|
103 vraddhn.u16 d23, q11, q3 |
|
104 vraddhn.u16 d22, q12, q15 |
|
105 vqadd.u8 d16, d2, d20 |
|
106 vqadd.u8 q9, q0, q11 |
|
107 /* convert the result to r5g6b5 and store it into {d28, d29} */ |
|
108 vshll.u8 q14, d16, #8 |
|
109 vshll.u8 q8, d19, #8 |
|
110 vshll.u8 q9, d18, #8 |
|
111 vsri.u16 q14, q8, #5 |
|
112 vsri.u16 q14, q9, #11 |
|
113 |
|
114 vst1.16 { d28, d29 }, [r0] |
|
115 |
|
116 bx lr |
|
117 |
|
118 .endfunc |
|
119 |
|
120 /* void blend_8_pixels_rgb16_on_rgb16_neon(quint16 *dst, const quint16 *src, int const_alpha) */ |
|
121 |
|
122 .func blend_8_pixels_rgb16_on_rgb16_neon |
|
123 .global blend_8_pixels_rgb16_on_rgb16_neon |
|
124 /* For ELF format also set function visibility to hidden */ |
|
125 #ifdef __ELF__ |
|
126 .hidden blend_8_pixels_rgb16_on_rgb16_neon |
|
127 .type blend_8_pixels_rgb16_on_rgb16_neon, %function |
|
128 #endif |
|
129 blend_8_pixels_rgb16_on_rgb16_neon: |
|
130 vld1.16 { d0, d1 }, [r0] |
|
131 vld1.16 { d2, d3 }, [r1] |
|
132 |
|
133 rsb r3, r2, #256 |
|
134 vdup.8 d4, r2 |
|
135 vdup.8 d5, r3 |
|
136 |
|
137 /* convert 8 r5g6b5 pixel data from {d0, d1} to planar 8-bit format |
|
138 and put data into d6 - red, d7 - green, d30 - blue */ |
|
139 vshrn.u16 d6, q0, #8 |
|
140 vshrn.u16 d7, q0, #3 |
|
141 vsli.u16 q0, q0, #5 |
|
142 vsri.u8 d6, d6, #5 |
|
143 vsri.u8 d7, d7, #6 |
|
144 vshrn.u16 d30, q0, #2 |
|
145 |
|
146 /* same from {d2, d3} into {d26, d27, d28} */ |
|
147 vshrn.u16 d26, q1, #8 |
|
148 vshrn.u16 d27, q1, #3 |
|
149 vsli.u16 q1, q1, #5 |
|
150 vsri.u8 d26, d26, #5 |
|
151 vsri.u8 d27, d27, #6 |
|
152 vshrn.u16 d28, q1, #2 |
|
153 |
|
154 /* multiply dst by inv const_alpha */ |
|
155 vmull.u8 q10, d5, d6 |
|
156 vmull.u8 q11, d5, d7 |
|
157 vmull.u8 q12, d5, d30 |
|
158 |
|
159 vshrn.u16 d6, q10, #8 |
|
160 vshrn.u16 d7, q11, #8 |
|
161 vshrn.u16 d30, q12, #8 |
|
162 |
|
163 /* multiply src by const_alpha */ |
|
164 vmull.u8 q10, d4, d26 |
|
165 vmull.u8 q11, d4, d27 |
|
166 vmull.u8 q12, d4, d28 |
|
167 |
|
168 vshrn.u16 d26, q10, #8 |
|
169 vshrn.u16 d27, q11, #8 |
|
170 vshrn.u16 d28, q12, #8 |
|
171 |
|
172 /* preload dst + 128 */ |
|
173 pld [r0, #128] |
|
174 |
|
175 /* add components, storing results in 8-bit planar format |
|
176 into d16 - red, d19 - green, d18 - blue */ |
|
177 vadd.u8 d16, d26, d6 |
|
178 vadd.u8 d19, d27, d7 |
|
179 vadd.u8 d18, d28, d30 |
|
180 |
|
181 /* convert the result to r5g6b5 and store it into {d28, d29} */ |
|
182 vshll.u8 q14, d16, #8 |
|
183 vshll.u8 q8, d19, #8 |
|
184 vshll.u8 q9, d18, #8 |
|
185 vsri.u16 q14, q8, #5 |
|
186 vsri.u16 q14, q9, #11 |
|
187 |
|
188 vst1.16 { d28, d29 }, [r0] |
|
189 |
|
190 bx lr |
|
191 |
|
192 .endfunc |