annotate ps2/idct_mmi.c @ 689:efcbfbd18864 libavcodec

ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
author michaelni
date Mon, 23 Sep 2002 08:44:24 +0000
parents
children 477bcb3b2f0a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
12 mmi port by leonvs@iae.nl
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
13 */
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
14 #include "../common.h"
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
15 #include "mmi.h"
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
16
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
17 #define BITS_INV_ACC 5 // 4 or 5 for IEEE
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
18 #define SHIFT_INV_ROW (16 - BITS_INV_ACC)
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
19 #define SHIFT_INV_COL (BITS_INV_ACC) //(1 + BITS_INV_ACC) no, FP15 is used
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
20
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
21 #define Rounder_0 0
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
22 #define Rounder_1 16
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
23 #define Rounder_2 32
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
24 #define Rounder_3 48
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
25 #define Rounder_4 64
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
26 #define Rounder_5 80
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
27 #define Rounder_6 96
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
28 #define Rounder_7 112
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
29
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
30 // assume SHIFT_INV_ROW == 11
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
31 static int roundertable[8][4] align16 = {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
32 {65535, 65535, 65535, 65535},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
33 { 1023, 1023, 1023, 1023},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
34 { 1023, 1023, 1023, 1023},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
35 { 1023, 1023, 1023, 1023},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
36 { 0, 0, 0, 0},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
37 { 1023, 1023, 1023, 1023},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
38 { 1023, 1023, 1023, 1023},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
39 { 1023, 1023, 1023, 1023}
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
40 };
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
41
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
42
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
43 #define TAB_i_04 0
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
44 #define TAB_i_17 64
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
45 #define TAB_i_26 128
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
46 #define TAB_i_35 192
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
47
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
48 static short rowtable[4][32] align16 = {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
49 {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
50 16384, 16384, 22725, 12873, 21407, 8867, 19266, 4520,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
51 16384, -16383, 19266, -22724, 8867, -21406, -4519, -12872,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
52 16384, -16383, 12873, 4520, -8866, 21407, -22724, 19266,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
53 16384, 16384, 4520, 19266, -21406, -8866, -12872, -22724},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
54 {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
55 22725, 22725, 31521, 17855, 29692, 12299, 26722, 6270,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
56 22725, -22724, 26722, -31520, 12299, -29691, -6269, -17854,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
57 22725, -22724, 17855, 6270, -12298, 29692, -31520, 26722,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
58 22725, 22725, 6270, 26722, -29691, -12298, -17854, -31520},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
59 {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
60 21407, 21407, 29692, 16819, 27969, 11585, 25172, 5906,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
61 21407, -21406, 25172, -29691, 11585, -27968, -5905, -16818,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
62 21407, -21406, 16819, 5906, -11584, 27969, -29691, 25172,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
63 21407, 21407, 5906, 25172, -27968, -11584, -16818, -29691},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
64 {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
65 19266, 19266, 26722, 15137, 25172, 10426, 22654, 5315,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
66 19266, -19265, 22654, -26721, 10426, -25171, -5314, -15136,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
67 19266, -19265, 15137, 5315, -10425, 25172, -26721, 22654,
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
68 19266, 19266, 5315, 22654, -25171, -10425, -15136, -26721}
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
69 };
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
70
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
71
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
72 #define TG_3_16_minus_one 0
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
73 #define ONE_plus_tg_3_16 16
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
74 #define ONE_plus_tg_1_16 32
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
75 #define TG_1_16_minus_one 48
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
76 #define TG_2_16_minus_one 64
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
77 #define ONE_plus_tg_2_16 80
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
78 #define ZERO_ocos_4_16 96
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
79
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
80 #define TG1 6518
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
81 #define TG2 13573
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
82 #define TG3 21895
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
83 #define MN1 -32768
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
84 #define PL1 32768
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
85 #define CS4 23170
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
86
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
87 static short coltable[7][8] align16 = {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
88 { MN1, TG3, MN1, TG3, MN1, TG3, MN1, TG3},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
89 {-TG3, -PL1, -TG3, -PL1, -TG3, -PL1, -TG3, -PL1},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
90 {-TG1, -PL1, -TG1, -PL1, -TG1, -PL1, -TG1, -PL1},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
91 { MN1, TG1, MN1, TG1, MN1, TG1, MN1, TG1},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
92 { MN1, TG2, MN1, TG2, MN1, TG2, MN1, TG2},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
93 {-TG2, -PL1, -TG2, -PL1, -TG2, -PL1, -TG2, -PL1},
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
94 { CS4, 0, CS4, 0, CS4, 0, CS4, 0}
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
95 };
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
96
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
97 #define noprevh(rt, rd)
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
98
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
99
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
100 #define DCT_8_INV_ROW1(rowoff, taboff, rounder, outreg) { \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
101 \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
102 lq($4, rowoff, $16); /* r16 = x7 x6 x5 x4 x3 x2 x1 x0 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
103 lq($24, 0+taboff, $17); /* r17 = w19 w17 w3 w1 w18 w16 w2 w0 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
104 pinth($16, $16, $16); /* r16 = x7 x3 x6 x2 x5 x1 x4 x0 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
105 phmadh($17, $16, $17); /* r17 = (x7*w19+x3*w17)b0'' (x6*w3+x2*w1)a0'' (x5*w18+x1*w16)b0' (x4*w2+x0*w0)a0' */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
106 lq($24, 16+taboff, $18);/* r18 = w23 w21 w7 w5 w22 w20 w6 w4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
107 lq($24, 32+taboff, $19);/* r19 = w27 w25 w11 w9 w26 w24 w10 w8 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
108 lq($24, 48+taboff, $20);/* r20 = w31 w29 w15 w13 w30 w28 w14 w12 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
109 phmadh($18, $16, $18); /* r18 = (b1'')(a1'')(b1')(a1') */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
110 pcpyud($17, $17, $21); /* r21 = (b0'')(a0'')(b0'')(a0'') */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
111 paddw($17, $21, $17); /* r17 = (--)(--)(b0)(a0) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
112 phmadh($19, $16, $19); /* r19 = (b2'')(a2'')(b2')(a2') */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
113 pcpyud($18, $18, $21); /* r21 = (b1'')(a1'')(b1'')(a1'') */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
114 paddw($18, $21, $18); /* r18 = (--)(--)(b1)(a1) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
115 pcpyud($19, $19, $21); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
116 phmadh($20, $16, $20); /* r12 = (b3'')(a3'')(b3')(a3') */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
117 lq($7, rounder, $22); /* r22 = rounder */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
118 paddw($19, $21, $19); /* r19 = (--)(--)(b2)(a2) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
119 pextlw($19, $17, $16); /* r16 = (b2)(b0)(a2)(a0) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
120 pcpyud($20, $20, $21); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
121 paddw($20, $21, $20); /* r20 = (--)(--)(b3)(a3) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
122 pextlw($20, $18, $17); /* r17 = (b3)(b1)(a3)(a1) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
123 pextlw($17, $16, $20); /* r20 = (a3)(a2)(a1)(a0)" */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
124 pextuw($17, $16, $21); /* r21 = (b3)(b2)(b1)(b0) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
125 paddw($20, $22, $20); /* r20 = (a3)(a2)(a1)(a0) */\
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
126 paddw($20, $21, $17); /* r17 = ()()()(a0+b0) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
127 psubw($20, $21, $18); /* r18 = ()()()(a0-b0) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
128 psraw($17, SHIFT_INV_ROW, $17); /* r17 = (y3 y2 y1 y0) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
129 psraw($18, SHIFT_INV_ROW, $18); /* r18 = (y4 y5 y6 y7) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
130 ppach($18, $17, outreg);/* out = y4 y5 y6 y7 y3 y2 y1 y0 Note order */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
131 }
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
132
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
133
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
134 #define DCT_8_INV_COL4(pextop, blkoff, revop) { \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
135 lq($24, TG_3_16_minus_one, $2); /* r2 = (tn3)(-1) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
136 pextop($11, $13, $3); /* r3 = (x3)(x5) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
137 lq($24, ONE_plus_tg_3_16, $16); /* r16 = -((+1)(tn3)) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
138 phmadh($3, $2, $17); /* r17 = (tm35) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
139 lq($24, ONE_plus_tg_1_16, $2); /* r2 = -((+1)(tn1)) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
140 phmadh($3, $16, $18); /* r18 = -(tp35) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
141 lq($24, TG_1_16_minus_one, $16);/* r16 = (tn1)(-1) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
142 pextop($9, $15, $3); /* r3 = (x1)(x7) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
143 phmadh($3, $2, $19); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
144 lq($24, ZERO_ocos_4_16, $2); /* r2 = (0)(cos4) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
145 phmadh($3, $16, $20); /* r20 = (tm17) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
146 psubw($0, $19, $19); /* r19 = (tp17) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
147 paddw($19, $18, $3); /* r3 = t1 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
148 paddw($20, $17, $16); /* r16 = t2 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
149 psubw($20, $17, $23); /* r23 = b3 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
150 psubw($19, $18, $20); /* r20 = b0 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
151 paddw($3, $16, $17); /* (t1+t2) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
152 psubw($3, $16, $18); /* (t1-t2) */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
153 psraw($17, 15, $17); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
154 lq($24, TG_2_16_minus_one, $3); /* r3 = (tn2)(-1) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
155 pmulth($17, $2, $21); /* r21 = b1 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
156 psraw($18, 15, $18); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
157 lq($24, ONE_plus_tg_2_16, $16); /* r16 = -((+1)(tn2)) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
158 pmulth($18, $2, $22); /* r22 = b2 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
159 \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
160 pextop($10, $14, $2); /* r2 = (x2)(x6) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
161 phmadh($2, $3, $18); /* r18 = (tm26) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
162 phmadh($2, $16, $19); /* r19 = -(tp26) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
163 pextop($8, $0, $17); /* r17 = (x0)(0) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
164 psraw($17, 1, $17); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
165 pextop($12, $0, $16); /* r16 = (x4)(0) x 4 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
166 psraw($16, 1, $16); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
167 paddw($17, $16, $2); /* r2 = tp04 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
168 psubw($17, $16, $3); /* r3 = tm04 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
169 psubw($2, $19, $16); /* r16 = a0 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
170 paddw($3, $18, $17); /* r17 = a1 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
171 psubw($3, $18, $18); /* r18 = a2 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
172 paddw($2, $19, $19); /* r19 = a3 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
173 \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
174 paddw($16, $20, $2); /* y0 a0+b0 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
175 psubw($16, $20, $16); /* y7 a0-b0 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
176 psraw($2, SHIFT_INV_COL+16, $2); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
177 psraw($16, SHIFT_INV_COL+16, $16); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
178 ppach($0, $2, $2); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
179 ppach($0, $16, $16); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
180 revop($2, $2); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
181 revop($16, $16); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
182 sd3(2, 0+blkoff, 4); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
183 sd3(16, 112+blkoff, 4); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
184 \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
185 paddw($17, $21, $3); /* y1 a1+b1 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
186 psubw($17, $21, $17); /* y6 a1-b1 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
187 psraw($3, SHIFT_INV_COL+16, $3); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
188 psraw($17, SHIFT_INV_COL+16, $17); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
189 ppach($0, $3, $3); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
190 ppach($0, $17, $17); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
191 revop($3, $3); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
192 revop($17, $17); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
193 sd3(3, 16+blkoff, 4); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
194 sd3(17, 96+blkoff, 4); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
195 \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
196 paddw($18, $22, $2); /* y2 a2+b2 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
197 psubw($18, $22, $18); /* y5 a2-b2 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
198 psraw($2, SHIFT_INV_COL+16, $2); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
199 psraw($18, SHIFT_INV_COL+16, $18); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
200 ppach($0, $2, $2); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
201 ppach($0, $18, $18); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
202 revop($2, $2); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
203 revop($18, $18); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
204 sd3(2, 32+blkoff, 4); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
205 sd3(18, 80+blkoff, 4); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
206 \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
207 paddw($19, $23, $3); /* y3 a3+b3 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
208 psubw($19, $23, $19); /* y4 a3-b3 */ \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
209 psraw($3, SHIFT_INV_COL+16, $3); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
210 psraw($19, SHIFT_INV_COL+16, $19); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
211 ppach($0, $3, $3); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
212 ppach($0, $19, $19); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
213 revop($3, $3); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
214 revop($19, $19); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
215 sd3(3, 48+blkoff, 4); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
216 sd3(19, 64+blkoff, 4); \
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
217 }
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
218
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
219
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
220 void ff_mmi_idct(int16_t * block)
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
221 {
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
222 /* $4 = block */
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
223 __asm__ __volatile__("la $24, %0"::"m"(rowtable[0][0]));
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
224 __asm__ __volatile__("la $7, %0"::"m"(roundertable[0][0]));
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
225 DCT_8_INV_ROW1(0, TAB_i_04, Rounder_0, $8);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
226 DCT_8_INV_ROW1(16, TAB_i_17, Rounder_1, $9);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
227 DCT_8_INV_ROW1(32, TAB_i_26, Rounder_2, $10);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
228 DCT_8_INV_ROW1(48, TAB_i_35, Rounder_3, $11);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
229 DCT_8_INV_ROW1(64, TAB_i_04, Rounder_4, $12);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
230 DCT_8_INV_ROW1(80, TAB_i_35, Rounder_5, $13);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
231 DCT_8_INV_ROW1(96, TAB_i_26, Rounder_6, $14);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
232 DCT_8_INV_ROW1(112, TAB_i_17, Rounder_7, $15);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
233
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
234 __asm__ __volatile__("la $24, %0"::"m"(coltable[0][0]));
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
235 DCT_8_INV_COL4(pextlh, 0, noprevh);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
236 DCT_8_INV_COL4(pextuh, 8, prevh);
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
237
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
238 //let savedtemp regs be saved
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
239 __asm__ __volatile__(" ":::"$16", "$17", "$18", "$19", "$20", "$21",
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
240 "$22", "$23");
efcbfbd18864 ps2 idct patch by (Leon van Stuivenberg <leonvs at iae dot nl>)
michaelni
parents:
diff changeset
241 }