annotate i386/fdctdata.c @ 39:f6806d3e2d37 libavcodec

updated scans
author glantau
date Tue, 07 Aug 2001 22:47:28 +0000
parents 986e461dc072
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 //////////////////////////////////////////////////////////////////////////////
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 //
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 // fdctam32.c - AP922 MMX(3D-Now) forward-DCT
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 // ----------
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 // Intel Application Note AP-922 - fast, precise implementation of DCT
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 // http://developer.intel.com/vtune/cbts/appnotes.htm
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 // ----------
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 //
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 // This routine uses a 3D-Now/MMX enhancement to increase the
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 // accuracy of the fdct_col_4 macro. The dct_col function uses 3D-Now's
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 // PMHULHRW instead of MMX's PMHULHW(and POR). The substitution improves
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 // accuracy very slightly with performance penalty. If the target CPU
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 // does not support 3D-Now, then this function cannot be executed.
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 // fdctmm32.c contains the standard MMX implementation of AP-922.
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 //
986e461dc072 Initial revision
glantau
parents:
diff changeset
16 // For a fast, precise MMX implementation of inverse-DCT
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 // visit http://www.elecard.com/peter
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 //
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 // v1.0 07/22/2000 (initial release)
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 // Initial release of AP922 MMX(3D-Now) forward_DCT.
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 // This code was tested with Visual C++ 6.0Pro + service_pack4 +
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 // processor_pack_beta! If you have the processor_pack_beta, you can
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 // remove the #include for amd3dx.h, and substitute the 'normal'
986e461dc072 Initial revision
glantau
parents:
diff changeset
24 // assembly lines for the macro'd versions. Otherwise, this
986e461dc072 Initial revision
glantau
parents:
diff changeset
25 // code should compile 'as is', under Visual C++ 6.0 Pro.
986e461dc072 Initial revision
glantau
parents:
diff changeset
26 //
986e461dc072 Initial revision
glantau
parents:
diff changeset
27 // liaor@iname.com http://members.tripod.com/~liaor
986e461dc072 Initial revision
glantau
parents:
diff changeset
28 //////////////////////////////////////////////////////////////////////////////
986e461dc072 Initial revision
glantau
parents:
diff changeset
29
986e461dc072 Initial revision
glantau
parents:
diff changeset
30 #include <inttypes.h>
986e461dc072 Initial revision
glantau
parents:
diff changeset
31
986e461dc072 Initial revision
glantau
parents:
diff changeset
32 //////////////////////////////////////////////////////////////////////
986e461dc072 Initial revision
glantau
parents:
diff changeset
33 //
986e461dc072 Initial revision
glantau
parents:
diff changeset
34 // constants for the forward DCT
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 // -----------------------------
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 //
986e461dc072 Initial revision
glantau
parents:
diff changeset
37 // Be sure to check that your compiler is aligning all constants to QWORD
986e461dc072 Initial revision
glantau
parents:
diff changeset
38 // (8-byte) memory boundaries! Otherwise the unaligned memory access will
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 // severely stall MMX execution.
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 //
986e461dc072 Initial revision
glantau
parents:
diff changeset
41 //////////////////////////////////////////////////////////////////////
986e461dc072 Initial revision
glantau
parents:
diff changeset
42
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 #define BITS_FRW_ACC 3 //; 2 or 3 for accuracy
986e461dc072 Initial revision
glantau
parents:
diff changeset
44 #define SHIFT_FRW_COL BITS_FRW_ACC
986e461dc072 Initial revision
glantau
parents:
diff changeset
45 #define SHIFT_FRW_ROW (BITS_FRW_ACC + 17)
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 //#define RND_FRW_ROW (262144 * (BITS_FRW_ACC - 1)) //; 1 << (SHIFT_FRW_ROW-1)
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 #define RND_FRW_ROW (1 << (SHIFT_FRW_ROW-1))
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 //#define RND_FRW_COL (2 * (BITS_FRW_ACC - 1)) //; 1 << (SHIFT_FRW_COL-1)
986e461dc072 Initial revision
glantau
parents:
diff changeset
49 #define RND_FRW_COL (1 << (SHIFT_FRW_COL-1))
986e461dc072 Initial revision
glantau
parents:
diff changeset
50
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 //concatenated table, for forward DCT transformation
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 const int16_t fdct_tg_all_16[] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
53 13036, 13036, 13036, 13036, // tg * (2<<16) + 0.5
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 27146, 27146, 27146, 27146, // tg * (2<<16) + 0.5
986e461dc072 Initial revision
glantau
parents:
diff changeset
55 -21746, -21746, -21746, -21746, // tg * (2<<16) + 0.5
986e461dc072 Initial revision
glantau
parents:
diff changeset
56 -19195, -19195, -19195, -19195, //cos * (2<<16) + 0.5
986e461dc072 Initial revision
glantau
parents:
diff changeset
57 23170, 23170, 23170, 23170 }; //cos * (2<<15) + 0.5
986e461dc072 Initial revision
glantau
parents:
diff changeset
58 const long long fdct_one_corr = 0x0001000100010001LL;
986e461dc072 Initial revision
glantau
parents:
diff changeset
59 const long fdct_r_row[2] = {RND_FRW_ROW, RND_FRW_ROW };
986e461dc072 Initial revision
glantau
parents:
diff changeset
60
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 const int16_t tab_frw_01234567[] = { // forward_dct coeff table
986e461dc072 Initial revision
glantau
parents:
diff changeset
62 //row0
986e461dc072 Initial revision
glantau
parents:
diff changeset
63 16384, 16384, 21407, -8867, // w09 w01 w08 w00
986e461dc072 Initial revision
glantau
parents:
diff changeset
64 16384, 16384, 8867, -21407, // w13 w05 w12 w04
986e461dc072 Initial revision
glantau
parents:
diff changeset
65 16384, -16384, 8867, 21407, // w11 w03 w10 w02
986e461dc072 Initial revision
glantau
parents:
diff changeset
66 -16384, 16384, -21407, -8867, // w15 w07 w14 w06
986e461dc072 Initial revision
glantau
parents:
diff changeset
67 22725, 12873, 19266, -22725, // w22 w20 w18 w16
986e461dc072 Initial revision
glantau
parents:
diff changeset
68 19266, 4520, -4520, -12873, // w23 w21 w19 w17
986e461dc072 Initial revision
glantau
parents:
diff changeset
69 12873, 4520, 4520, 19266, // w30 w28 w26 w24
986e461dc072 Initial revision
glantau
parents:
diff changeset
70 -22725, 19266, -12873, -22725, // w31 w29 w27 w25
986e461dc072 Initial revision
glantau
parents:
diff changeset
71
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 //row1
986e461dc072 Initial revision
glantau
parents:
diff changeset
73 22725, 22725, 29692, -12299, // w09 w01 w08 w00
986e461dc072 Initial revision
glantau
parents:
diff changeset
74 22725, 22725, 12299, -29692, // w13 w05 w12 w04
986e461dc072 Initial revision
glantau
parents:
diff changeset
75 22725, -22725, 12299, 29692, // w11 w03 w10 w02
986e461dc072 Initial revision
glantau
parents:
diff changeset
76 -22725, 22725, -29692, -12299, // w15 w07 w14 w06
986e461dc072 Initial revision
glantau
parents:
diff changeset
77 31521, 17855, 26722, -31521, // w22 w20 w18 w16
986e461dc072 Initial revision
glantau
parents:
diff changeset
78 26722, 6270, -6270, -17855, // w23 w21 w19 w17
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 17855, 6270, 6270, 26722, // w30 w28 w26 w24
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 -31521, 26722, -17855, -31521, // w31 w29 w27 w25
986e461dc072 Initial revision
glantau
parents:
diff changeset
81
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 //row2
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 21407, 21407, 27969, -11585, // w09 w01 w08 w00
986e461dc072 Initial revision
glantau
parents:
diff changeset
84 21407, 21407, 11585, -27969, // w13 w05 w12 w04
986e461dc072 Initial revision
glantau
parents:
diff changeset
85 21407, -21407, 11585, 27969, // w11 w03 w10 w02
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 -21407, 21407, -27969, -11585, // w15 w07 w14 w06
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 29692, 16819, 25172, -29692, // w22 w20 w18 w16
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 25172, 5906, -5906, -16819, // w23 w21 w19 w17
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 16819, 5906, 5906, 25172, // w30 w28 w26 w24
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 -29692, 25172, -16819, -29692, // w31 w29 w27 w25
986e461dc072 Initial revision
glantau
parents:
diff changeset
91
986e461dc072 Initial revision
glantau
parents:
diff changeset
92 //row3
986e461dc072 Initial revision
glantau
parents:
diff changeset
93 19266, 19266, 25172, -10426, // w09 w01 w08 w00
986e461dc072 Initial revision
glantau
parents:
diff changeset
94 19266, 19266, 10426, -25172, // w13 w05 w12 w04
986e461dc072 Initial revision
glantau
parents:
diff changeset
95 19266, -19266, 10426, 25172, // w11 w03 w10 w02
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 -19266, 19266, -25172, -10426, // w15 w07 w14 w06,
986e461dc072 Initial revision
glantau
parents:
diff changeset
97 26722, 15137, 22654, -26722, // w22 w20 w18 w16
986e461dc072 Initial revision
glantau
parents:
diff changeset
98 22654, 5315, -5315, -15137, // w23 w21 w19 w17
986e461dc072 Initial revision
glantau
parents:
diff changeset
99 15137, 5315, 5315, 22654, // w30 w28 w26 w24
986e461dc072 Initial revision
glantau
parents:
diff changeset
100 -26722, 22654, -15137, -26722, // w31 w29 w27 w25,
986e461dc072 Initial revision
glantau
parents:
diff changeset
101
986e461dc072 Initial revision
glantau
parents:
diff changeset
102 //row4
986e461dc072 Initial revision
glantau
parents:
diff changeset
103 16384, 16384, 21407, -8867, // w09 w01 w08 w00
986e461dc072 Initial revision
glantau
parents:
diff changeset
104 16384, 16384, 8867, -21407, // w13 w05 w12 w04
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 16384, -16384, 8867, 21407, // w11 w03 w10 w02
986e461dc072 Initial revision
glantau
parents:
diff changeset
106 -16384, 16384, -21407, -8867, // w15 w07 w14 w06
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 22725, 12873, 19266, -22725, // w22 w20 w18 w16
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 19266, 4520, -4520, -12873, // w23 w21 w19 w17
986e461dc072 Initial revision
glantau
parents:
diff changeset
109 12873, 4520, 4520, 19266, // w30 w28 w26 w24
986e461dc072 Initial revision
glantau
parents:
diff changeset
110 -22725, 19266, -12873, -22725, // w31 w29 w27 w25
986e461dc072 Initial revision
glantau
parents:
diff changeset
111
986e461dc072 Initial revision
glantau
parents:
diff changeset
112 //row5
986e461dc072 Initial revision
glantau
parents:
diff changeset
113 19266, 19266, 25172, -10426, // w09 w01 w08 w00
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 19266, 19266, 10426, -25172, // w13 w05 w12 w04
986e461dc072 Initial revision
glantau
parents:
diff changeset
115 19266, -19266, 10426, 25172, // w11 w03 w10 w02
986e461dc072 Initial revision
glantau
parents:
diff changeset
116 -19266, 19266, -25172, -10426, // w15 w07 w14 w06
986e461dc072 Initial revision
glantau
parents:
diff changeset
117 26722, 15137, 22654, -26722, // w22 w20 w18 w16
986e461dc072 Initial revision
glantau
parents:
diff changeset
118 22654, 5315, -5315, -15137, // w23 w21 w19 w17
986e461dc072 Initial revision
glantau
parents:
diff changeset
119 15137, 5315, 5315, 22654, // w30 w28 w26 w24
986e461dc072 Initial revision
glantau
parents:
diff changeset
120 -26722, 22654, -15137, -26722, // w31 w29 w27 w25
986e461dc072 Initial revision
glantau
parents:
diff changeset
121
986e461dc072 Initial revision
glantau
parents:
diff changeset
122 //row6
986e461dc072 Initial revision
glantau
parents:
diff changeset
123 21407, 21407, 27969, -11585, // w09 w01 w08 w00
986e461dc072 Initial revision
glantau
parents:
diff changeset
124 21407, 21407, 11585, -27969, // w13 w05 w12 w04
986e461dc072 Initial revision
glantau
parents:
diff changeset
125 21407, -21407, 11585, 27969, // w11 w03 w10 w02
986e461dc072 Initial revision
glantau
parents:
diff changeset
126 -21407, 21407, -27969, -11585, // w15 w07 w14 w06,
986e461dc072 Initial revision
glantau
parents:
diff changeset
127 29692, 16819, 25172, -29692, // w22 w20 w18 w16
986e461dc072 Initial revision
glantau
parents:
diff changeset
128 25172, 5906, -5906, -16819, // w23 w21 w19 w17
986e461dc072 Initial revision
glantau
parents:
diff changeset
129 16819, 5906, 5906, 25172, // w30 w28 w26 w24
986e461dc072 Initial revision
glantau
parents:
diff changeset
130 -29692, 25172, -16819, -29692, // w31 w29 w27 w25,
986e461dc072 Initial revision
glantau
parents:
diff changeset
131
986e461dc072 Initial revision
glantau
parents:
diff changeset
132 //row7
986e461dc072 Initial revision
glantau
parents:
diff changeset
133 22725, 22725, 29692, -12299, // w09 w01 w08 w00
986e461dc072 Initial revision
glantau
parents:
diff changeset
134 22725, 22725, 12299, -29692, // w13 w05 w12 w04
986e461dc072 Initial revision
glantau
parents:
diff changeset
135 22725, -22725, 12299, 29692, // w11 w03 w10 w02
986e461dc072 Initial revision
glantau
parents:
diff changeset
136 -22725, 22725, -29692, -12299, // w15 w07 w14 w06,
986e461dc072 Initial revision
glantau
parents:
diff changeset
137 31521, 17855, 26722, -31521, // w22 w20 w18 w16
986e461dc072 Initial revision
glantau
parents:
diff changeset
138 26722, 6270, -6270, -17855, // w23 w21 w19 w17
986e461dc072 Initial revision
glantau
parents:
diff changeset
139 17855, 6270, 6270, 26722, // w30 w28 w26 w24
986e461dc072 Initial revision
glantau
parents:
diff changeset
140 -31521, 26722, -17855, -31521 // w31 w29 w27 w25
986e461dc072 Initial revision
glantau
parents:
diff changeset
141 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
142
986e461dc072 Initial revision
glantau
parents:
diff changeset
143