itrans32_cols_dspr2.c revision 7ce0a1d1337c01056ba24006efab21f00e179e04
1/*
2 *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "./vpx_config.h"
12#include "vpx_dsp/mips/inv_txfm_dspr2.h"
13#include "vpx_dsp/txfm_common.h"
14
15#if HAVE_DSPR2
16void vpx_idct32_cols_add_blk_dspr2(int16_t *input, uint8_t *dest,
17                                   int dest_stride) {
18  int16_t step1_0, step1_1, step1_2, step1_3, step1_4, step1_5, step1_6;
19  int16_t step1_7, step1_8, step1_9, step1_10, step1_11, step1_12, step1_13;
20  int16_t step1_14, step1_15, step1_16, step1_17, step1_18, step1_19;
21  int16_t step1_20, step1_21, step1_22, step1_23, step1_24, step1_25, step1_26;
22  int16_t step1_27, step1_28, step1_29, step1_30, step1_31;
23  int16_t step2_0, step2_1, step2_2, step2_3, step2_4, step2_5, step2_6;
24  int16_t step2_7, step2_8, step2_9, step2_10, step2_11, step2_12, step2_13;
25  int16_t step2_14, step2_15, step2_16, step2_17, step2_18, step2_19, step2_20;
26  int16_t step2_21, step2_22, step2_23, step2_24, step2_25, step2_26, step2_27;
27  int16_t step2_28, step2_29, step2_30, step2_31;
28  int16_t step3_8, step3_9, step3_10, step3_11, step3_12, step3_13, step3_14;
29  int16_t step3_15, step3_16, step3_17, step3_18, step3_19, step3_20, step3_21;
30  int16_t step3_22, step3_23, step3_24, step3_25, step3_26, step3_27;
31  int16_t step3_28, step3_29, step3_30, step3_31;
32  int temp0, temp1, temp2, temp3;
33  int load1, load2, load3, load4;
34  int result1, result2;
35  int i, temp21;
36  uint8_t *dest_pix, *dest_pix1;
37  const int const_2_power_13 = 8192;
38  uint8_t *cm = vpx_ff_cropTbl;
39
40  /* prefetch vpx_ff_cropTbl */
41  prefetch_load(vpx_ff_cropTbl);
42  prefetch_load(vpx_ff_cropTbl +  32);
43  prefetch_load(vpx_ff_cropTbl +  64);
44  prefetch_load(vpx_ff_cropTbl +  96);
45  prefetch_load(vpx_ff_cropTbl + 128);
46  prefetch_load(vpx_ff_cropTbl + 160);
47  prefetch_load(vpx_ff_cropTbl + 192);
48  prefetch_load(vpx_ff_cropTbl + 224);
49
50  for (i = 0; i < 32; ++i) {
51    dest_pix = dest + i;
52    dest_pix1 = dest + i + 31 * dest_stride;
53
54    __asm__ __volatile__ (
55        "lh       %[load1],             2(%[input])                     \n\t"
56        "lh       %[load2],             62(%[input])                    \n\t"
57        "lh       %[load3],             34(%[input])                    \n\t"
58        "lh       %[load4],             30(%[input])                    \n\t"
59
60        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
61        "mthi     $zero,                $ac1                            \n\t"
62        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
63        "mthi     $zero,                $ac3                            \n\t"
64
65        "madd     $ac1,                 %[load1],       %[cospi_31_64]  \n\t"
66        "msub     $ac1,                 %[load2],       %[cospi_1_64]   \n\t"
67        "extp     %[temp0],             $ac1,           31              \n\t"
68
69        "madd     $ac3,                 %[load1],       %[cospi_1_64]   \n\t"
70        "madd     $ac3,                 %[load2],       %[cospi_31_64]  \n\t"
71        "extp     %[temp3],             $ac3,           31              \n\t"
72
73        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
74        "mthi     $zero,                $ac1                            \n\t"
75        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
76        "mthi     $zero,                $ac2                            \n\t"
77
78        "madd     $ac2,                 %[load3],       %[cospi_15_64]  \n\t"
79        "msub     $ac2,                 %[load4],       %[cospi_17_64]  \n\t"
80        "extp     %[temp1],             $ac2,           31              \n\t"
81
82        "madd     $ac1,                 %[load3],       %[cospi_17_64]  \n\t"
83        "madd     $ac1,                 %[load4],       %[cospi_15_64]  \n\t"
84        "extp     %[temp2],             $ac1,           31              \n\t"
85
86        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
87        "mthi     $zero,                $ac1                            \n\t"
88        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
89        "mthi     $zero,                $ac3                            \n\t"
90
91        "sub      %[load1],             %[temp3],       %[temp2]        \n\t"
92        "sub      %[load2],             %[temp0],       %[temp1]        \n\t"
93
94        "madd     $ac1,                 %[load1],       %[cospi_28_64]  \n\t"
95        "msub     $ac1,                 %[load2],       %[cospi_4_64]   \n\t"
96        "madd     $ac3,                 %[load1],       %[cospi_4_64]   \n\t"
97        "madd     $ac3,                 %[load2],       %[cospi_28_64]  \n\t"
98
99        "extp     %[step1_17],          $ac1,           31              \n\t"
100        "extp     %[step1_30],          $ac3,           31              \n\t"
101        "add      %[step1_16],          %[temp0],       %[temp1]        \n\t"
102        "add      %[step1_31],          %[temp2],       %[temp3]        \n\t"
103
104        : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
105          [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
106          [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
107          [step1_16] "=r" (step1_16), [step1_17] "=r" (step1_17),
108          [step1_30] "=r" (step1_30), [step1_31] "=r" (step1_31)
109        : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
110          [cospi_31_64] "r" (cospi_31_64), [cospi_1_64] "r" (cospi_1_64),
111          [cospi_4_64] "r" (cospi_4_64), [cospi_17_64] "r" (cospi_17_64),
112          [cospi_15_64] "r" (cospi_15_64), [cospi_28_64] "r" (cospi_28_64)
113    );
114
115    __asm__ __volatile__ (
116        "lh       %[load1],             18(%[input])                    \n\t"
117        "lh       %[load2],             46(%[input])                    \n\t"
118        "lh       %[load3],             50(%[input])                    \n\t"
119        "lh       %[load4],             14(%[input])                    \n\t"
120
121        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
122        "mthi     $zero,                $ac1                            \n\t"
123        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
124        "mthi     $zero,                $ac3                            \n\t"
125
126        "madd     $ac1,                 %[load1],       %[cospi_23_64]  \n\t"
127        "msub     $ac1,                 %[load2],       %[cospi_9_64]   \n\t"
128        "extp     %[temp0],             $ac1,           31              \n\t"
129
130        "madd     $ac3,                 %[load1],       %[cospi_9_64]   \n\t"
131        "madd     $ac3,                 %[load2],       %[cospi_23_64]  \n\t"
132        "extp     %[temp3],             $ac3,           31              \n\t"
133
134        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
135        "mthi     $zero,                $ac1                            \n\t"
136        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
137        "mthi     $zero,                $ac2                            \n\t"
138
139        "madd     $ac2,                 %[load3],       %[cospi_7_64]   \n\t"
140        "msub     $ac2,                 %[load4],       %[cospi_25_64]  \n\t"
141        "extp     %[temp1],             $ac2,           31              \n\t"
142
143        "madd     $ac1,                 %[load3],       %[cospi_25_64]  \n\t"
144        "madd     $ac1,                 %[load4],       %[cospi_7_64]   \n\t"
145        "extp     %[temp2],             $ac1,           31              \n\t"
146
147        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
148        "mthi     $zero,                $ac1                            \n\t"
149        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
150        "mthi     $zero,                $ac3                            \n\t"
151
152        "sub      %[load1],             %[temp1],       %[temp0]        \n\t"
153        "sub      %[load2],             %[temp2],       %[temp3]        \n\t"
154
155        "msub     $ac1,                 %[load1],       %[cospi_28_64]  \n\t"
156        "msub     $ac1,                 %[load2],       %[cospi_4_64]   \n\t"
157        "msub     $ac3,                 %[load1],       %[cospi_4_64]   \n\t"
158        "madd     $ac3,                 %[load2],       %[cospi_28_64]  \n\t"
159
160        "extp     %[step1_18],          $ac1,           31              \n\t"
161        "extp     %[step1_29],          $ac3,           31              \n\t"
162        "add      %[step1_19],          %[temp0],       %[temp1]        \n\t"
163        "add      %[step1_28],          %[temp2],       %[temp3]        \n\t"
164
165        : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
166          [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
167          [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
168          [step1_18] "=r" (step1_18), [step1_19] "=r" (step1_19),
169          [step1_28] "=r" (step1_28), [step1_29] "=r" (step1_29)
170        : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
171          [cospi_23_64] "r" (cospi_23_64), [cospi_9_64] "r" (cospi_9_64),
172          [cospi_4_64] "r" (cospi_4_64), [cospi_7_64] "r" (cospi_7_64),
173          [cospi_25_64] "r" (cospi_25_64), [cospi_28_64] "r" (cospi_28_64)
174    );
175
176    __asm__ __volatile__ (
177        "lh       %[load1],             10(%[input])                    \n\t"
178        "lh       %[load2],             54(%[input])                    \n\t"
179        "lh       %[load3],             42(%[input])                    \n\t"
180        "lh       %[load4],             22(%[input])                    \n\t"
181
182        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
183        "mthi     $zero,                $ac1                            \n\t"
184        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
185        "mthi     $zero,                $ac3                            \n\t"
186
187        "madd     $ac1,                 %[load1],       %[cospi_27_64]  \n\t"
188        "msub     $ac1,                 %[load2],       %[cospi_5_64]   \n\t"
189        "extp     %[temp0],             $ac1,           31              \n\t"
190
191        "madd     $ac3,                 %[load1],       %[cospi_5_64]   \n\t"
192        "madd     $ac3,                 %[load2],       %[cospi_27_64]  \n\t"
193        "extp     %[temp3],             $ac3,           31              \n\t"
194
195        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
196        "mthi     $zero,                $ac1                            \n\t"
197        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
198        "mthi     $zero,                $ac2                            \n\t"
199
200        "madd     $ac2,                 %[load3],       %[cospi_11_64]  \n\t"
201        "msub     $ac2,                 %[load4],       %[cospi_21_64]  \n\t"
202        "extp     %[temp1],             $ac2,           31              \n\t"
203
204        "madd     $ac1,                 %[load3],       %[cospi_21_64]  \n\t"
205        "madd     $ac1,                 %[load4],       %[cospi_11_64]  \n\t"
206        "extp     %[temp2],             $ac1,           31              \n\t"
207
208        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
209        "mthi     $zero,                $ac1                            \n\t"
210        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
211        "mthi     $zero,                $ac3                            \n\t"
212
213        "sub      %[load1],             %[temp0],       %[temp1]        \n\t"
214        "sub      %[load2],             %[temp3],       %[temp2]        \n\t"
215
216        "madd     $ac1,                 %[load2],       %[cospi_12_64]  \n\t"
217        "msub     $ac1,                 %[load1],       %[cospi_20_64]  \n\t"
218        "madd     $ac3,                 %[load1],       %[cospi_12_64]  \n\t"
219        "madd     $ac3,                 %[load2],       %[cospi_20_64]  \n\t"
220
221        "extp     %[step1_21],          $ac1,           31              \n\t"
222        "extp     %[step1_26],          $ac3,           31              \n\t"
223        "add      %[step1_20],          %[temp0],       %[temp1]        \n\t"
224        "add      %[step1_27],          %[temp2],       %[temp3]        \n\t"
225
226        : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
227          [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
228          [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
229          [step1_20] "=r" (step1_20), [step1_21] "=r" (step1_21),
230          [step1_26] "=r" (step1_26), [step1_27] "=r" (step1_27)
231        : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
232          [cospi_27_64] "r" (cospi_27_64), [cospi_5_64] "r" (cospi_5_64),
233          [cospi_11_64] "r" (cospi_11_64), [cospi_21_64] "r" (cospi_21_64),
234          [cospi_12_64] "r" (cospi_12_64), [cospi_20_64] "r" (cospi_20_64)
235    );
236
237    __asm__ __volatile__ (
238        "lh       %[load1],             26(%[input])                    \n\t"
239        "lh       %[load2],             38(%[input])                    \n\t"
240        "lh       %[load3],             58(%[input])                    \n\t"
241        "lh       %[load4],              6(%[input])                    \n\t"
242
243        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
244        "mthi     $zero,                $ac1                            \n\t"
245        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
246        "mthi     $zero,                $ac3                            \n\t"
247
248        "madd     $ac1,                 %[load1],       %[cospi_19_64]  \n\t"
249        "msub     $ac1,                 %[load2],       %[cospi_13_64]  \n\t"
250        "extp     %[temp0],             $ac1,           31              \n\t"
251        "madd     $ac3,                 %[load1],       %[cospi_13_64]  \n\t"
252        "madd     $ac3,                 %[load2],       %[cospi_19_64]  \n\t"
253        "extp     %[temp3],             $ac3,           31              \n\t"
254
255        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
256        "mthi     $zero,                $ac1                            \n\t"
257        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
258        "mthi     $zero,                $ac2                            \n\t"
259
260        "madd     $ac2,                 %[load3],       %[cospi_3_64]   \n\t"
261        "msub     $ac2,                 %[load4],       %[cospi_29_64]  \n\t"
262        "extp     %[temp1],             $ac2,           31              \n\t"
263        "madd     $ac1,                 %[load3],       %[cospi_29_64]  \n\t"
264        "madd     $ac1,                 %[load4],       %[cospi_3_64]   \n\t"
265        "extp     %[temp2],             $ac1,           31              \n\t"
266
267        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
268        "mthi     $zero,                $ac1                            \n\t"
269        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
270        "mthi     $zero,                $ac3                            \n\t"
271
272        "sub      %[load1],             %[temp1],       %[temp0]        \n\t"
273        "sub      %[load2],             %[temp2],       %[temp3]        \n\t"
274        "msub     $ac1,                 %[load1],       %[cospi_12_64]  \n\t"
275        "msub     $ac1,                 %[load2],       %[cospi_20_64]  \n\t"
276        "msub     $ac3,                 %[load1],       %[cospi_20_64]  \n\t"
277        "madd     $ac3,                 %[load2],       %[cospi_12_64]  \n\t"
278        "extp     %[step1_22],          $ac1,           31              \n\t"
279        "extp     %[step1_25],          $ac3,           31              \n\t"
280        "add      %[step1_23],          %[temp0],       %[temp1]        \n\t"
281        "add      %[step1_24],          %[temp2],       %[temp3]        \n\t"
282
283        : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
284          [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
285          [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
286          [step1_22] "=r" (step1_22), [step1_23] "=r" (step1_23),
287          [step1_24] "=r" (step1_24), [step1_25] "=r" (step1_25)
288        : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
289          [cospi_19_64] "r" (cospi_19_64), [cospi_13_64] "r" (cospi_13_64),
290          [cospi_3_64] "r" (cospi_3_64), [cospi_29_64] "r" (cospi_29_64),
291          [cospi_12_64] "r" (cospi_12_64), [cospi_20_64] "r" (cospi_20_64)
292    );
293
294    __asm__ __volatile__ (
295        "lh       %[load1],              4(%[input])                    \n\t"
296        "lh       %[load2],             60(%[input])                    \n\t"
297        "lh       %[load3],             36(%[input])                    \n\t"
298        "lh       %[load4],             28(%[input])                    \n\t"
299
300        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
301        "mthi     $zero,                $ac1                            \n\t"
302        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
303        "mthi     $zero,                $ac3                            \n\t"
304
305        "madd     $ac1,                 %[load1],       %[cospi_30_64]  \n\t"
306        "msub     $ac1,                 %[load2],       %[cospi_2_64]   \n\t"
307        "extp     %[temp0],             $ac1,           31              \n\t"
308        "madd     $ac3,                 %[load1],       %[cospi_2_64]   \n\t"
309        "madd     $ac3,                 %[load2],       %[cospi_30_64]  \n\t"
310        "extp     %[temp3],             $ac3,           31              \n\t"
311
312        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
313        "mthi     $zero,                $ac1                            \n\t"
314        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
315        "mthi     $zero,                $ac2                            \n\t"
316
317        "madd     $ac2,                 %[load3],       %[cospi_14_64]  \n\t"
318        "msub     $ac2,                 %[load4],       %[cospi_18_64]  \n\t"
319        "extp     %[temp1],             $ac2,           31              \n\t"
320        "madd     $ac1,                 %[load3],       %[cospi_18_64]  \n\t"
321        "madd     $ac1,                 %[load4],       %[cospi_14_64]  \n\t"
322        "extp     %[temp2],             $ac1,           31              \n\t"
323
324        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
325        "mthi     $zero,                $ac1                            \n\t"
326        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
327        "mthi     $zero,                $ac3                            \n\t"
328
329        "sub      %[load1],             %[temp0],       %[temp1]        \n\t"
330        "sub      %[load2],             %[temp3],       %[temp2]        \n\t"
331        "msub     $ac1,                 %[load1],       %[cospi_8_64]   \n\t"
332        "madd     $ac1,                 %[load2],       %[cospi_24_64]  \n\t"
333        "madd     $ac3,                 %[load1],       %[cospi_24_64]  \n\t"
334        "madd     $ac3,                 %[load2],       %[cospi_8_64]   \n\t"
335        "extp     %[step2_9],           $ac1,           31              \n\t"
336        "extp     %[step2_14],          $ac3,           31              \n\t"
337        "add      %[step2_8],           %[temp0],       %[temp1]        \n\t"
338        "add      %[step2_15],          %[temp2],       %[temp3]        \n\t"
339
340        : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
341          [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
342          [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
343          [step2_8] "=r" (step2_8), [step2_9] "=r" (step2_9),
344          [step2_14] "=r" (step2_14), [step2_15] "=r" (step2_15)
345        : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
346          [cospi_30_64] "r" (cospi_30_64), [cospi_2_64] "r" (cospi_2_64),
347          [cospi_14_64] "r" (cospi_14_64), [cospi_18_64] "r" (cospi_18_64),
348          [cospi_8_64] "r" (cospi_8_64), [cospi_24_64] "r" (cospi_24_64)
349    );
350
351    __asm__ __volatile__ (
352        "lh       %[load1],             20(%[input])                    \n\t"
353        "lh       %[load2],             44(%[input])                    \n\t"
354        "lh       %[load3],             52(%[input])                    \n\t"
355        "lh       %[load4],             12(%[input])                    \n\t"
356
357        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
358        "mthi     $zero,                $ac1                            \n\t"
359        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
360        "mthi     $zero,                $ac3                            \n\t"
361
362        "madd     $ac1,                 %[load1],       %[cospi_22_64]  \n\t"
363        "msub     $ac1,                 %[load2],       %[cospi_10_64]  \n\t"
364        "extp     %[temp0],             $ac1,           31              \n\t"
365        "madd     $ac3,                 %[load1],       %[cospi_10_64]  \n\t"
366        "madd     $ac3,                 %[load2],       %[cospi_22_64]  \n\t"
367        "extp     %[temp3],             $ac3,           31              \n\t"
368
369        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
370        "mthi     $zero,                $ac1                            \n\t"
371        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
372        "mthi     $zero,                $ac2                            \n\t"
373
374        "madd     $ac2,                 %[load3],       %[cospi_6_64]   \n\t"
375        "msub     $ac2,                 %[load4],       %[cospi_26_64]  \n\t"
376        "extp     %[temp1],             $ac2,           31              \n\t"
377        "madd     $ac1,                 %[load3],       %[cospi_26_64]  \n\t"
378        "madd     $ac1,                 %[load4],       %[cospi_6_64]   \n\t"
379        "extp     %[temp2],             $ac1,           31              \n\t"
380
381        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
382        "mthi     $zero,                $ac1                            \n\t"
383        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
384        "mthi     $zero,                $ac3                            \n\t"
385
386        "sub      %[load1],             %[temp1],       %[temp0]        \n\t"
387        "sub      %[load2],             %[temp2],       %[temp3]        \n\t"
388        "msub     $ac1,                 %[load1],       %[cospi_24_64]  \n\t"
389        "msub     $ac1,                 %[load2],       %[cospi_8_64]   \n\t"
390        "madd     $ac3,                 %[load2],       %[cospi_24_64]  \n\t"
391        "msub     $ac3,                 %[load1],       %[cospi_8_64]   \n\t"
392        "extp     %[step2_10],          $ac1,           31              \n\t"
393        "extp     %[step2_13],          $ac3,           31              \n\t"
394        "add      %[step2_11],          %[temp0],       %[temp1]        \n\t"
395        "add      %[step2_12],          %[temp2],       %[temp3]        \n\t"
396
397        : [load1] "=&r" (load1), [load2] "=&r" (load2), [load3] "=&r" (load3),
398          [load4] "=&r" (load4), [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
399          [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
400          [step2_10] "=r" (step2_10), [step2_11] "=r" (step2_11),
401          [step2_12] "=r" (step2_12), [step2_13] "=r" (step2_13)
402        : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
403          [cospi_22_64] "r" (cospi_22_64), [cospi_10_64] "r" (cospi_10_64),
404          [cospi_6_64] "r" (cospi_6_64), [cospi_26_64] "r" (cospi_26_64),
405          [cospi_8_64] "r" (cospi_8_64), [cospi_24_64] "r" (cospi_24_64)
406    );
407
408    __asm__ __volatile__ (
409        "mtlo     %[const_2_power_13],  $ac0                            \n\t"
410        "mthi     $zero,                $ac0                            \n\t"
411        "sub      %[temp0],             %[step2_14],    %[step2_13]     \n\t"
412        "sub      %[temp0],             %[temp0],       %[step2_9]      \n\t"
413        "add      %[temp0],             %[temp0],       %[step2_10]     \n\t"
414        "madd     $ac0,                 %[temp0],       %[cospi_16_64]  \n\t"
415        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
416        "mthi     $zero,                $ac1                            \n\t"
417        "sub      %[temp1],             %[step2_14],    %[step2_13]     \n\t"
418        "add      %[temp1],             %[temp1],       %[step2_9]      \n\t"
419        "sub      %[temp1],             %[temp1],       %[step2_10]     \n\t"
420        "madd     $ac1,                 %[temp1],       %[cospi_16_64]  \n\t"
421        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
422        "mthi     $zero,                $ac2                            \n\t"
423        "sub      %[temp0],             %[step2_15],    %[step2_12]     \n\t"
424        "sub      %[temp0],             %[temp0],       %[step2_8]      \n\t"
425        "add      %[temp0],             %[temp0],       %[step2_11]     \n\t"
426        "madd     $ac2,                 %[temp0],       %[cospi_16_64]  \n\t"
427        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
428        "mthi     $zero,                $ac3                            \n\t"
429        "sub      %[temp1],             %[step2_15],    %[step2_12]     \n\t"
430        "add      %[temp1],             %[temp1],       %[step2_8]      \n\t"
431        "sub      %[temp1],             %[temp1],       %[step2_11]     \n\t"
432        "madd     $ac3,                 %[temp1],       %[cospi_16_64]  \n\t"
433
434        "add      %[step3_8],           %[step2_8],     %[step2_11]     \n\t"
435        "add      %[step3_9],           %[step2_9],     %[step2_10]     \n\t"
436        "add      %[step3_14],          %[step2_13],    %[step2_14]     \n\t"
437        "add      %[step3_15],          %[step2_12],    %[step2_15]     \n\t"
438        "extp     %[step3_10],          $ac0,           31              \n\t"
439        "extp     %[step3_13],          $ac1,           31              \n\t"
440        "extp     %[step3_11],          $ac2,           31              \n\t"
441        "extp     %[step3_12],          $ac3,           31              \n\t"
442
443        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
444          [step3_8] "=r" (step3_8), [step3_9] "=r" (step3_9),
445          [step3_10] "=r" (step3_10), [step3_11] "=r" (step3_11),
446          [step3_12] "=r" (step3_12), [step3_13] "=r" (step3_13),
447          [step3_14] "=r" (step3_14), [step3_15] "=r" (step3_15)
448        : [const_2_power_13] "r" (const_2_power_13), [step2_8] "r" (step2_8),
449          [step2_9] "r" (step2_9), [step2_10] "r" (step2_10),
450          [step2_11] "r" (step2_11), [step2_12] "r" (step2_12),
451          [step2_13] "r" (step2_13), [step2_14] "r" (step2_14),
452          [step2_15] "r" (step2_15), [cospi_16_64] "r" (cospi_16_64)
453    );
454
455    step2_18 = step1_17 - step1_18;
456    step2_29 = step1_30 - step1_29;
457
458    __asm__ __volatile__ (
459        "mtlo     %[const_2_power_13],  $ac0                            \n\t"
460        "mthi     $zero,                $ac0                            \n\t"
461        "msub     $ac0,                 %[step2_18],    %[cospi_8_64]   \n\t"
462        "madd     $ac0,                 %[step2_29],    %[cospi_24_64]  \n\t"
463        "extp     %[step3_18],          $ac0,           31              \n\t"
464
465        : [step3_18] "=r" (step3_18)
466        : [const_2_power_13] "r" (const_2_power_13),
467          [step2_18] "r" (step2_18), [step2_29] "r" (step2_29),
468          [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
469    );
470
471    temp21 = step2_18 * cospi_24_64 + step2_29 * cospi_8_64;
472    step3_29 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
473
474    step2_19 = step1_16 - step1_19;
475    step2_28 = step1_31 - step1_28;
476
477    __asm__ __volatile__ (
478        "mtlo     %[const_2_power_13],  $ac0                            \n\t"
479        "mthi     $zero,                $ac0                            \n\t"
480        "msub     $ac0,                 %[step2_19],    %[cospi_8_64]   \n\t"
481        "madd     $ac0,                 %[step2_28],    %[cospi_24_64]  \n\t"
482        "extp     %[step3_19],          $ac0,           31              \n\t"
483
484        : [step3_19] "=r" (step3_19)
485        : [const_2_power_13] "r" (const_2_power_13),
486          [step2_19] "r" (step2_19), [step2_28] "r" (step2_28),
487          [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
488    );
489
490    temp21 = step2_19 * cospi_24_64 + step2_28 * cospi_8_64;
491    step3_28 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
492
493    step3_16 = step1_16 + step1_19;
494    step3_17 = step1_17 + step1_18;
495    step3_30 = step1_29 + step1_30;
496    step3_31 = step1_28 + step1_31;
497
498    step2_20 = step1_23 - step1_20;
499    step2_27 = step1_24 - step1_27;
500
501    __asm__ __volatile__ (
502        "mtlo     %[const_2_power_13],  $ac0                            \n\t"
503        "mthi     $zero,                $ac0                            \n\t"
504        "msub     $ac0,                 %[step2_20],    %[cospi_24_64]  \n\t"
505        "msub     $ac0,                 %[step2_27],    %[cospi_8_64]   \n\t"
506        "extp     %[step3_20],          $ac0,           31              \n\t"
507
508        : [step3_20] "=r" (step3_20)
509        : [const_2_power_13] "r" (const_2_power_13),
510          [step2_20] "r" (step2_20), [step2_27] "r" (step2_27),
511          [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
512    );
513
514    temp21 = -step2_20 * cospi_8_64 + step2_27 * cospi_24_64;
515    step3_27 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
516
517    step2_21 = step1_22 - step1_21;
518    step2_26 = step1_25 - step1_26;
519
520    __asm__ __volatile__ (
521        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
522        "mthi     $zero,                $ac1                            \n\t"
523        "msub     $ac1,                 %[step2_21],    %[cospi_24_64]  \n\t"
524        "msub     $ac1,                 %[step2_26],    %[cospi_8_64]   \n\t"
525        "extp     %[step3_21],          $ac1,           31              \n\t"
526
527        : [step3_21] "=r" (step3_21)
528        : [const_2_power_13] "r" (const_2_power_13),
529          [step2_21] "r" (step2_21), [step2_26] "r" (step2_26),
530          [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64)
531    );
532
533    temp21 = -step2_21 * cospi_8_64 + step2_26 * cospi_24_64;
534    step3_26 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
535
536    step3_22 = step1_21 + step1_22;
537    step3_23 = step1_20 + step1_23;
538    step3_24 = step1_24 + step1_27;
539    step3_25 = step1_25 + step1_26;
540
541    step2_16 = step3_16 + step3_23;
542    step2_17 = step3_17 + step3_22;
543    step2_18 = step3_18 + step3_21;
544    step2_19 = step3_19 + step3_20;
545    step2_20 = step3_19 - step3_20;
546    step2_21 = step3_18 - step3_21;
547    step2_22 = step3_17 - step3_22;
548    step2_23 = step3_16 - step3_23;
549
550    step2_24 = step3_31 - step3_24;
551    step2_25 = step3_30 - step3_25;
552    step2_26 = step3_29 - step3_26;
553    step2_27 = step3_28 - step3_27;
554    step2_28 = step3_28 + step3_27;
555    step2_29 = step3_29 + step3_26;
556    step2_30 = step3_30 + step3_25;
557    step2_31 = step3_31 + step3_24;
558
559    __asm__ __volatile__ (
560        "lh       %[load1],             0(%[input])                     \n\t"
561        "lh       %[load2],             32(%[input])                    \n\t"
562        "lh       %[load3],             16(%[input])                    \n\t"
563        "lh       %[load4],             48(%[input])                    \n\t"
564
565        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
566        "mthi     $zero,                $ac1                            \n\t"
567        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
568        "mthi     $zero,                $ac2                            \n\t"
569        "add      %[result1],           %[load1],       %[load2]        \n\t"
570        "sub      %[result2],           %[load1],       %[load2]        \n\t"
571        "madd     $ac1,                 %[result1],     %[cospi_16_64]  \n\t"
572        "madd     $ac2,                 %[result2],     %[cospi_16_64]  \n\t"
573        "extp     %[temp0],             $ac1,           31              \n\t"
574        "extp     %[temp1],             $ac2,           31              \n\t"
575
576        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
577        "mthi     $zero,                $ac3                            \n\t"
578        "madd     $ac3,                 %[load3],       %[cospi_24_64]  \n\t"
579        "msub     $ac3,                 %[load4],       %[cospi_8_64]   \n\t"
580        "extp     %[temp2],             $ac3,           31              \n\t"
581        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
582        "mthi     $zero,                $ac1                            \n\t"
583        "madd     $ac1,                 %[load3],       %[cospi_8_64]   \n\t"
584        "madd     $ac1,                 %[load4],       %[cospi_24_64]  \n\t"
585        "extp     %[temp3],             $ac1,           31              \n\t"
586        "add      %[step1_0],           %[temp0],       %[temp3]        \n\t"
587        "add      %[step1_1],           %[temp1],       %[temp2]        \n\t"
588        "sub      %[step1_2],           %[temp1],       %[temp2]        \n\t"
589        "sub      %[step1_3],           %[temp0],       %[temp3]        \n\t"
590
591        : [load1] "=&r" (load1), [load2] "=&r" (load2),
592          [load3] "=&r" (load3), [load4] "=&r" (load4),
593          [result1] "=&r" (result1), [result2] "=&r" (result2),
594          [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
595          [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
596          [step1_0] "=r" (step1_0), [step1_1] "=r" (step1_1),
597          [step1_2] "=r" (step1_2), [step1_3] "=r" (step1_3)
598        : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
599          [cospi_24_64] "r" (cospi_24_64), [cospi_8_64] "r" (cospi_8_64),
600          [cospi_16_64] "r" (cospi_16_64)
601    );
602
603    __asm__ __volatile__ (
604        "lh       %[load1],             8(%[input])                     \n\t"
605        "lh       %[load2],             56(%[input])                    \n\t"
606        "lh       %[load3],             40(%[input])                    \n\t"
607        "lh       %[load4],             24(%[input])                    \n\t"
608
609        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
610        "mthi     $zero,                $ac1                            \n\t"
611        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
612        "mthi     $zero,                $ac3                            \n\t"
613
614        "madd     $ac1,                 %[load1],       %[cospi_28_64]  \n\t"
615        "msub     $ac1,                 %[load2],       %[cospi_4_64]   \n\t"
616        "extp     %[temp0],             $ac1,           31              \n\t"
617        "madd     $ac3,                 %[load1],       %[cospi_4_64]   \n\t"
618        "madd     $ac3,                 %[load2],       %[cospi_28_64]  \n\t"
619        "extp     %[temp3],             $ac3,           31              \n\t"
620
621        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
622        "mthi     $zero,                $ac1                            \n\t"
623        "mtlo     %[const_2_power_13],  $ac2                            \n\t"
624        "mthi     $zero,                $ac2                            \n\t"
625
626        "madd     $ac2,                 %[load3],       %[cospi_12_64]  \n\t"
627        "msub     $ac2,                 %[load4],       %[cospi_20_64]  \n\t"
628        "extp     %[temp1],             $ac2,           31              \n\t"
629        "madd     $ac1,                 %[load3],       %[cospi_20_64]  \n\t"
630        "madd     $ac1,                 %[load4],       %[cospi_12_64]  \n\t"
631        "extp     %[temp2],             $ac1,           31              \n\t"
632
633        "mtlo     %[const_2_power_13],  $ac1                            \n\t"
634        "mthi     $zero,                $ac1                            \n\t"
635        "mtlo     %[const_2_power_13],  $ac3                            \n\t"
636        "mthi     $zero,                $ac3                            \n\t"
637
638        "sub      %[load1],             %[temp3],       %[temp2]        \n\t"
639        "sub      %[load1],             %[load1],       %[temp0]        \n\t"
640        "add      %[load1],             %[load1],       %[temp1]        \n\t"
641        "sub      %[load2],             %[temp0],       %[temp1]        \n\t"
642        "sub      %[load2],             %[load2],       %[temp2]        \n\t"
643        "add      %[load2],             %[load2],       %[temp3]        \n\t"
644        "madd     $ac1,                 %[load1],       %[cospi_16_64]  \n\t"
645        "madd     $ac3,                 %[load2],       %[cospi_16_64]  \n\t"
646
647        "extp     %[step1_5],           $ac1,           31              \n\t"
648        "extp     %[step1_6],           $ac3,           31              \n\t"
649        "add      %[step1_4],           %[temp0],       %[temp1]        \n\t"
650        "add      %[step1_7],           %[temp3],       %[temp2]        \n\t"
651
652        : [load1] "=&r" (load1), [load2] "=&r" (load2),
653          [load3] "=&r" (load3), [load4] "=&r" (load4),
654          [temp0] "=&r" (temp0), [temp1] "=&r" (temp1),
655          [temp2] "=&r" (temp2), [temp3] "=&r" (temp3),
656          [step1_4] "=r" (step1_4), [step1_5] "=r" (step1_5),
657          [step1_6] "=r" (step1_6), [step1_7] "=r" (step1_7)
658        : [const_2_power_13] "r" (const_2_power_13), [input] "r" (input),
659          [cospi_20_64] "r" (cospi_20_64), [cospi_12_64] "r" (cospi_12_64),
660          [cospi_4_64] "r" (cospi_4_64), [cospi_28_64] "r" (cospi_28_64),
661          [cospi_16_64] "r" (cospi_16_64)
662    );
663
664    step2_0 = step1_0 + step1_7;
665    step2_1 = step1_1 + step1_6;
666    step2_2 = step1_2 + step1_5;
667    step2_3 = step1_3 + step1_4;
668    step2_4 = step1_3 - step1_4;
669    step2_5 = step1_2 - step1_5;
670    step2_6 = step1_1 - step1_6;
671    step2_7 = step1_0 - step1_7;
672
673    // stage 7
674    step1_0 = step2_0 + step3_15;
675    step1_1 = step2_1 + step3_14;
676    step1_2 = step2_2 + step3_13;
677    step1_3 = step2_3 + step3_12;
678    step1_4 = step2_4 + step3_11;
679    step1_5 = step2_5 + step3_10;
680    step1_6 = step2_6 + step3_9;
681    step1_7 = step2_7 + step3_8;
682    step1_8 = step2_7 - step3_8;
683    step1_9 = step2_6 - step3_9;
684    step1_10 = step2_5 - step3_10;
685    step1_11 = step2_4 - step3_11;
686    step1_12 = step2_3 - step3_12;
687    step1_13 = step2_2 - step3_13;
688    step1_14 = step2_1 - step3_14;
689    step1_15 = step2_0 - step3_15;
690
691    __asm__ __volatile__ (
692        "sub      %[temp0],             %[step2_27],    %[step2_20]     \n\t"
693        "mtlo     %[const_2_power_13],  $ac0                            \n\t"
694        "mthi     $zero,                $ac0                            \n\t"
695        "madd     $ac0,                 %[temp0],       %[cospi_16_64]  \n\t"
696        "extp     %[step1_20],          $ac0,           31              \n\t"
697
698        : [temp0] "=&r" (temp0), [step1_20] "=r" (step1_20)
699        : [const_2_power_13] "r" (const_2_power_13), [step2_20] "r" (step2_20),
700          [step2_27] "r" (step2_27), [cospi_16_64] "r" (cospi_16_64)
701    );
702
703    temp21 = (step2_20 + step2_27) * cospi_16_64;
704    step1_27 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
705
706    __asm__ __volatile__ (
707        "sub      %[temp0],             %[step2_26],    %[step2_21]     \n\t"
708        "mtlo     %[const_2_power_13],  $ac0                            \n\t"
709        "mthi     $zero,                $ac0                            \n\t"
710        "madd     $ac0,                 %[temp0],       %[cospi_16_64]  \n\t"
711        "extp     %[step1_21],          $ac0,           31              \n\t"
712
713        : [temp0] "=&r" (temp0), [step1_21] "=r" (step1_21)
714        : [const_2_power_13] "r" (const_2_power_13), [step2_26] "r" (step2_26),
715          [step2_21] "r" (step2_21), [cospi_16_64] "r" (cospi_16_64)
716    );
717
718    temp21 = (step2_21 + step2_26) * cospi_16_64;
719    step1_26 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
720
721    __asm__ __volatile__ (
722        "sub      %[temp0],             %[step2_25],    %[step2_22]     \n\t"
723        "mtlo     %[const_2_power_13],  $ac0                            \n\t"
724        "mthi     $zero,                $ac0                            \n\t"
725        "madd     $ac0,                 %[temp0],       %[cospi_16_64]  \n\t"
726        "extp     %[step1_22],          $ac0,           31              \n\t"
727
728        : [temp0] "=&r" (temp0), [step1_22] "=r" (step1_22)
729        : [const_2_power_13] "r" (const_2_power_13), [step2_25] "r" (step2_25),
730          [step2_22] "r" (step2_22), [cospi_16_64] "r" (cospi_16_64)
731    );
732
733    temp21 = (step2_22 + step2_25) * cospi_16_64;
734    step1_25 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
735
736    __asm__ __volatile__ (
737        "sub      %[temp0],             %[step2_24],    %[step2_23]     \n\t"
738        "mtlo     %[const_2_power_13],  $ac0                            \n\t"
739        "mthi     $zero,                $ac0                            \n\t"
740        "madd     $ac0,                 %[temp0],       %[cospi_16_64]  \n\t"
741        "extp     %[step1_23],          $ac0,           31              \n\t"
742
743        : [temp0] "=&r" (temp0), [step1_23] "=r" (step1_23)
744        : [const_2_power_13] "r" (const_2_power_13), [step2_24] "r" (step2_24),
745          [step2_23] "r" (step2_23), [cospi_16_64] "r" (cospi_16_64)
746    );
747
748    temp21 = (step2_23 + step2_24) * cospi_16_64;
749    step1_24 = (temp21 + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
750
751    __asm__ __volatile__ (
752        "lbu      %[temp2],         0(%[dest_pix])                      \n\t"
753        "add      %[temp0],         %[step1_0],         %[step2_31]     \n\t"
754        "addi     %[temp0],         %[temp0],           32              \n\t"
755        "sra      %[temp0],         %[temp0],           6               \n\t"
756        "add      %[temp2],         %[temp2],           %[temp0]        \n\t"
757        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
758        "add      %[temp1],         %[step1_1],         %[step2_30]     \n\t"
759        "sb       %[temp0],         0(%[dest_pix])                      \n\t"
760        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
761        "lbu      %[temp3],         0(%[dest_pix])                      \n\t"
762        "addi     %[temp1],         %[temp1],           32              \n\t"
763        "sra      %[temp1],         %[temp1],           6               \n\t"
764        "add      %[temp3],         %[temp3],           %[temp1]        \n\t"
765        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
766        "sb       %[temp1],         0(%[dest_pix])                      \n\t"
767        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
768
769        "lbu      %[temp2],         0(%[dest_pix])                      \n\t"
770        "add      %[temp0],         %[step1_2],         %[step2_29]     \n\t"
771        "addi     %[temp0],         %[temp0],           32              \n\t"
772        "sra      %[temp0],         %[temp0],           6               \n\t"
773        "add      %[temp2],         %[temp2],           %[temp0]        \n\t"
774        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
775        "add      %[temp1],         %[step1_3],         %[step2_28]     \n\t"
776        "sb       %[temp0],         0(%[dest_pix])                      \n\t"
777        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
778        "lbu      %[temp3],         0(%[dest_pix])                      \n\t"
779        "addi     %[temp1],         %[temp1],           32              \n\t"
780        "sra      %[temp1],         %[temp1],           6               \n\t"
781        "add      %[temp3],         %[temp3],           %[temp1]        \n\t"
782        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
783        "sb       %[temp1],         0(%[dest_pix])                      \n\t"
784        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
785
786        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
787          [temp3] "=&r" (temp3), [dest_pix] "+r" (dest_pix)
788        : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
789          [step1_0] "r" (step1_0), [step1_1] "r" (step1_1),
790          [step1_2] "r" (step1_2), [step1_3] "r" (step1_3),
791          [step2_28] "r" (step2_28), [step2_29] "r" (step2_29),
792          [step2_30] "r" (step2_30), [step2_31] "r" (step2_31)
793    );
794
795    step3_12 = ROUND_POWER_OF_TWO((step1_3 - step2_28), 6);
796    step3_13 = ROUND_POWER_OF_TWO((step1_2 - step2_29), 6);
797    step3_14 = ROUND_POWER_OF_TWO((step1_1 - step2_30), 6);
798    step3_15 = ROUND_POWER_OF_TWO((step1_0 - step2_31), 6);
799
800    __asm__ __volatile__ (
801        "lbu      %[temp2],         0(%[dest_pix1])                     \n\t"
802        "add      %[temp2],         %[temp2],           %[step3_15]     \n\t"
803        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
804        "sb       %[temp0],         0(%[dest_pix1])                     \n\t"
805        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
806        "lbu      %[temp3],         0(%[dest_pix1])                     \n\t"
807        "add      %[temp3],         %[temp3],           %[step3_14]     \n\t"
808        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
809        "sb       %[temp1],         0(%[dest_pix1])                     \n\t"
810        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
811
812        "lbu      %[temp2],         0(%[dest_pix1])                     \n\t"
813        "add      %[temp2],         %[temp2],           %[step3_13]     \n\t"
814        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
815        "sb       %[temp0],         0(%[dest_pix1])                     \n\t"
816        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
817        "lbu      %[temp3],         0(%[dest_pix1])                     \n\t"
818        "add      %[temp3],         %[temp3],           %[step3_12]     \n\t"
819        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
820        "sb       %[temp1],         0(%[dest_pix1])                     \n\t"
821        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
822
823        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
824          [temp3] "=&r" (temp3), [dest_pix1] "+r" (dest_pix1)
825        : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
826          [step3_12] "r" (step3_12), [step3_13] "r" (step3_13),
827          [step3_14] "r" (step3_14), [step3_15] "r" (step3_15)
828    );
829
830    __asm__ __volatile__ (
831        "lbu      %[temp2],         0(%[dest_pix])                      \n\t"
832        "add      %[temp0],         %[step1_4],         %[step1_27]     \n\t"
833        "addi     %[temp0],         %[temp0],           32              \n\t"
834        "sra      %[temp0],         %[temp0],           6               \n\t"
835        "add      %[temp2],         %[temp2],           %[temp0]        \n\t"
836        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
837        "add      %[temp1],         %[step1_5],         %[step1_26]     \n\t"
838        "sb       %[temp0],         0(%[dest_pix])                      \n\t"
839        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
840        "lbu      %[temp3],         0(%[dest_pix])                      \n\t"
841        "addi     %[temp1],         %[temp1],           32              \n\t"
842        "sra      %[temp1],         %[temp1],           6               \n\t"
843        "add      %[temp3],         %[temp3],           %[temp1]        \n\t"
844        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
845        "sb       %[temp1],         0(%[dest_pix])                      \n\t"
846        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
847
848        "lbu      %[temp2],         0(%[dest_pix])                      \n\t"
849        "add      %[temp0],         %[step1_6],         %[step1_25]     \n\t"
850        "addi     %[temp0],         %[temp0],           32              \n\t"
851        "sra      %[temp0],         %[temp0],           6               \n\t"
852        "add      %[temp2],         %[temp2],           %[temp0]        \n\t"
853        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
854        "add      %[temp1],         %[step1_7],         %[step1_24]     \n\t"
855        "sb       %[temp0],         0(%[dest_pix])                      \n\t"
856        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
857        "lbu      %[temp3],         0(%[dest_pix])                      \n\t"
858        "addi     %[temp1],         %[temp1],           32              \n\t"
859        "sra      %[temp1],         %[temp1],           6               \n\t"
860        "add      %[temp3],         %[temp3],           %[temp1]        \n\t"
861        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
862        "sb       %[temp1],         0(%[dest_pix])                      \n\t"
863        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
864
865        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
866          [temp3] "=&r" (temp3), [dest_pix] "+r" (dest_pix)
867        : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
868          [step1_4] "r" (step1_4), [step1_5] "r" (step1_5),
869          [step1_6] "r" (step1_6), [step1_7] "r" (step1_7),
870          [step1_24] "r" (step1_24), [step1_25] "r" (step1_25),
871          [step1_26] "r" (step1_26), [step1_27] "r" (step1_27)
872    );
873
874    step3_12 = ROUND_POWER_OF_TWO((step1_7 - step1_24), 6);
875    step3_13 = ROUND_POWER_OF_TWO((step1_6 - step1_25), 6);
876    step3_14 = ROUND_POWER_OF_TWO((step1_5 - step1_26), 6);
877    step3_15 = ROUND_POWER_OF_TWO((step1_4 - step1_27), 6);
878
879    __asm__ __volatile__ (
880        "lbu      %[temp2],         0(%[dest_pix1])                     \n\t"
881        "add      %[temp2],         %[temp2],           %[step3_15]     \n\t"
882        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
883        "sb       %[temp0],         0(%[dest_pix1])                     \n\t"
884        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
885        "lbu      %[temp3],         0(%[dest_pix1])                     \n\t"
886        "add      %[temp3],         %[temp3],           %[step3_14]     \n\t"
887        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
888        "sb       %[temp1],         0(%[dest_pix1])                     \n\t"
889        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
890
891        "lbu      %[temp2],         0(%[dest_pix1])                     \n\t"
892        "add      %[temp2],         %[temp2],           %[step3_13]     \n\t"
893        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
894        "sb       %[temp0],         0(%[dest_pix1])                     \n\t"
895        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
896        "lbu      %[temp3],         0(%[dest_pix1])                     \n\t"
897        "add      %[temp3],         %[temp3],           %[step3_12]     \n\t"
898        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
899        "sb       %[temp1],         0(%[dest_pix1])                     \n\t"
900        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
901
902        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
903          [temp3] "=&r" (temp3), [dest_pix1] "+r" (dest_pix1)
904        : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
905          [step3_12] "r" (step3_12), [step3_13] "r" (step3_13),
906          [step3_14] "r" (step3_14), [step3_15] "r" (step3_15)
907    );
908
909    __asm__ __volatile__ (
910        "lbu      %[temp2],         0(%[dest_pix])                      \n\t"
911        "add      %[temp0],         %[step1_8],         %[step1_23]     \n\t"
912        "addi     %[temp0],         %[temp0],           32              \n\t"
913        "sra      %[temp0],         %[temp0],           6               \n\t"
914        "add      %[temp2],         %[temp2],           %[temp0]        \n\t"
915        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
916        "add      %[temp1],         %[step1_9],         %[step1_22]     \n\t"
917        "sb       %[temp0],         0(%[dest_pix])                      \n\t"
918        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
919        "lbu      %[temp3],         0(%[dest_pix])                      \n\t"
920        "addi     %[temp1],         %[temp1],           32              \n\t"
921        "sra      %[temp1],         %[temp1],           6               \n\t"
922        "add      %[temp3],         %[temp3],           %[temp1]        \n\t"
923        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
924        "sb       %[temp1],         0(%[dest_pix])                      \n\t"
925        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
926
927        "lbu      %[temp2],         0(%[dest_pix])                      \n\t"
928        "add      %[temp0],         %[step1_10],        %[step1_21]     \n\t"
929        "addi     %[temp0],         %[temp0],           32              \n\t"
930        "sra      %[temp0],         %[temp0],           6               \n\t"
931        "add      %[temp2],         %[temp2],           %[temp0]        \n\t"
932        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
933        "add      %[temp1],         %[step1_11],        %[step1_20]     \n\t"
934        "sb       %[temp0],         0(%[dest_pix])                      \n\t"
935        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
936        "lbu      %[temp3],         0(%[dest_pix])                      \n\t"
937        "addi     %[temp1],         %[temp1],           32              \n\t"
938        "sra      %[temp1],         %[temp1],           6               \n\t"
939        "add      %[temp3],         %[temp3],           %[temp1]        \n\t"
940        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
941        "sb       %[temp1],         0(%[dest_pix])                      \n\t"
942        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
943
944        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
945          [temp3] "=&r" (temp3), [dest_pix] "+r" (dest_pix)
946        : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
947          [step1_8] "r" (step1_8), [step1_9] "r" (step1_9),
948          [step1_10] "r" (step1_10), [step1_11] "r" (step1_11),
949          [step1_20] "r" (step1_20), [step1_21] "r" (step1_21),
950          [step1_22] "r" (step1_22), [step1_23] "r" (step1_23)
951    );
952
953    step3_12 = ROUND_POWER_OF_TWO((step1_11 - step1_20), 6);
954    step3_13 = ROUND_POWER_OF_TWO((step1_10 - step1_21), 6);
955    step3_14 = ROUND_POWER_OF_TWO((step1_9 - step1_22), 6);
956    step3_15 = ROUND_POWER_OF_TWO((step1_8 - step1_23), 6);
957
958    __asm__ __volatile__ (
959        "lbu      %[temp2],         0(%[dest_pix1])                     \n\t"
960        "add      %[temp2],         %[temp2],           %[step3_15]     \n\t"
961        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
962        "sb       %[temp0],         0(%[dest_pix1])                     \n\t"
963        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
964        "lbu      %[temp3],         0(%[dest_pix1])                     \n\t"
965        "add      %[temp3],         %[temp3],           %[step3_14]     \n\t"
966        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
967        "sb       %[temp1],         0(%[dest_pix1])                     \n\t"
968        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
969
970        "lbu      %[temp2],         0(%[dest_pix1])                     \n\t"
971        "add      %[temp2],         %[temp2],           %[step3_13]     \n\t"
972        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
973        "sb       %[temp0],         0(%[dest_pix1])                     \n\t"
974        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
975        "lbu      %[temp3],         0(%[dest_pix1])                     \n\t"
976        "add      %[temp3],         %[temp3],           %[step3_12]     \n\t"
977        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
978        "sb       %[temp1],         0(%[dest_pix1])                     \n\t"
979        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
980
981        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
982          [temp3] "=&r" (temp3), [dest_pix1] "+r" (dest_pix1)
983        : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
984          [step3_12] "r" (step3_12), [step3_13] "r" (step3_13),
985          [step3_14] "r" (step3_14), [step3_15] "r" (step3_15)
986    );
987
988    __asm__ __volatile__ (
989        "lbu      %[temp2],         0(%[dest_pix])                      \n\t"
990        "add      %[temp0],         %[step1_12],        %[step2_19]     \n\t"
991        "addi     %[temp0],         %[temp0],           32              \n\t"
992        "sra      %[temp0],         %[temp0],           6               \n\t"
993        "add      %[temp2],         %[temp2],           %[temp0]        \n\t"
994        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
995        "add      %[temp1],         %[step1_13],        %[step2_18]     \n\t"
996        "sb       %[temp0],         0(%[dest_pix])                      \n\t"
997        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
998        "lbu      %[temp3],         0(%[dest_pix])                      \n\t"
999        "addi     %[temp1],         %[temp1],           32              \n\t"
1000        "sra      %[temp1],         %[temp1],           6               \n\t"
1001        "add      %[temp3],         %[temp3],           %[temp1]        \n\t"
1002        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
1003        "sb       %[temp1],         0(%[dest_pix])                      \n\t"
1004        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
1005
1006        "lbu      %[temp2],         0(%[dest_pix])                      \n\t"
1007        "add      %[temp0],         %[step1_14],        %[step2_17]     \n\t"
1008        "addi     %[temp0],         %[temp0],           32              \n\t"
1009        "sra      %[temp0],         %[temp0],           6               \n\t"
1010        "add      %[temp2],         %[temp2],           %[temp0]        \n\t"
1011        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
1012        "add      %[temp1],         %[step1_15],        %[step2_16]     \n\t"
1013        "sb       %[temp0],         0(%[dest_pix])                      \n\t"
1014        "addu     %[dest_pix],      %[dest_pix],        %[dest_stride]  \n\t"
1015        "lbu      %[temp3],         0(%[dest_pix])                      \n\t"
1016        "addi     %[temp1],         %[temp1],           32              \n\t"
1017        "sra      %[temp1],         %[temp1],           6               \n\t"
1018        "add      %[temp3],         %[temp3],           %[temp1]        \n\t"
1019        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
1020        "sb       %[temp1],         0(%[dest_pix])                      \n\t"
1021
1022        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
1023          [temp3] "=&r" (temp3), [dest_pix] "+r" (dest_pix)
1024        : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
1025          [step1_12] "r" (step1_12), [step1_13] "r" (step1_13),
1026          [step1_14] "r" (step1_14), [step1_15] "r" (step1_15),
1027          [step2_16] "r" (step2_16), [step2_17] "r" (step2_17),
1028          [step2_18] "r" (step2_18), [step2_19] "r" (step2_19)
1029    );
1030
1031    step3_12 = ROUND_POWER_OF_TWO((step1_15 - step2_16), 6);
1032    step3_13 = ROUND_POWER_OF_TWO((step1_14 - step2_17), 6);
1033    step3_14 = ROUND_POWER_OF_TWO((step1_13 - step2_18), 6);
1034    step3_15 = ROUND_POWER_OF_TWO((step1_12 - step2_19), 6);
1035
1036    __asm__ __volatile__ (
1037        "lbu      %[temp2],         0(%[dest_pix1])                     \n\t"
1038        "add      %[temp2],         %[temp2],           %[step3_15]     \n\t"
1039        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
1040        "sb       %[temp0],         0(%[dest_pix1])                     \n\t"
1041        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
1042        "lbu      %[temp3],         0(%[dest_pix1])                     \n\t"
1043        "add      %[temp3],         %[temp3],           %[step3_14]     \n\t"
1044        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
1045        "sb       %[temp1],         0(%[dest_pix1])                     \n\t"
1046        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
1047
1048        "lbu      %[temp2],         0(%[dest_pix1])                     \n\t"
1049        "add      %[temp2],         %[temp2],           %[step3_13]     \n\t"
1050        "lbux     %[temp0],         %[temp2](%[cm])                     \n\t"
1051        "sb       %[temp0],         0(%[dest_pix1])                     \n\t"
1052        "subu     %[dest_pix1],     %[dest_pix1],       %[dest_stride]  \n\t"
1053        "lbu      %[temp3],         0(%[dest_pix1])                     \n\t"
1054        "add      %[temp3],         %[temp3],           %[step3_12]     \n\t"
1055        "lbux     %[temp1],         %[temp3](%[cm])                     \n\t"
1056        "sb       %[temp1],         0(%[dest_pix1])                     \n\t"
1057
1058        : [temp0] "=&r" (temp0), [temp1] "=&r" (temp1), [temp2] "=&r" (temp2),
1059          [temp3] "=&r" (temp3), [dest_pix1] "+r" (dest_pix1)
1060        : [cm] "r" (cm), [dest_stride] "r" (dest_stride),
1061          [step3_12] "r" (step3_12), [step3_13] "r" (step3_13),
1062          [step3_14] "r" (step3_14), [step3_15] "r" (step3_15)
1063    );
1064
1065    input += 32;
1066  }
1067}
1068#endif  // #if HAVE_DSPR2
1069