Mercurial > libavcodec.hg
annotate ps2/idct_mmi.c @ 3014:959b8ad880dc libavcodec
Dual mono stereo strems sound ok now, added sanity checks and removed
some unused variables and redundant memsets.
Patch by Benjamin Larsson
author | rtognimp |
---|---|
date | Fri, 06 Jan 2006 12:41:57 +0000 |
parents | bfabfdf9ce55 |
children | 7690bafea6e0 |
rev | line source |
---|---|
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
1 /* |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
2 Originally provided by Intel at AP-922 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
3 http://developer.intel.com/vtune/cbts/strmsimd/922down.htm |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
4 (See more app notes at http://developer.intel.com/vtune/cbts/strmsimd/appnotes.htm) |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
5 but in a limited edition. |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
6 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
7 column code adapted from peter gubanov |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
8 Copyright (c) 2000-2001 Peter Gubanov <peter@elecard.net.ru> |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
9 http://www.elecard.com/peter/idct.shtml |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
10 Rounding trick Copyright (c) 2000 Michel Lespinasse <walken@zoy.org> |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
11 |
1876 | 12 MMI port by Leon van Stuivenberg |
2967 | 13 */ |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
14 #include "../common.h" |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
15 #include "../dsputil.h" |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
16 #include "mmi.h" |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
17 |
2979 | 18 #define BITS_INV_ACC 5 // 4 or 5 for IEEE |
19 #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
|
20 #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
|
21 |
2979 | 22 #define TG1 6518 |
23 #define TG2 13573 | |
24 #define TG3 21895 | |
25 #define CS4 23170 | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
26 |
2979 | 27 #define ROUNDER_0 0 |
28 #define ROUNDER_1 16 | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
29 |
2979 | 30 #define TAB_i_04 (32+0) |
31 #define TAB_i_17 (32+64) | |
32 #define TAB_i_26 (32+128) | |
33 #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
|
34 |
2979 | 35 #define TG_1_16 (32+256+0) |
36 #define TG_2_16 (32+256+16) | |
37 #define TG_3_16 (32+256+32) | |
38 #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
|
39 |
2979 | 40 #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
|
41 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
42 static short consttable[] align16 = { |
2979 | 43 /* 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
|
44 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
|
45 /* rounder 1*/ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
46 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
|
47 /* row 0/4*/ |
2967 | 48 16384, 21407, -16384, -21407, 22725, 19266, -22725, -12873, |
49 8867, 16384, 8867, 16384, 4520, 12873, -4520, 19266, | |
50 16384, -8867, 16384, -8867, 12873, -22725, 19266, -22725, | |
51 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
|
52 /* row 1/7*/ |
2967 | 53 22725, 29692, -22725, -29692, 31521, 26722, -31521, -17855, |
54 12299, 22725, 12299, 22725, 6270, 17855, -6270, 26722, | |
55 22725, -12299, 22725, -12299, 17855, -31521, 26722, -31521, | |
56 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
|
57 /* row 2/6*/ |
2967 | 58 21407, 27969, -21407, -27969, 29692, 25172, -29692, -16819, |
59 11585, 21407, 11585, 21407, 5906, 16819, -5906, 25172, | |
60 21407, -11585, 21407, -11585, 16819, -29692, 25172, -29692, | |
61 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
|
62 /*row 3/5*/ |
2967 | 63 19266, 25172, -19266, -25172, 26722, 22654, -26722, -15137, |
64 10426, 19266, 10426, 19266, 5315, 15137, -5315, 22654, | |
65 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
|
66 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
|
67 /*column constants*/ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
68 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
|
69 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
|
70 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
|
71 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
|
72 /* clamp */ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
73 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
|
74 }; |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
75 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
76 |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
77 #define DCT_8_INV_ROW1(blk, rowoff, taboff, rnd, outreg) { \ |
2979 | 78 lq(blk, rowoff, $16); /* r16 = x7 x5 x3 x1 x6 x4 x2 x0 */ \ |
79 /*slot*/ \ | |
80 lq($24, 0+taboff, $17); /* r17 = w */ \ | |
81 /*delay slot $16*/ \ | |
82 lq($24, 16+taboff, $18);/* r18 = w */ \ | |
83 prevh($16, $2); /* r2 = x1 x3 x5 x7 x0 x2 x4 x6 */ \ | |
84 lq($24, 32+taboff, $19);/* r19 = w */ \ | |
85 phmadh($17, $16, $17); /* r17 = b1"b0'a1"a0' */ \ | |
86 lq($24, 48+taboff, $20);/* r20 = w */ \ | |
87 phmadh($18, $2, $18); /* r18 = b1'b0"a1'a0" */ \ | |
88 phmadh($19, $16, $19); /* r19 = b3"b2'a3"a2' */ \ | |
89 phmadh($20, $2, $20); /* r20 = b3'b2"a3'a2" */ \ | |
90 paddw($17, $18, $17); /* r17 = (b1)(b0)(a1)(a0) */ \ | |
91 paddw($19, $20, $19); /* r19 = (b3)(b2)(a3)(a2) */ \ | |
92 pcpyld($19, $17, $18); /* r18 = (a3)(a2)(a1)(a0) */ \ | |
93 pcpyud($17, $19, $20); /* r20 = (b3)(b2)(b1)(b0) */ \ | |
94 paddw($18, rnd, $18); /* r18 = (a3)(a2)(a1)(a0) */\ | |
95 paddw($18, $20, $17); /* r17 = ()()()(a0+b0) */ \ | |
96 psubw($18, $20, $20); /* r20 = ()()()(a0-b0) */ \ | |
97 psraw($17, SHIFT_INV_ROW, $17); /* r17 = (y3 y2 y1 y0) */ \ | |
98 psraw($20, SHIFT_INV_ROW, $20); /* r20 = (y4 y5 y6 y7) */ \ | |
99 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
|
100 \ |
2979 | 101 prevh(outreg, $2); \ |
102 pcpyud($2, $2, $2); \ | |
103 pcpyld($2, outreg, outreg); \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
104 } |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
105 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
106 |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
107 #define DCT_8_INV_COL8() \ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
108 \ |
2979 | 109 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
|
110 \ |
2979 | 111 pmulth($11, $2, $17); /* r17 = x3 * tn3 (6420) */ \ |
112 psraw($17, 15, $17); \ | |
113 pmfhl_uw($3); /* r3 = 7531 */ \ | |
114 psraw($3, 15, $3); \ | |
115 pinteh($3, $17, $17); /* r17 = x3 * tn3 */ \ | |
116 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
|
117 \ |
2979 | 118 pmulth($13, $2, $18); /* r18 = x5 * tn3 (6420) */ \ |
119 psraw($18, 15, $18); \ | |
120 pmfhl_uw($3); /* r3 = 7531 */ \ | |
121 psraw($3, 15, $3); \ | |
122 pinteh($3, $18, $18); /* r18 = x5 * tn3 */ \ | |
123 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
|
124 \ |
2979 | 125 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
|
126 \ |
2979 | 127 pmulth($15, $2, $19); /* r19 = x7 * tn1 (6420) */ \ |
128 psraw($19, 15, $19); \ | |
129 pmfhl_uw($3); /* r3 = 7531 */ \ | |
130 psraw($3, 15, $3); \ | |
131 pinteh($3, $19, $19); /* r19 = x7 * tn1 */ \ | |
132 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
|
133 \ |
2979 | 134 pmulth($9, $2, $20); /* r20 = x1 * tn1 (6420) */ \ |
135 psraw($20, 15, $20); \ | |
136 pmfhl_uw($3); /* r3 = 7531 */ \ | |
137 psraw($3, 15, $3); \ | |
138 pinteh($3, $20, $20); /* r20 = x1 * tn1 */ \ | |
139 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
|
140 \ |
2979 | 141 psubh($19, $18, $3); /* r3 = t1 */ \ |
142 paddh($20, $17, $16); /* r16 = t2 */ \ | |
143 psubh($20, $17, $23); /* r23 = b3 */ \ | |
144 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
|
145 \ |
2979 | 146 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
|
147 \ |
2979 | 148 paddh($3, $16, $21); /* r21 = t1+t2 */ \ |
149 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
|
150 \ |
2979 | 151 pmulth($21, $2, $21); /* r21 = cs4 * (t1+t2) 6420 */ \ |
152 psraw($21, 15, $21); \ | |
153 pmfhl_uw($3); /* r3 = 7531 */ \ | |
154 psraw($3, 15, $3); \ | |
155 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
|
156 \ |
2979 | 157 pmulth($22, $2, $22); /* r22 = cs4 * (t1-t2) 6420 */ \ |
158 psraw($22, 15, $22); \ | |
159 pmfhl_uw($3); /* r3 = 7531 */ \ | |
160 psraw($3, 15, $3); \ | |
161 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
|
162 \ |
2979 | 163 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
|
164 \ |
2979 | 165 pmulth($10, $2, $17); /* r17 = x2 * tn2 (6420) */ \ |
166 psraw($17, 15, $17); \ | |
167 pmfhl_uw($3); /* r3 = 7531 */ \ | |
168 psraw($3, 15, $3); \ | |
169 pinteh($3, $17, $17); /* r17 = x3 * tn3 */ \ | |
170 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
|
171 \ |
2979 | 172 pmulth($14, $2, $18); /* r18 = x6 * tn2 (6420) */ \ |
173 psraw($18, 15, $18); \ | |
174 pmfhl_uw($3); /* r3 = 7531 */ \ | |
175 psraw($3, 15, $3); \ | |
176 pinteh($3, $18, $18); /* r18 = x6 * tn2 */ \ | |
177 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
|
178 \ |
2979 | 179 paddh($8, $12, $2); /* r2 = tp04 */ \ |
180 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
|
181 \ |
2979 | 182 paddh($2, $18, $16); /* r16 = a0 */ \ |
183 psubh($2, $18, $19); /* r19 = a3 */ \ | |
184 psubh($3, $17, $18); /* r18 = a2 */ \ | |
185 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
|
186 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
187 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
188 #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
|
189 \ |
2979 | 190 paddh($16, $20, $2); /* y0 a0+b0 */ \ |
191 psubh($16, $20, $16); /* y7 a0-b0 */ \ | |
192 psrah($2, SHIFT_INV_COL, $2); \ | |
193 psrah($16, SHIFT_INV_COL, $16); \ | |
194 sq($2, 0, blk); \ | |
195 sq($16, 112, blk); \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
196 \ |
2979 | 197 paddh($17, $21, $3); /* y1 a1+b1 */ \ |
198 psubh($17, $21, $17); /* y6 a1-b1 */ \ | |
199 psrah($3, SHIFT_INV_COL, $3); \ | |
200 psrah($17, SHIFT_INV_COL, $17); \ | |
201 sq($3, 16, blk); \ | |
202 sq($17, 96, blk); \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
203 \ |
2979 | 204 paddh($18, $22, $2); /* y2 a2+b2 */ \ |
205 psubh($18, $22, $18); /* y5 a2-b2 */ \ | |
206 psrah($2, SHIFT_INV_COL, $2); \ | |
207 psrah($18, SHIFT_INV_COL, $18); \ | |
208 sq($2, 32, blk); \ | |
209 sq($18, 80, blk); \ | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
210 \ |
2979 | 211 paddh($19, $23, $3); /* y3 a3+b3 */ \ |
212 psubh($19, $23, $19); /* y4 a3-b3 */ \ | |
213 psrah($3, SHIFT_INV_COL, $3); \ | |
214 psrah($19, SHIFT_INV_COL, $19); \ | |
215 sq($3, 48, blk); \ | |
216 sq($19, 64, blk); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
217 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
218 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
219 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
220 #define DCT_8_INV_COL8_PMS() \ |
2979 | 221 paddh($16, $20, $2); /* y0 a0+b0 */ \ |
222 psubh($16, $20, $20); /* y7 a0-b0 */ \ | |
223 psrah($2, SHIFT_INV_COL, $16); \ | |
224 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
|
225 \ |
2979 | 226 paddh($17, $21, $3); /* y1 a1+b1 */ \ |
227 psubh($17, $21, $21); /* y6 a1-b1 */ \ | |
228 psrah($3, SHIFT_INV_COL, $17); \ | |
229 psrah($21, SHIFT_INV_COL, $21); \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
230 \ |
2979 | 231 paddh($18, $22, $2); /* y2 a2+b2 */ \ |
232 psubh($18, $22, $22); /* y5 a2-b2 */ \ | |
233 psrah($2, SHIFT_INV_COL, $18); \ | |
234 psrah($22, SHIFT_INV_COL, $22); \ | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
235 \ |
2979 | 236 paddh($19, $23, $3); /* y3 a3+b3 */ \ |
237 psubh($19, $23, $23); /* y4 a3-b3 */ \ | |
238 psrah($3, SHIFT_INV_COL, $19); \ | |
239 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
|
240 |
2979 | 241 #define PUT(rs) \ |
242 pminh(rs, $11, $2); \ | |
243 pmaxh($2, $0, $2); \ | |
244 ppacb($0, $2, $2); \ | |
245 sd3(2, 0, 4); \ | |
246 __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
|
247 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
248 #define DCT_8_INV_COL8_PUT() \ |
2979 | 249 PUT($16); \ |
250 PUT($17); \ | |
251 PUT($18); \ | |
252 PUT($19); \ | |
253 PUT($23); \ | |
254 PUT($22); \ | |
255 PUT($21); \ | |
256 PUT($20); | |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
257 |
2979 | 258 #define ADD(rs) \ |
259 ld3(4, 0, 2); \ | |
260 pextlb($0, $2, $2); \ | |
261 paddh($2, rs, $2); \ | |
262 pminh($2, $11, $2); \ | |
263 pmaxh($2, $0, $2); \ | |
264 ppacb($0, $2, $2); \ | |
265 sd3(2, 0, 4); \ | |
266 __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
|
267 |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
268 /*fixme: schedule*/ |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
269 #define DCT_8_INV_COL8_ADD() \ |
2979 | 270 ADD($16); \ |
271 ADD($17); \ | |
272 ADD($18); \ | |
273 ADD($19); \ | |
274 ADD($23); \ | |
275 ADD($22); \ | |
276 ADD($21); \ | |
277 ADD($20); | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
278 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
279 |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
280 void ff_mmi_idct(int16_t * block) |
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
281 { |
2979 | 282 /* $4 = block */ |
283 __asm__ __volatile__("la $24, %0"::"m"(consttable[0])); | |
284 lq($24, ROUNDER_0, $8); | |
285 lq($24, ROUNDER_1, $7); | |
286 DCT_8_INV_ROW1($4, 0, TAB_i_04, $8, $8); | |
287 DCT_8_INV_ROW1($4, 16, TAB_i_17, $7, $9); | |
288 DCT_8_INV_ROW1($4, 32, TAB_i_26, $7, $10); | |
289 DCT_8_INV_ROW1($4, 48, TAB_i_35, $7, $11); | |
290 DCT_8_INV_ROW1($4, 64, TAB_i_04, $7, $12); | |
291 DCT_8_INV_ROW1($4, 80, TAB_i_35, $7, $13); | |
292 DCT_8_INV_ROW1($4, 96, TAB_i_26, $7, $14); | |
293 DCT_8_INV_ROW1($4, 112, TAB_i_17, $7, $15); | |
294 DCT_8_INV_COL8(); | |
295 DCT_8_INV_COL8_STORE($4); | |
2967 | 296 |
2979 | 297 //let savedtemp regs be saved |
298 __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
|
299 } |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
300 |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
301 |
1064 | 302 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
|
303 { |
2979 | 304 /* $4 = dest, $5 = line_size, $6 = block */ |
305 __asm__ __volatile__("la $24, %0"::"m"(consttable[0])); | |
306 lq($24, ROUNDER_0, $8); | |
307 lq($24, ROUNDER_1, $7); | |
308 DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8); | |
309 DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9); | |
310 DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10); | |
311 DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11); | |
312 DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12); | |
313 DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13); | |
314 DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14); | |
315 DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15); | |
316 DCT_8_INV_COL8(); | |
317 lq($24, CLIPMAX, $11); | |
318 DCT_8_INV_COL8_PMS(); | |
319 DCT_8_INV_COL8_PUT(); | |
689
efcbfbd18864
ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff
changeset
|
320 |
2979 | 321 //let savedtemp regs be saved |
322 __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
|
323 } |
696
477bcb3b2f0a
ps2 idct bugfix patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
689
diff
changeset
|
324 |
721
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
325 |
1064 | 326 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
|
327 { |
2979 | 328 /* $4 = dest, $5 = line_size, $6 = block */ |
329 __asm__ __volatile__("la $24, %0"::"m"(consttable[0])); | |
330 lq($24, ROUNDER_0, $8); | |
331 lq($24, ROUNDER_1, $7); | |
332 DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8); | |
333 DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9); | |
334 DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10); | |
335 DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11); | |
336 DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12); | |
337 DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13); | |
338 DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14); | |
339 DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15); | |
340 DCT_8_INV_COL8(); | |
341 lq($24, CLIPMAX, $11); | |
342 DCT_8_INV_COL8_PMS(); | |
343 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
|
344 |
2979 | 345 //let savedtemp regs be saved |
346 __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
|
347 } |
71f669e9f633
ps2 optimizations update patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
696
diff
changeset
|
348 |