1 /****************************************************************************
3 ** Copyright (C) 2012 MIPS Technologies, www.mips.com, author Damir Tatalovic <dtatalovic@mips.com>
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the QtGui module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
40 ****************************************************************************/
42 #ifndef QT_MIPS_ASM_DSP_H
43 #define QT_MIPS_ASM_DSP_H
46 #pragma qt_sync_stop_processing
84 * LEAF_MIPS32R2 - declare leaf_mips32r2 routine
86 #define LEAF_MIPS32R2(symbol) \
89 .type symbol,@function; \
91 symbol: .frame sp, 0, ra; \
96 * LEAF_MIPS_DSP - declare leaf_mips_dsp routine
98 #define LEAF_MIPS_DSP(symbol) \
99 LEAF_MIPS32R2(symbol) \
103 * LEAF_MIPS_DSPR2 - declare leaf_mips_dspr2 routine
105 #define LEAF_MIPS_DSPR2(symbol) \
106 LEAF_MIPS32R2(symbol) \
110 * END - mark end of function
112 #define END(function) \
115 .size function,.-function
118 * BYTE_MUL operation on two pixels (in_1 and in_2) with two
119 * multiplicator bytes, repl_a1 and repl_a2, which should be
121 * replv.ph repl_a1, a1
122 * replv.ph repl_a2, a2
124 * repl_a1 = | 00 | a1 | 00 | a1 |
125 * repl_a2 = | 00 | a2 | 00 | a2 |
127 * rounding_factor must have following value:
128 * li rounding_factor, 0x00800080
130 * scratch(n) - temporary registers
132 * in_const: 1 -> (default) causes that in_1, in_2
133 * registers will remain unchanged after usage
134 * 0 -> (or anything different then 1) causes
135 * that registers repl_a1, repl_a2 remain
136 * unchanged after usage
138 .macro BYTE_MUL_x2 in_1, in_2, out_1, out_2 \
139 repl_a1, repl_a2, rounding_factor, \
140 scratch1, scratch2, scratch3, scratch4, \
142 muleu_s.ph.qbl \scratch1, \in_1, \repl_a1
143 muleu_s.ph.qbr \scratch2, \in_1, \repl_a1
144 muleu_s.ph.qbl \scratch3, \in_2, \repl_a2
145 muleu_s.ph.qbr \scratch4, \in_2, \repl_a2
148 preceu.ph.qbla \repl_a1, \scratch1
149 preceu.ph.qbla \repl_a2, \scratch2
150 preceu.ph.qbla \out_1, \scratch3
151 preceu.ph.qbla \out_2, \scratch4
153 addu \scratch1, \repl_a1, \scratch1
154 addu \scratch2, \repl_a2, \scratch2
156 preceu.ph.qbla \in_1, \scratch1
157 preceu.ph.qbla \in_2, \scratch2
158 preceu.ph.qbla \out_1, \scratch3
159 preceu.ph.qbla \out_2, \scratch4
161 addu \scratch1, \in_1, \scratch1
162 addu \scratch2, \in_2, \scratch2
165 addu \out_1, \out_1, \scratch3
166 addu \out_2, \out_2, \scratch4
168 addu \scratch1, \scratch1, \rounding_factor
169 addu \scratch2, \scratch2, \rounding_factor
170 addu \scratch3, \out_1, \rounding_factor
171 addu \scratch4, \out_2, \rounding_factor
173 precrq.qb.ph \out_1, \scratch1, \scratch2
174 precrq.qb.ph \out_2, \scratch3, \scratch4
179 * BYTE_MUL operation on one pixel (in_1) with
180 * multiplicator byte, repl_a1, which should be
182 * replv.ph repl_a1, a1
184 * repl_a1 = | 00 | a1 | 00 | a1 |
186 * rounding_factor must have following value:
187 * li rounding_factor, 0x00800080
189 * scratch(n) - temporary registers
191 .macro BYTE_MUL in_1, out_1, \
192 repl_a1, rounding_factor, \
193 scratch1, scratch2, scratch3, scratch4
194 muleu_s.ph.qbl \scratch1, \in_1, \repl_a1
195 muleu_s.ph.qbr \scratch2, \in_1, \repl_a1
197 preceu.ph.qbla \scratch3, \scratch1
198 preceu.ph.qbla \scratch4, \scratch2
200 addu \scratch1, \scratch1, \scratch3
201 addu \scratch1, \scratch1, \rounding_factor
203 addu \scratch2, \scratch2, \scratch4
204 addu \scratch2, \scratch2, \rounding_factor
206 precrq.qb.ph \out_1, \scratch1, \scratch2
211 * macro for INTERPOLATE_PIXEL_255 operation
212 * in_1 - First value to multiply
213 * mul_1 - Multiplicator byte for first value
214 * in_2 - Second value to multiply
215 * mul_2 - Multiplicator byte for second value
216 * rounding_factor and andi_factor should be prepared
218 * li rounding_factor, 0x00800080
219 * li andi_factor, 0xff00ff00
220 * scratch(n) - temporary registers
222 .macro INTERPOLATE_PIXEL_255 in_1, mul_1, \
225 rounding_factor, andi_factor \
226 scratch1, scratch2, scratch3, scratch4
228 preceu.ph.qbra \scratch1, \in_1
229 preceu.ph.qbra \scratch2, \in_2
230 mul \scratch1, \scratch1, \mul_1
231 mul \scratch2, \scratch2, \mul_2
233 preceu.ph.qbla \scratch3, \in_1
234 preceu.ph.qbla \scratch4, \in_2
235 mul \scratch3, \scratch3, \mul_1
236 mul \scratch4, \scratch4, \mul_2
238 addu \scratch1, \scratch1, \scratch2
239 preceu.ph.qbla \scratch2, \scratch1
240 addu \scratch1, \scratch1, \scratch2
241 addu \scratch1, \scratch1, \rounding_factor
242 preceu.ph.qbla \scratch1, \scratch1
244 addu \scratch3, \scratch3, \scratch4
245 preceu.ph.qbla \scratch4, \scratch3
246 addu \scratch3, \scratch3, \scratch4
247 addu \scratch3, \scratch3, \rounding_factor
248 and \scratch3, \scratch3, \andi_factor
250 or \out_1, \scratch1, \scratch3
253 #endif // QT_MIPS_ASM_DSP_H