Mercurial > libavcodec.hg
annotate ps2/idct_mmi.c @ 3694:8765ee4eaa45 libavcodec
Drop unneeded checks before av_free() and change to av_freep() where it's more suitable.
author | kostya |
---|---|
date | Sat, 09 Sep 2006 11:40:41 +0000 |
parents | 7690bafea6e0 |
children | c8c591fe26f8 |
rev | line source |
---|---|
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
1 /* |
3680
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
2 * Originally provided by Intel at Application Note AP-922. |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
3 * |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
4 * Column code adapted from Peter Gubanov. |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
5 * Copyright (c) 2000-2001 Peter Gubanov <peter@elecard.net.ru> |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
6 * http://www.elecard.com/peter/idct.shtml |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
7 * rounding trick copyright (c) 2000 Michel Lespinasse <walken@zoy.org> |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
8 * |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
9 * MMI port and (c) 2002 by Leon van Stuivenberg |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
10 * |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
11 * This library is free software; you can redistribute it and/or |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
12 * modify it under the terms of the GNU Lesser General Public |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
13 * License as published by the Free Software Foundation; either |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
14 * version 2 of the License, or (at your option) any later version. |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
15 * |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
16 * This library is distributed in the hope that it will be useful, |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
19 * Lesser General Public License for more details. |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
20 * |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
21 * You should have received a copy of the GNU Lesser General Public |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
22 * License along with this library; if not, write to the Free Software |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
24 * |
7690bafea6e0
Mark this file properly as LGPL as allowed by its author Leon van Stuivenberg.
diego
parents:
2979
diff
changeset
|
25 */ |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
26 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
27 #include "../common.h" |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
28 #include "../dsputil.h" |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
29 #include "mmi.h" |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
30 |
2979 | 31 #define BITS_INV_ACC 5 // 4 or 5 for IEEE |
32 #define SHIFT_INV_ROW (16 - BITS_INV_ACC) | |
696
477bcb3b2f0a
ps2 idct bugfix patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
689
diff
changeset
|
33 #define SHIFT_INV_COL (1 + BITS_INV_ACC) |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
34 |
2979 | 35 #define TG1 6518 |
36 #define TG2 13573 | |
37 #define TG3 21895 | |
38 #define CS4 23170 | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
39 |
2979 | 40 #define ROUNDER_0 0 |
41 #define ROUNDER_1 16 | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
42 |
2979 | 43 #define TAB_i_04 (32+0) |
44 #define TAB_i_17 (32+64) | |
45 #define TAB_i_26 (32+128) | |
46 #define TAB_i_35 (32+192) | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
47 |
2979 | 48 #define TG_1_16 (32+256+0) |
49 #define TG_2_16 (32+256+16) | |
50 #define TG_3_16 (32+256+32) | |
51 #define COS_4_16 (32+256+48) | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
52 |
2979 | 53 #define CLIPMAX (32+256+64+0) |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
54 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
55 static short consttable[] align16 = { |
2979 | 56 /* rounder 0*/ // assume SHIFT_INV_ROW == 11 |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
57 0x3ff, 1, 0x3ff, 1, 0x3ff, 1, 0x3ff, 1, |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
58 /* rounder 1*/ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
59 0x3ff, 0, 0x3ff, 0, 0x3ff, 0, 0x3ff, 0, |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
60 /* row 0/4*/ |
2967 | 61 16384, 21407, -16384, -21407, 22725, 19266, -22725, -12873, |
62 8867, 16384, 8867, 16384, 4520, 12873, -4520, 19266, | |
63 16384, -8867, 16384, -8867, 12873, -22725, 19266, -22725, | |
64 21407, -16384, -21407, 16384, 19266, 4520, -12873, 4520, | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
65 /* row 1/7*/ |
2967 | 66 22725, 29692, -22725, -29692, 31521, 26722, -31521, -17855, |
67 12299, 22725, 12299, 22725, 6270, 17855, -6270, 26722, | |
68 22725, -12299, 22725, -12299, 17855, -31521, 26722, -31521, | |
69 29692, -22725, -29692, 22725, 26722, 6270, -17855, 6270, | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
70 /* row 2/6*/ |
2967 | 71 21407, 27969, -21407, -27969, 29692, 25172, -29692, -16819, |
72 11585, 21407, 11585, 21407, 5906, 16819, -5906, 25172, | |
73 21407, -11585, 21407, -11585, 16819, -29692, 25172, -29692, | |
74 27969, -21407, -27969, 21407, 25172, 5906, -16819, 5906, | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
75 /*row 3/5*/ |
2967 | 76 19266, 25172, -19266, -25172, 26722, 22654, -26722, -15137, |
77 10426, 19266, 10426, 19266, 5315, 15137, -5315, 22654, | |
78 19266, -10426, 19266, -10426, 15137, -26722, 22654, -26722, | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
79 25172, -19266, -25172, 19266, 22654, 5315, -15137, 5315, |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
80 /*column constants*/ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
81 TG1, TG1, TG1, TG1, TG1, TG1, TG1, TG1, |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
82 TG2, TG2, TG2, TG2, TG2, TG2, TG2, TG2, |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
83 TG3, TG3, TG3, TG3, TG3, TG3, TG3, TG3, |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
84 CS4, CS4, CS4, CS4, CS4, CS4, CS4, CS4, |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
85 /* clamp */ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
86 255, 255, 255, 255, 255, 255, 255, 255 |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
87 }; |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
88 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
89 |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
90 #define DCT_8_INV_ROW1(blk, rowoff, taboff, rnd, outreg) { \ |
2979 | 91 lq(blk, rowoff, $16); /* r16 = x7 x5 x3 x1 x6 x4 x2 x0 */ \ |
92 /*slot*/ \ | |
93 lq($24, 0+taboff, $17); /* r17 = w */ \ | |
94 /*delay slot $16*/ \ | |
95 lq($24, 16+taboff, $18);/* r18 = w */ \ | |
96 prevh($16, $2); /* r2 = x1 x3 x5 x7 x0 x2 x4 x6 */ \ | |
97 lq($24, 32+taboff, $19);/* r19 = w */ \ | |
98 phmadh($17, $16, $17); /* r17 = b1"b0'a1"a0' */ \ | |
99 lq($24, 48+taboff, $20);/* r20 = w */ \ | |
100 phmadh($18, $2, $18); /* r18 = b1'b0"a1'a0" */ \ | |
101 phmadh($19, $16, $19); /* r19 = b3"b2'a3"a2' */ \ | |
102 phmadh($20, $2, $20); /* r20 = b3'b2"a3'a2" */ \ | |
103 paddw($17, $18, $17); /* r17 = (b1)(b0)(a1)(a0) */ \ | |
104 paddw($19, $20, $19); /* r19 = (b3)(b2)(a3)(a2) */ \ | |
105 pcpyld($19, $17, $18); /* r18 = (a3)(a2)(a1)(a0) */ \ | |
106 pcpyud($17, $19, $20); /* r20 = (b3)(b2)(b1)(b0) */ \ | |
107 paddw($18, rnd, $18); /* r18 = (a3)(a2)(a1)(a0) */\ | |
108 paddw($18, $20, $17); /* r17 = ()()()(a0+b0) */ \ | |
109 psubw($18, $20, $20); /* r20 = ()()()(a0-b0) */ \ | |
110 psraw($17, SHIFT_INV_ROW, $17); /* r17 = (y3 y2 y1 y0) */ \ | |
111 psraw($20, SHIFT_INV_ROW, $20); /* r20 = (y4 y5 y6 y7) */ \ | |
112 ppach($20, $17, outreg);/* out = y4 y5 y6 y7 y3 y2 y1 y0 Note order */ \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
113 \ |
2979 | 114 prevh(outreg, $2); \ |
115 pcpyud($2, $2, $2); \ | |
116 pcpyld($2, outreg, outreg); \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
117 } |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
118 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
119 |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
120 #define DCT_8_INV_COL8() \ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
121 \ |
2979 | 122 lq($24, TG_3_16, $2); /* r2 = tn3 */ \ |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
123 \ |
2979 | 124 pmulth($11, $2, $17); /* r17 = x3 * tn3 (6420) */ \ |
125 psraw($17, 15, $17); \ | |
126 pmfhl_uw($3); /* r3 = 7531 */ \ | |
127 psraw($3, 15, $3); \ | |
128 pinteh($3, $17, $17); /* r17 = x3 * tn3 */ \ | |
129 psubh($17, $13, $17); /* r17 = tm35 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
130 \ |
2979 | 131 pmulth($13, $2, $18); /* r18 = x5 * tn3 (6420) */ \ |
132 psraw($18, 15, $18); \ | |
133 pmfhl_uw($3); /* r3 = 7531 */ \ | |
134 psraw($3, 15, $3); \ | |
135 pinteh($3, $18, $18); /* r18 = x5 * tn3 */ \ | |
136 paddh($18, $11, $18); /* r18 = tp35 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
137 \ |
2979 | 138 lq($24, TG_1_16, $2); /* r2 = tn1 */ \ |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
139 \ |
2979 | 140 pmulth($15, $2, $19); /* r19 = x7 * tn1 (6420) */ \ |
141 psraw($19, 15, $19); \ | |
142 pmfhl_uw($3); /* r3 = 7531 */ \ | |
143 psraw($3, 15, $3); \ | |
144 pinteh($3, $19, $19); /* r19 = x7 * tn1 */ \ | |
145 paddh($19, $9, $19); /* r19 = tp17 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
146 \ |
2979 | 147 pmulth($9, $2, $20); /* r20 = x1 * tn1 (6420) */ \ |
148 psraw($20, 15, $20); \ | |
149 pmfhl_uw($3); /* r3 = 7531 */ \ | |
150 psraw($3, 15, $3); \ | |
151 pinteh($3, $20, $20); /* r20 = x1 * tn1 */ \ | |
152 psubh($20, $15, $20); /* r20 = tm17 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
153 \ |
2979 | 154 psubh($19, $18, $3); /* r3 = t1 */ \ |
155 paddh($20, $17, $16); /* r16 = t2 */ \ | |
156 psubh($20, $17, $23); /* r23 = b3 */ \ | |
157 paddh($19, $18, $20); /* r20 = b0 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
158 \ |
2979 | 159 lq($24, COS_4_16, $2); /* r2 = cs4 */ \ |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
160 \ |
2979 | 161 paddh($3, $16, $21); /* r21 = t1+t2 */ \ |
162 psubh($3, $16, $22); /* r22 = t1-t2 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
163 \ |
2979 | 164 pmulth($21, $2, $21); /* r21 = cs4 * (t1+t2) 6420 */ \ |
165 psraw($21, 15, $21); \ | |
166 pmfhl_uw($3); /* r3 = 7531 */ \ | |
167 psraw($3, 15, $3); \ | |
168 pinteh($3, $21, $21); /* r21 = b1 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
169 \ |
2979 | 170 pmulth($22, $2, $22); /* r22 = cs4 * (t1-t2) 6420 */ \ |
171 psraw($22, 15, $22); \ | |
172 pmfhl_uw($3); /* r3 = 7531 */ \ | |
173 psraw($3, 15, $3); \ | |
174 pinteh($3, $22, $22); /* r22 = b2 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
175 \ |
2979 | 176 lq($24, TG_2_16, $2); /* r2 = tn2 */ \ |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
177 \ |
2979 | 178 pmulth($10, $2, $17); /* r17 = x2 * tn2 (6420) */ \ |
179 psraw($17, 15, $17); \ | |
180 pmfhl_uw($3); /* r3 = 7531 */ \ | |
181 psraw($3, 15, $3); \ | |
182 pinteh($3, $17, $17); /* r17 = x3 * tn3 */ \ | |
183 psubh($17, $14, $17); /* r17 = tm26 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
184 \ |
2979 | 185 pmulth($14, $2, $18); /* r18 = x6 * tn2 (6420) */ \ |
186 psraw($18, 15, $18); \ | |
187 pmfhl_uw($3); /* r3 = 7531 */ \ | |
188 psraw($3, 15, $3); \ | |
189 pinteh($3, $18, $18); /* r18 = x6 * tn2 */ \ | |
190 paddh($18, $10, $18); /* r18 = tp26 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
191 \ |
2979 | 192 paddh($8, $12, $2); /* r2 = tp04 */ \ |
193 psubh($8, $12, $3); /* r3 = tm04 */ \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
194 \ |
2979 | 195 paddh($2, $18, $16); /* r16 = a0 */ \ |
196 psubh($2, $18, $19); /* r19 = a3 */ \ | |
197 psubh($3, $17, $18); /* r18 = a2 */ \ | |
198 paddh($3, $17, $17); /* r17 = a1 */ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
199 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
200 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
201 #define DCT_8_INV_COL8_STORE(blk) \ |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
202 \ |
2979 | 203 paddh($16, $20, $2); /* y0 a0+b0 */ \ |
204 psubh($16, $20, $16); /* y7 a0-b0 */ \ | |
205 psrah($2, SHIFT_INV_COL, $2); \ | |
206 psrah($16, SHIFT_INV_COL, $16); \ | |
207 sq($2, 0, blk); \ | |
208 sq($16, 112, blk); \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
209 \ |
2979 | 210 paddh($17, $21, $3); /* y1 a1+b1 */ \ |
211 psubh($17, $21, $17); /* y6 a1-b1 */ \ | |
212 psrah($3, SHIFT_INV_COL, $3); \ | |
213 psrah($17, SHIFT_INV_COL, $17); \ | |
214 sq($3, 16, blk); \ | |
215 sq($17, 96, blk); \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
216 \ |
2979 | 217 paddh($18, $22, $2); /* y2 a2+b2 */ \ |
218 psubh($18, $22, $18); /* y5 a2-b2 */ \ | |
219 psrah($2, SHIFT_INV_COL, $2); \ | |
220 psrah($18, SHIFT_INV_COL, $18); \ | |
221 sq($2, 32, blk); \ | |
222 sq($18, 80, blk); \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
223 \ |
2979 | 224 paddh($19, $23, $3); /* y3 a3+b3 */ \ |
225 psubh($19, $23, $19); /* y4 a3-b3 */ \ | |
226 psrah($3, SHIFT_INV_COL, $3); \ | |
227 psrah($19, SHIFT_INV_COL, $19); \ | |
228 sq($3, 48, blk); \ | |
229 sq($19, 64, blk); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
230 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
231 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
232 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
233 #define DCT_8_INV_COL8_PMS() \ |
2979 | 234 paddh($16, $20, $2); /* y0 a0+b0 */ \ |
235 psubh($16, $20, $20); /* y7 a0-b0 */ \ | |
236 psrah($2, SHIFT_INV_COL, $16); \ | |
237 psrah($20, SHIFT_INV_COL, $20); \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
238 \ |
2979 | 239 paddh($17, $21, $3); /* y1 a1+b1 */ \ |
240 psubh($17, $21, $21); /* y6 a1-b1 */ \ | |
241 psrah($3, SHIFT_INV_COL, $17); \ | |
242 psrah($21, SHIFT_INV_COL, $21); \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
243 \ |
2979 | 244 paddh($18, $22, $2); /* y2 a2+b2 */ \ |
245 psubh($18, $22, $22); /* y5 a2-b2 */ \ | |
246 psrah($2, SHIFT_INV_COL, $18); \ | |
247 psrah($22, SHIFT_INV_COL, $22); \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
248 \ |
2979 | 249 paddh($19, $23, $3); /* y3 a3+b3 */ \ |
250 psubh($19, $23, $23); /* y4 a3-b3 */ \ | |
251 psrah($3, SHIFT_INV_COL, $19); \ | |
252 psrah($23, SHIFT_INV_COL, $23); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
253 |
2979 | 254 #define PUT(rs) \ |
255 pminh(rs, $11, $2); \ | |
256 pmaxh($2, $0, $2); \ | |
257 ppacb($0, $2, $2); \ | |
258 sd3(2, 0, 4); \ | |
259 __asm__ __volatile__ ("add $4, $5, $4"); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
260 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
261 #define DCT_8_INV_COL8_PUT() \ |
2979 | 262 PUT($16); \ |
263 PUT($17); \ | |
264 PUT($18); \ | |
265 PUT($19); \ | |
266 PUT($23); \ | |
267 PUT($22); \ | |
268 PUT($21); \ | |
269 PUT($20); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
270 |
2979 | 271 #define ADD(rs) \ |
272 ld3(4, 0, 2); \ | |
273 pextlb($0, $2, $2); \ | |
274 paddh($2, rs, $2); \ | |
275 pminh($2, $11, $2); \ | |
276 pmaxh($2, $0, $2); \ | |
277 ppacb($0, $2, $2); \ | |
278 sd3(2, 0, 4); \ | |
279 __asm__ __volatile__ ("add $4, $5, $4"); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
280 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
281 /*fixme: schedule*/ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
282 #define DCT_8_INV_COL8_ADD() \ |
2979 | 283 ADD($16); \ |
284 ADD($17); \ | |
285 ADD($18); \ | |
286 ADD($19); \ | |
287 ADD($23); \ | |
288 ADD($22); \ | |
289 ADD($21); \ | |
290 ADD($20); | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
291 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
292 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
293 void ff_mmi_idct(int16_t * block) |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
294 { |
2979 | 295 /* $4 = block */ |
296 __asm__ __volatile__("la $24, %0"::"m"(consttable[0])); | |
297 lq($24, ROUNDER_0, $8); | |
298 lq($24, ROUNDER_1, $7); | |
299 DCT_8_INV_ROW1($4, 0, TAB_i_04, $8, $8); | |
300 DCT_8_INV_ROW1($4, 16, TAB_i_17, $7, $9); | |
301 DCT_8_INV_ROW1($4, 32, TAB_i_26, $7, $10); | |
302 DCT_8_INV_ROW1($4, 48, TAB_i_35, $7, $11); | |
303 DCT_8_INV_ROW1($4, 64, TAB_i_04, $7, $12); | |
304 DCT_8_INV_ROW1($4, 80, TAB_i_35, $7, $13); | |
305 DCT_8_INV_ROW1($4, 96, TAB_i_26, $7, $14); | |
306 DCT_8_INV_ROW1($4, 112, TAB_i_17, $7, $15); | |
307 DCT_8_INV_COL8(); | |
308 DCT_8_INV_COL8_STORE($4); | |
2967 | 309 |
2979 | 310 //let savedtemp regs be saved |
311 __asm__ __volatile__(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23"); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
312 } |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
313 |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
314 |
1064 | 315 void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block) |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
316 { |
2979 | 317 /* $4 = dest, $5 = line_size, $6 = block */ |
318 __asm__ __volatile__("la $24, %0"::"m"(consttable[0])); | |
319 lq($24, ROUNDER_0, $8); | |
320 lq($24, ROUNDER_1, $7); | |
321 DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8); | |
322 DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9); | |
323 DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10); | |
324 DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11); | |
325 DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12); | |
326 DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13); | |
327 DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14); | |
328 DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15); | |
329 DCT_8_INV_COL8(); | |
330 lq($24, CLIPMAX, $11); | |
331 DCT_8_INV_COL8_PMS(); | |
332 DCT_8_INV_COL8_PUT(); | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
333 |
2979 | 334 //let savedtemp regs be saved |
335 __asm__ __volatile__(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23"); | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
336 } |
696
477bcb3b2f0a
ps2 idct bugfix patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
689
diff
changeset
|
337 |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
338 |
1064 | 339 void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block) |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
340 { |
2979 | 341 /* $4 = dest, $5 = line_size, $6 = block */ |
342 __asm__ __volatile__("la $24, %0"::"m"(consttable[0])); | |
343 lq($24, ROUNDER_0, $8); | |
344 lq($24, ROUNDER_1, $7); | |
345 DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8); | |
346 DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9); | |
347 DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10); | |
348 DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11); | |
349 DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12); | |
350 DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13); | |
351 DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14); | |
352 DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15); | |
353 DCT_8_INV_COL8(); | |
354 lq($24, CLIPMAX, $11); | |
355 DCT_8_INV_COL8_PMS(); | |
356 DCT_8_INV_COL8_ADD(); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
357 |
2979 | 358 //let savedtemp regs be saved |
359 __asm__ __volatile__(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23"); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
360 } |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
361 |