Mercurial > libavcodec.hg
annotate i386/fdct_mmx.c @ 7518:a40c76e98909 libavcodec
Simplify PCM codec; change 'n' in pcm_decode_frame() to equal "total number of samples".
author | pross |
---|---|
date | Thu, 07 Aug 2008 09:23:56 +0000 |
parents | f7cbb7733146 |
children | eebc7209c47f |
rev | line source |
---|---|
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
1 /* |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
2 * MMX optimized forward DCT |
429 | 3 * The gcc porting is Copyright (c) 2001 Fabrice Bellard. |
1739
07a484280a82
copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents:
1575
diff
changeset
|
4 * cleanup/optimizations are Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
5 * SSE2 optimization is Copyright (c) 2004 Denes Balatoni. |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
6 * |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
7 * from fdctam32.c - AP922 MMX(3D-Now) forward-DCT |
2967 | 8 * |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
9 * Intel Application Note AP-922 - fast, precise implementation of DCT |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
10 * http://developer.intel.com/vtune/cbts/appnotes.htm |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
11 * |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
12 * Also of inspiration: |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
13 * a page about fdct at http://www.geocities.com/ssavekar/dct.htm |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
14 * Skal's fdct at http://skal.planet-d.net/coding/dct.html |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
15 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
16 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
17 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
18 * FFmpeg is free software; you can redistribute it and/or |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
19 * modify it under the terms of the GNU Lesser General Public |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
20 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
21 * version 2.1 of the License, or (at your option) any later version. |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
22 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
23 * FFmpeg is distributed in the hope that it will be useful, |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
26 * Lesser General Public License for more details. |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
27 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
28 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
29 * License along with FFmpeg; if not, write to the Free Software |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3588
diff
changeset
|
30 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
31 */ |
6763 | 32 |
33 #include "libavutil/common.h" | |
34 #include "libavcodec/dsputil.h" | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
35 #include "mmx.h" |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
36 |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
37 #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align))) |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
38 |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
39 ////////////////////////////////////////////////////////////////////// |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
40 // |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
41 // constants for the forward DCT |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
42 // ----------------------------- |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
43 // |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
44 // Be sure to check that your compiler is aligning all constants to QWORD |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
45 // (8-byte) memory boundaries! Otherwise the unaligned memory access will |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
46 // severely stall MMX execution. |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
47 // |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
48 ////////////////////////////////////////////////////////////////////// |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
49 |
2979 | 50 #define BITS_FRW_ACC 3 //; 2 or 3 for accuracy |
51 #define SHIFT_FRW_COL BITS_FRW_ACC | |
52 #define SHIFT_FRW_ROW (BITS_FRW_ACC + 17 - 3) | |
53 #define RND_FRW_ROW (1 << (SHIFT_FRW_ROW-1)) | |
54 //#define RND_FRW_COL (1 << (SHIFT_FRW_COL-1)) | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
55 |
4961 | 56 #define X8(x) x,x,x,x,x,x,x,x |
57 | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
58 //concatenated table, for forward DCT transformation |
4961 | 59 static const int16_t fdct_tg_all_16[24] ATTR_ALIGN(16) = { |
60 X8(13036), // tg * (2<<16) + 0.5 | |
61 X8(27146), // tg * (2<<16) + 0.5 | |
62 X8(-21746) // tg * (2<<16) + 0.5 | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
63 }; |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
64 |
4961 | 65 static const int16_t ocos_4_16[8] ATTR_ALIGN(16) = { |
66 X8(23170) //cos * (2<<15) + 0.5 | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
67 }; |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
68 |
4961 | 69 static const int16_t fdct_one_corr[8] ATTR_ALIGN(16) = { X8(1) }; |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
70 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2024
diff
changeset
|
71 static const int32_t fdct_r_row[2] ATTR_ALIGN(8) = {RND_FRW_ROW, RND_FRW_ROW }; |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
72 |
4172 | 73 static struct |
1933
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
74 { |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2024
diff
changeset
|
75 const int32_t fdct_r_row_sse2[4] ATTR_ALIGN(16); |
1933
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
76 } fdct_r_row_sse2 ATTR_ALIGN(16)= |
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
77 {{ |
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
78 RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW |
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
79 }}; |
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
80 //static const long fdct_r_row_sse2[4] ATTR_ALIGN(16) = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW}; |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
81 |
839 | 82 static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // forward_dct coeff table |
2967 | 83 16384, 16384, 22725, 19266, |
84 16384, 16384, 12873, 4520, | |
85 21407, 8867, 19266, -4520, | |
86 -8867, -21407, -22725, -12873, | |
87 16384, -16384, 12873, -22725, | |
88 -16384, 16384, 4520, 19266, | |
89 8867, -21407, 4520, -12873, | |
90 21407, -8867, 19266, -22725, | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
91 |
2967 | 92 22725, 22725, 31521, 26722, |
93 22725, 22725, 17855, 6270, | |
94 29692, 12299, 26722, -6270, | |
95 -12299, -29692, -31521, -17855, | |
96 22725, -22725, 17855, -31521, | |
97 -22725, 22725, 6270, 26722, | |
98 12299, -29692, 6270, -17855, | |
99 29692, -12299, 26722, -31521, | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
100 |
2967 | 101 21407, 21407, 29692, 25172, |
102 21407, 21407, 16819, 5906, | |
103 27969, 11585, 25172, -5906, | |
104 -11585, -27969, -29692, -16819, | |
105 21407, -21407, 16819, -29692, | |
106 -21407, 21407, 5906, 25172, | |
107 11585, -27969, 5906, -16819, | |
108 27969, -11585, 25172, -29692, | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
109 |
2967 | 110 19266, 19266, 26722, 22654, |
111 19266, 19266, 15137, 5315, | |
112 25172, 10426, 22654, -5315, | |
113 -10426, -25172, -26722, -15137, | |
114 19266, -19266, 15137, -26722, | |
115 -19266, 19266, 5315, 22654, | |
116 10426, -25172, 5315, -15137, | |
117 25172, -10426, 22654, -26722, | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
118 |
2967 | 119 16384, 16384, 22725, 19266, |
120 16384, 16384, 12873, 4520, | |
121 21407, 8867, 19266, -4520, | |
122 -8867, -21407, -22725, -12873, | |
123 16384, -16384, 12873, -22725, | |
124 -16384, 16384, 4520, 19266, | |
125 8867, -21407, 4520, -12873, | |
126 21407, -8867, 19266, -22725, | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
127 |
2967 | 128 19266, 19266, 26722, 22654, |
129 19266, 19266, 15137, 5315, | |
130 25172, 10426, 22654, -5315, | |
131 -10426, -25172, -26722, -15137, | |
132 19266, -19266, 15137, -26722, | |
133 -19266, 19266, 5315, 22654, | |
134 10426, -25172, 5315, -15137, | |
135 25172, -10426, 22654, -26722, | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
136 |
2967 | 137 21407, 21407, 29692, 25172, |
138 21407, 21407, 16819, 5906, | |
139 27969, 11585, 25172, -5906, | |
140 -11585, -27969, -29692, -16819, | |
141 21407, -21407, 16819, -29692, | |
142 -21407, 21407, 5906, 25172, | |
143 11585, -27969, 5906, -16819, | |
144 27969, -11585, 25172, -29692, | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
145 |
2967 | 146 22725, 22725, 31521, 26722, |
147 22725, 22725, 17855, 6270, | |
148 29692, 12299, 26722, -6270, | |
149 -12299, -29692, -31521, -17855, | |
150 22725, -22725, 17855, -31521, | |
151 -22725, 22725, 6270, 26722, | |
152 12299, -29692, 6270, -17855, | |
153 29692, -12299, 26722, -31521, | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
154 }; |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
155 |
4172 | 156 static struct |
1933
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
157 { |
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
158 const int16_t tab_frw_01234567_sse2[256] ATTR_ALIGN(16); |
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
159 } tab_frw_01234567_sse2 ATTR_ALIGN(16) = |
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
160 {{ |
2967 | 161 //static const int16_t tab_frw_01234567_sse2[] ATTR_ALIGN(16) = { // forward_dct coeff table |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
162 #define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \ |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
163 C4, C4, C5, C7, C2, C6, C3, -C7, \ |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
164 -C4, C4, C7, C3, C6, -C2, C7, -C5, \ |
2967 | 165 C4, -C4, C5, -C1, C2, -C6, C3, -C1, |
166 // c1..c7 * cos(pi/4) * 2^15 | |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
167 #define C1 22725 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
168 #define C2 21407 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
169 #define C3 19266 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
170 #define C4 16384 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
171 #define C5 12873 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
172 #define C6 8867 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
173 #define C7 4520 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
174 TABLE_SSE2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
175 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
176 #undef C1 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
177 #undef C2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
178 #undef C3 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
179 #undef C4 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
180 #undef C5 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
181 #undef C6 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
182 #undef C7 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
183 #define C1 31521 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
184 #define C2 29692 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
185 #define C3 26722 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
186 #define C4 22725 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
187 #define C5 17855 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
188 #define C6 12299 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
189 #define C7 6270 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
190 TABLE_SSE2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
191 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
192 #undef C1 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
193 #undef C2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
194 #undef C3 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
195 #undef C4 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
196 #undef C5 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
197 #undef C6 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
198 #undef C7 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
199 #define C1 29692 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
200 #define C2 27969 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
201 #define C3 25172 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
202 #define C4 21407 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
203 #define C5 16819 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
204 #define C6 11585 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
205 #define C7 5906 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
206 TABLE_SSE2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
207 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
208 #undef C1 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
209 #undef C2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
210 #undef C3 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
211 #undef C4 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
212 #undef C5 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
213 #undef C6 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
214 #undef C7 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
215 #define C1 26722 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
216 #define C2 25172 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
217 #define C3 22654 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
218 #define C4 19266 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
219 #define C5 15137 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
220 #define C6 10426 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
221 #define C7 5315 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
222 TABLE_SSE2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
223 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
224 #undef C1 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
225 #undef C2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
226 #undef C3 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
227 #undef C4 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
228 #undef C5 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
229 #undef C6 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
230 #undef C7 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
231 #define C1 22725 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
232 #define C2 21407 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
233 #define C3 19266 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
234 #define C4 16384 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
235 #define C5 12873 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
236 #define C6 8867 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
237 #define C7 4520 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
238 TABLE_SSE2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
239 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
240 #undef C1 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
241 #undef C2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
242 #undef C3 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
243 #undef C4 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
244 #undef C5 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
245 #undef C6 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
246 #undef C7 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
247 #define C1 26722 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
248 #define C2 25172 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
249 #define C3 22654 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
250 #define C4 19266 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
251 #define C5 15137 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
252 #define C6 10426 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
253 #define C7 5315 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
254 TABLE_SSE2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
255 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
256 #undef C1 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
257 #undef C2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
258 #undef C3 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
259 #undef C4 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
260 #undef C5 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
261 #undef C6 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
262 #undef C7 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
263 #define C1 29692 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
264 #define C2 27969 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
265 #define C3 25172 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
266 #define C4 21407 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
267 #define C5 16819 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
268 #define C6 11585 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
269 #define C7 5906 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
270 TABLE_SSE2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
271 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
272 #undef C1 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
273 #undef C2 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
274 #undef C3 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
275 #undef C4 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
276 #undef C5 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
277 #undef C6 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
278 #undef C7 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
279 #define C1 31521 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
280 #define C2 29692 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
281 #define C3 26722 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
282 #define C4 22725 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
283 #define C5 17855 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
284 #define C6 12299 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
285 #define C7 6270 |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
286 TABLE_SSE2 |
1933
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
287 }}; |
12408a3bf741
fixing alignment problems -> SSE2 support enabled again in libavcodec (from ffdshow / milan_cutka)
michael
parents:
1765
diff
changeset
|
288 |
4961 | 289 #define FDCT_COL(cpu, mm, mov)\ |
290 static av_always_inline void fdct_col_##cpu(const int16_t *in, int16_t *out, int offset)\ | |
291 {\ | |
292 mov##_m2r(*(in + offset + 1 * 8), mm##0);\ | |
293 mov##_m2r(*(in + offset + 6 * 8), mm##1);\ | |
294 mov##_r2r(mm##0, mm##2);\ | |
295 mov##_m2r(*(in + offset + 2 * 8), mm##3);\ | |
296 paddsw_r2r(mm##1, mm##0);\ | |
297 mov##_m2r(*(in + offset + 5 * 8), mm##4);\ | |
298 psllw_i2r(SHIFT_FRW_COL, mm##0);\ | |
299 mov##_m2r(*(in + offset + 0 * 8), mm##5);\ | |
300 paddsw_r2r(mm##3, mm##4);\ | |
301 paddsw_m2r(*(in + offset + 7 * 8), mm##5);\ | |
302 psllw_i2r(SHIFT_FRW_COL, mm##4);\ | |
303 mov##_r2r(mm##0, mm##6);\ | |
304 psubsw_r2r(mm##1, mm##2);\ | |
305 mov##_m2r(*(fdct_tg_all_16 + 8), mm##1);\ | |
306 psubsw_r2r(mm##4, mm##0);\ | |
307 mov##_m2r(*(in + offset + 3 * 8), mm##7);\ | |
308 pmulhw_r2r(mm##0, mm##1);\ | |
309 paddsw_m2r(*(in + offset + 4 * 8), mm##7);\ | |
310 psllw_i2r(SHIFT_FRW_COL, mm##5);\ | |
311 paddsw_r2r(mm##4, mm##6);\ | |
312 psllw_i2r(SHIFT_FRW_COL, mm##7);\ | |
313 mov##_r2r(mm##5, mm##4);\ | |
314 psubsw_r2r(mm##7, mm##5);\ | |
315 paddsw_r2r(mm##5, mm##1);\ | |
316 paddsw_r2r(mm##7, mm##4);\ | |
317 por_m2r(*fdct_one_corr, mm##1);\ | |
318 psllw_i2r(SHIFT_FRW_COL + 1, mm##2);\ | |
319 pmulhw_m2r(*(fdct_tg_all_16 + 8), mm##5);\ | |
320 mov##_r2r(mm##4, mm##7);\ | |
321 psubsw_m2r(*(in + offset + 5 * 8), mm##3);\ | |
322 psubsw_r2r(mm##6, mm##4);\ | |
323 mov##_r2m(mm##1, *(out + offset + 2 * 8));\ | |
324 paddsw_r2r(mm##6, mm##7);\ | |
325 mov##_m2r(*(in + offset + 3 * 8), mm##1);\ | |
326 psllw_i2r(SHIFT_FRW_COL + 1, mm##3);\ | |
327 psubsw_m2r(*(in + offset + 4 * 8), mm##1);\ | |
328 mov##_r2r(mm##2, mm##6);\ | |
329 mov##_r2m(mm##4, *(out + offset + 4 * 8));\ | |
330 paddsw_r2r(mm##3, mm##2);\ | |
331 pmulhw_m2r(*ocos_4_16, mm##2);\ | |
332 psubsw_r2r(mm##3, mm##6);\ | |
333 pmulhw_m2r(*ocos_4_16, mm##6);\ | |
334 psubsw_r2r(mm##0, mm##5);\ | |
335 por_m2r(*fdct_one_corr, mm##5);\ | |
336 psllw_i2r(SHIFT_FRW_COL, mm##1);\ | |
337 por_m2r(*fdct_one_corr, mm##2);\ | |
338 mov##_r2r(mm##1, mm##4);\ | |
339 mov##_m2r(*(in + offset + 0 * 8), mm##3);\ | |
340 paddsw_r2r(mm##6, mm##1);\ | |
341 psubsw_m2r(*(in + offset + 7 * 8), mm##3);\ | |
342 psubsw_r2r(mm##6, mm##4);\ | |
343 mov##_m2r(*(fdct_tg_all_16 + 0), mm##0);\ | |
344 psllw_i2r(SHIFT_FRW_COL, mm##3);\ | |
345 mov##_m2r(*(fdct_tg_all_16 + 16), mm##6);\ | |
346 pmulhw_r2r(mm##1, mm##0);\ | |
347 mov##_r2m(mm##7, *(out + offset + 0 * 8));\ | |
348 pmulhw_r2r(mm##4, mm##6);\ | |
349 mov##_r2m(mm##5, *(out + offset + 6 * 8));\ | |
350 mov##_r2r(mm##3, mm##7);\ | |
351 mov##_m2r(*(fdct_tg_all_16 + 16), mm##5);\ | |
352 psubsw_r2r(mm##2, mm##7);\ | |
353 paddsw_r2r(mm##2, mm##3);\ | |
354 pmulhw_r2r(mm##7, mm##5);\ | |
355 paddsw_r2r(mm##3, mm##0);\ | |
356 paddsw_r2r(mm##4, mm##6);\ | |
357 pmulhw_m2r(*(fdct_tg_all_16 + 0), mm##3);\ | |
358 por_m2r(*fdct_one_corr, mm##0);\ | |
359 paddsw_r2r(mm##7, mm##5);\ | |
360 psubsw_r2r(mm##6, mm##7);\ | |
361 mov##_r2m(mm##0, *(out + offset + 1 * 8));\ | |
362 paddsw_r2r(mm##4, mm##5);\ | |
363 mov##_r2m(mm##7, *(out + offset + 3 * 8));\ | |
364 psubsw_r2r(mm##1, mm##3);\ | |
365 mov##_r2m(mm##5, *(out + offset + 5 * 8));\ | |
366 mov##_r2m(mm##3, *(out + offset + 7 * 8));\ | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
367 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
368 |
4961 | 369 FDCT_COL(mmx, mm, movq) |
370 FDCT_COL(sse2, xmm, movdqa) | |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
371 |
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4172
diff
changeset
|
372 static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out) |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
373 { |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
374 asm volatile( |
3564
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
375 #define FDCT_ROW_SSE2_H1(i,t) \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
376 "movq " #i "(%0), %%xmm2 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
377 "movq " #i "+8(%0), %%xmm0 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
378 "movdqa " #t "+32(%1), %%xmm3 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
379 "movdqa " #t "+48(%1), %%xmm7 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
380 "movdqa " #t "(%1), %%xmm4 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
381 "movdqa " #t "+16(%1), %%xmm5 \n\t" |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
382 |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
383 #define FDCT_ROW_SSE2_H2(i,t) \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
384 "movq " #i "(%0), %%xmm2 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
385 "movq " #i "+8(%0), %%xmm0 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
386 "movdqa " #t "+32(%1), %%xmm3 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
387 "movdqa " #t "+48(%1), %%xmm7 \n\t" |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
388 |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
389 #define FDCT_ROW_SSE2(i) \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
390 "movq %%xmm2, %%xmm1 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
391 "pshuflw $27, %%xmm0, %%xmm0 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
392 "paddsw %%xmm0, %%xmm1 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
393 "psubsw %%xmm0, %%xmm2 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
394 "punpckldq %%xmm2, %%xmm1 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
395 "pshufd $78, %%xmm1, %%xmm2 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
396 "pmaddwd %%xmm2, %%xmm3 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
397 "pmaddwd %%xmm1, %%xmm7 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
398 "pmaddwd %%xmm5, %%xmm2 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
399 "pmaddwd %%xmm4, %%xmm1 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
400 "paddd %%xmm7, %%xmm3 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
401 "paddd %%xmm2, %%xmm1 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
402 "paddd %%xmm6, %%xmm3 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
403 "paddd %%xmm6, %%xmm1 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
404 "psrad %3, %%xmm3 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
405 "psrad %3, %%xmm1 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
406 "packssdw %%xmm3, %%xmm1 \n\t" \ |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
407 "movdqa %%xmm1, " #i "(%4) \n\t" |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
408 |
2979 | 409 "movdqa (%2), %%xmm6 \n\t" |
3564
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
410 FDCT_ROW_SSE2_H1(0,0) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
411 FDCT_ROW_SSE2(0) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
412 FDCT_ROW_SSE2_H2(64,0) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
413 FDCT_ROW_SSE2(64) |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
414 |
3564
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
415 FDCT_ROW_SSE2_H1(16,64) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
416 FDCT_ROW_SSE2(16) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
417 FDCT_ROW_SSE2_H2(112,64) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
418 FDCT_ROW_SSE2(112) |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
419 |
3564
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
420 FDCT_ROW_SSE2_H1(32,128) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
421 FDCT_ROW_SSE2(32) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
422 FDCT_ROW_SSE2_H2(96,128) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
423 FDCT_ROW_SSE2(96) |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
424 |
3564
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
425 FDCT_ROW_SSE2_H1(48,192) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
426 FDCT_ROW_SSE2(48) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
427 FDCT_ROW_SSE2_H2(80,192) |
96f9bd6a9ea9
Add support for Mac OS X Intel part 2: Assembler macros in fdct_mmx.c
gpoirier
parents:
2979
diff
changeset
|
428 FDCT_ROW_SSE2(80) |
2979 | 429 : |
430 : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2), "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out) | |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
431 ); |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
432 } |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
433 |
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4172
diff
changeset
|
434 static av_always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const int16_t *table) |
2967 | 435 { |
1565 | 436 pshufw_m2r(*(in + 4), mm5, 0x1B); |
437 movq_m2r(*(in + 0), mm0); | |
1998 | 438 movq_r2r(mm0, mm1); |
1570 | 439 paddsw_r2r(mm5, mm0); |
440 psubsw_r2r(mm5, mm1); | |
1998 | 441 movq_r2r(mm0, mm2); |
442 punpckldq_r2r(mm1, mm0); | |
443 punpckhdq_r2r(mm1, mm2); | |
444 movq_m2r(*(table + 0), mm1); | |
445 movq_m2r(*(table + 4), mm3); | |
446 movq_m2r(*(table + 8), mm4); | |
447 movq_m2r(*(table + 12), mm5); | |
448 movq_m2r(*(table + 16), mm6); | |
1570 | 449 movq_m2r(*(table + 20), mm7); |
1998 | 450 pmaddwd_r2r(mm0, mm1); |
451 pmaddwd_r2r(mm2, mm3); | |
1575
f16ae8e69bd9
reorder table instead of wasting instructions to reorder the input to match the table
michael
parents:
1574
diff
changeset
|
452 pmaddwd_r2r(mm0, mm4); |
1998 | 453 pmaddwd_r2r(mm2, mm5); |
454 pmaddwd_r2r(mm0, mm6); | |
455 pmaddwd_r2r(mm2, mm7); | |
456 pmaddwd_m2r(*(table + 24), mm0); | |
457 pmaddwd_m2r(*(table + 28), mm2); | |
458 paddd_r2r(mm1, mm3); | |
459 paddd_r2r(mm4, mm5); | |
460 paddd_r2r(mm6, mm7); | |
461 paddd_r2r(mm0, mm2); | |
462 movq_m2r(*fdct_r_row, mm0); | |
463 paddd_r2r(mm0, mm3); | |
464 paddd_r2r(mm0, mm5); | |
465 paddd_r2r(mm0, mm7); | |
466 paddd_r2r(mm0, mm2); | |
467 psrad_i2r(SHIFT_FRW_ROW, mm3); | |
1570 | 468 psrad_i2r(SHIFT_FRW_ROW, mm5); |
1998 | 469 psrad_i2r(SHIFT_FRW_ROW, mm7); |
470 psrad_i2r(SHIFT_FRW_ROW, mm2); | |
471 packssdw_r2r(mm5, mm3); | |
472 packssdw_r2r(mm2, mm7); | |
473 movq_r2m(mm3, *(out + 0)); | |
474 movq_r2m(mm7, *(out + 4)); | |
1570 | 475 } |
476 | |
4283
d6f83e2f8804
rename always_inline to av_always_inline and move to common.h
mru
parents:
4172
diff
changeset
|
477 static av_always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const int16_t *table) |
2967 | 478 { |
5127 | 479 //FIXME reorder (I do not have an old MMX-only CPU here to benchmark ...) |
1575
f16ae8e69bd9
reorder table instead of wasting instructions to reorder the input to match the table
michael
parents:
1574
diff
changeset
|
480 movd_m2r(*(in + 6), mm1); |
f16ae8e69bd9
reorder table instead of wasting instructions to reorder the input to match the table
michael
parents:
1574
diff
changeset
|
481 punpcklwd_m2r(*(in + 4), mm1); |
f16ae8e69bd9
reorder table instead of wasting instructions to reorder the input to match the table
michael
parents:
1574
diff
changeset
|
482 movq_r2r(mm1, mm2); |
f16ae8e69bd9
reorder table instead of wasting instructions to reorder the input to match the table
michael
parents:
1574
diff
changeset
|
483 psrlq_i2r(0x20, mm1); |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
484 movq_m2r(*(in + 0), mm0); |
1575
f16ae8e69bd9
reorder table instead of wasting instructions to reorder the input to match the table
michael
parents:
1574
diff
changeset
|
485 punpcklwd_r2r(mm2, mm1); |
1998 | 486 movq_r2r(mm0, mm5); |
1575
f16ae8e69bd9
reorder table instead of wasting instructions to reorder the input to match the table
michael
parents:
1574
diff
changeset
|
487 paddsw_r2r(mm1, mm0); |
f16ae8e69bd9
reorder table instead of wasting instructions to reorder the input to match the table
michael
parents:
1574
diff
changeset
|
488 psubsw_r2r(mm1, mm5); |
1998 | 489 movq_r2r(mm0, mm2); |
490 punpckldq_r2r(mm5, mm0); | |
491 punpckhdq_r2r(mm5, mm2); | |
492 movq_m2r(*(table + 0), mm1); | |
493 movq_m2r(*(table + 4), mm3); | |
494 movq_m2r(*(table + 8), mm4); | |
495 movq_m2r(*(table + 12), mm5); | |
496 movq_m2r(*(table + 16), mm6); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
497 movq_m2r(*(table + 20), mm7); |
1998 | 498 pmaddwd_r2r(mm0, mm1); |
499 pmaddwd_r2r(mm2, mm3); | |
500 pmaddwd_r2r(mm0, mm4); | |
501 pmaddwd_r2r(mm2, mm5); | |
502 pmaddwd_r2r(mm0, mm6); | |
503 pmaddwd_r2r(mm2, mm7); | |
504 pmaddwd_m2r(*(table + 24), mm0); | |
505 pmaddwd_m2r(*(table + 28), mm2); | |
506 paddd_r2r(mm1, mm3); | |
507 paddd_r2r(mm4, mm5); | |
508 paddd_r2r(mm6, mm7); | |
509 paddd_r2r(mm0, mm2); | |
510 movq_m2r(*fdct_r_row, mm0); | |
511 paddd_r2r(mm0, mm3); | |
512 paddd_r2r(mm0, mm5); | |
513 paddd_r2r(mm0, mm7); | |
514 paddd_r2r(mm0, mm2); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
515 psrad_i2r(SHIFT_FRW_ROW, mm3); |
1998 | 516 psrad_i2r(SHIFT_FRW_ROW, mm5); |
517 psrad_i2r(SHIFT_FRW_ROW, mm7); | |
1570 | 518 psrad_i2r(SHIFT_FRW_ROW, mm2); |
1998 | 519 packssdw_r2r(mm5, mm3); |
520 packssdw_r2r(mm2, mm7); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
521 movq_r2m(mm3, *(out + 0)); |
1998 | 522 movq_r2m(mm7, *(out + 4)); |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
523 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
524 |
687
9abb13c21fbe
fdct_mmx -> ff_fdct_mmx (renamed to avoid namespace conflict with xvid)
arpi_esp
parents:
635
diff
changeset
|
525 void ff_fdct_mmx(int16_t *block) |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
526 { |
839 | 527 int64_t align_tmp[16] ATTR_ALIGN(8); |
3588 | 528 int16_t * block1= (int16_t*)align_tmp; |
529 const int16_t *table= tab_frw_01234567; | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
530 int i; |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
531 |
4961 | 532 fdct_col_mmx(block, block1, 0); |
533 fdct_col_mmx(block, block1, 4); | |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
534 |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
535 for(i=8;i>0;i--) { |
3588 | 536 fdct_row_mmx(block1, block, table); |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
537 block1 += 8; |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
538 table += 32; |
3588 | 539 block += 8; |
72
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
540 } |
3049d6d452a3
suppressed nasm dependancy - rewrote forward DCT and motion estimation code
glantau
parents:
diff
changeset
|
541 } |
1565 | 542 |
543 void ff_fdct_mmx2(int16_t *block) | |
544 { | |
545 int64_t align_tmp[16] ATTR_ALIGN(8); | |
3588 | 546 int16_t *block1= (int16_t*)align_tmp; |
547 const int16_t *table= tab_frw_01234567; | |
1565 | 548 int i; |
549 | |
4961 | 550 fdct_col_mmx(block, block1, 0); |
551 fdct_col_mmx(block, block1, 4); | |
1565 | 552 |
553 for(i=8;i>0;i--) { | |
3588 | 554 fdct_row_mmx2(block1, block, table); |
1565 | 555 block1 += 8; |
556 table += 32; | |
3588 | 557 block += 8; |
1565 | 558 } |
559 } | |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
560 |
2967 | 561 void ff_fdct_sse2(int16_t *block) |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
562 { |
3584 | 563 int64_t align_tmp[16] ATTR_ALIGN(16); |
3588 | 564 int16_t * const block1= (int16_t*)align_tmp; |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
565 |
4961 | 566 fdct_col_sse2(block, block1, 0); |
1765
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
567 fdct_row_sse2(block1, block); |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
568 } |
e31754bc5b65
SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents:
1739
diff
changeset
|
569 |