annotate i386/dsputil_mmx.c @ 314:289eb941b8ba libavcodec

* encoding of AC3 with more than 2 channels by Takashi Iwai <tiwai@suse.de>
author kabi
date Mon, 08 Apr 2002 12:08:03 +0000
parents c1a8a1b4a24b
children 9c6f056f0e41
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 * MMX optimized DSP utils
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 * Copyright (c) 2000, 2001 Gerard Lantau.
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 * (at your option) any later version.
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 * GNU General Public License for more details.
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
986e461dc072 Initial revision
glantau
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
21
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 #include "../dsputil.h"
174
ac5075a55488 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents: 151
diff changeset
23 #include "../simple_idct.h"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
24
5
4479bcab253e suppressed no longer needed emms()
glantau
parents: 0
diff changeset
25 int mm_flags; /* multimedia extension flags */
4479bcab253e suppressed no longer needed emms()
glantau
parents: 0
diff changeset
26
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
27 int pix_abs16x16_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
28 int pix_abs16x16_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
29 int pix_abs16x16_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
30 int pix_abs16x16_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
31
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
32 int pix_abs16x16_mmx2(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
33 int pix_abs16x16_x2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
34 int pix_abs16x16_y2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
35 int pix_abs16x16_xy2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
36
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
37 int pix_abs8x8_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
38 int pix_abs8x8_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
39 int pix_abs8x8_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
40 int pix_abs8x8_xy2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
41
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
42 int pix_abs8x8_mmx2(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
43 int pix_abs8x8_x2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
44 int pix_abs8x8_y2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
45 int pix_abs8x8_xy2_mmx2(UINT8 *blk1, UINT8 *blk2, int lx);
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
46
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
47
42
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
48 /* external functions, from idct_mmx.c */
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
49 void ff_mmx_idct(DCTELEM *block);
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
50 void ff_mmxext_idct(DCTELEM *block);
19
82d4c9be9873 MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
arpi_esp
parents: 8
diff changeset
51
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 /* pixel operations */
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
53 static const unsigned long long int mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001LL;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
54 static const unsigned long long int mm_wtwo __attribute__ ((aligned(8))) = 0x0002000200020002LL;
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents: 5
diff changeset
55 //static const unsigned short mm_wone[4] __attribute__ ((aligned(8))) = { 0x1, 0x1, 0x1, 0x1 };
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents: 5
diff changeset
56 //static const unsigned short mm_wtwo[4] __attribute__ ((aligned(8))) = { 0x2, 0x2, 0x2, 0x2 };
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
57
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
58 #define JUMPALIGN() __asm __volatile (".balign 8"::)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
59 #define MOVQ_ZERO(regd) __asm __volatile ("pxor %%" #regd ", %%" #regd ::)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
60
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
61 #ifndef PIC
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
62 #define MOVQ_WONE(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_wone))
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
63 #define MOVQ_WTWO(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_wtwo))
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
64 #else
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
65 // for shared library it's better to use this way for accessing constants
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
66 // pcmpeqd -> -1
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
67 #define MOVQ_WONE(regd) \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
68 __asm __volatile ( \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
69 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
70 "psrlw $15, %%" #regd ::)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
71
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
72 #define MOVQ_WTWO(regd) \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
73 __asm __volatile ( \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
74 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
75 "psrlw $15, %%" #regd " \n\t" \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
76 "psllw $1, %%" #regd ::)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
77 #endif
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
78
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 /* 3Dnow specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
81
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 #define DEF(x) x ## _3dnow
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 /* for Athlons PAVGUSB is prefered */
986e461dc072 Initial revision
glantau
parents:
diff changeset
84 #define PAVGB "pavgusb"
986e461dc072 Initial revision
glantau
parents:
diff changeset
85
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 #include "dsputil_mmx_avg.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
87
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 #undef DEF
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 #undef PAVGB
986e461dc072 Initial revision
glantau
parents:
diff changeset
90
986e461dc072 Initial revision
glantau
parents:
diff changeset
91 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
92 /* MMX2 specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
93
986e461dc072 Initial revision
glantau
parents:
diff changeset
94 #define DEF(x) x ## _sse
986e461dc072 Initial revision
glantau
parents:
diff changeset
95
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 /* Introduced only in MMX2 set */
986e461dc072 Initial revision
glantau
parents:
diff changeset
97 #define PAVGB "pavgb"
986e461dc072 Initial revision
glantau
parents:
diff changeset
98
986e461dc072 Initial revision
glantau
parents:
diff changeset
99 #include "dsputil_mmx_avg.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
100
986e461dc072 Initial revision
glantau
parents:
diff changeset
101 #undef DEF
986e461dc072 Initial revision
glantau
parents:
diff changeset
102 #undef PAVGB
986e461dc072 Initial revision
glantau
parents:
diff changeset
103
986e461dc072 Initial revision
glantau
parents:
diff changeset
104 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 /* standard MMX */
986e461dc072 Initial revision
glantau
parents:
diff changeset
106
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 static void get_pixels_mmx(DCTELEM *block, const UINT8 *pixels, int line_size)
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
109 DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
110 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
111 int i;
986e461dc072 Initial revision
glantau
parents:
diff changeset
112
986e461dc072 Initial revision
glantau
parents:
diff changeset
113 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
115 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
116 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
117 for(i=0;i<4;i++) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
118 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
119 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
120 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
121 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
122 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
123 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
124 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
125 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
126 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
127 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
128 "movq %%mm2, 8%0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
129 "movq %%mm1, 16%0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
130 "movq %%mm3, 24%0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
131 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
132 :"m"(*pix), "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
133 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
134 pix += line_size*2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
135 p += 16;
986e461dc072 Initial revision
glantau
parents:
diff changeset
136 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
137 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
138
986e461dc072 Initial revision
glantau
parents:
diff changeset
139 static void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
986e461dc072 Initial revision
glantau
parents:
diff changeset
140 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
141 const DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
142 UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
143
986e461dc072 Initial revision
glantau
parents:
diff changeset
144 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
145 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
146 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
147 /* unrolled loop */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
148 __asm __volatile(
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
149 "movq %3, %%mm0\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
150 "movq 8%3, %%mm1\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
151 "movq 16%3, %%mm2\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
152 "movq 24%3, %%mm3\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
153 "movq 32%3, %%mm4\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
154 "movq 40%3, %%mm5\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
155 "movq 48%3, %%mm6\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
156 "movq 56%3, %%mm7\n\t"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
157 "packuswb %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
158 "packuswb %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
159 "packuswb %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
160 "packuswb %%mm7, %%mm6\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
161 "movq %%mm0, (%0)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
162 "movq %%mm2, (%0, %1)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
163 "movq %%mm4, (%0, %1, 2)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
164 "movq %%mm6, (%0, %2)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
165 ::"r" (pix), "r" (line_size), "r" (line_size*3), "m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
166 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
167 pix += line_size*4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
168 p += 32;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
169
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
170 // if here would be an exact copy of the code above
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
171 // compiler would generate some very strange code
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
172 // thus using "r"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
173 __asm __volatile(
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
174 "movq (%3), %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
175 "movq 8(%3), %%mm1\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
176 "movq 16(%3), %%mm2\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
177 "movq 24(%3), %%mm3\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
178 "movq 32(%3), %%mm4\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
179 "movq 40(%3), %%mm5\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
180 "movq 48(%3), %%mm6\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
181 "movq 56(%3), %%mm7\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
182 "packuswb %%mm1, %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
183 "packuswb %%mm3, %%mm2\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
184 "packuswb %%mm5, %%mm4\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
185 "packuswb %%mm7, %%mm6\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
186 "movq %%mm0, (%0)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
187 "movq %%mm2, (%0, %1)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
188 "movq %%mm4, (%0, %1, 2)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
189 "movq %%mm6, (%0, %2)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
190 ::"r" (pix), "r" (line_size), "r" (line_size*3), "r"(p)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
191 :"memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
192 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
193
986e461dc072 Initial revision
glantau
parents:
diff changeset
194 static void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
986e461dc072 Initial revision
glantau
parents:
diff changeset
195 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
196 const DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
197 UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
198 int i;
986e461dc072 Initial revision
glantau
parents:
diff changeset
199
986e461dc072 Initial revision
glantau
parents:
diff changeset
200 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
201 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
202 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
203 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
204 i = 4;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
205 while (i) {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
206 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
207 "movq %2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
208 "movq 8%2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
209 "movq 16%2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
210 "movq 24%2, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
211 "movq %0, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
212 "movq %1, %%mm6\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
213 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
214 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
215 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
216 "paddsw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
217 "paddsw %%mm5, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
218 "movq %%mm6, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
219 "punpcklbw %%mm7, %%mm6\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
220 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
221 "paddsw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
222 "paddsw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
223 "packuswb %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
224 "packuswb %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
225 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
226 "movq %%mm2, %1\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
227 :"+m"(*pix), "+m"(*(pix+line_size))
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
228 :"m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
229 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
230 pix += line_size*2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
231 p += 16;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
232 i--;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
233 };
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
234 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
235
986e461dc072 Initial revision
glantau
parents:
diff changeset
236 static void put_pixels_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
237 {
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
238 int hh;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
239 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
240 const UINT8 *pix;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
241
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
242 p = block;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
243 pix = pixels; // 2s
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
244 #if 0
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
245 do {
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
246 __asm __volatile(
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
247 "movq %1, %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
248 "movq %%mm0, %0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
249 :"=m"(*p)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
250 :"m"(*pix)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
251 :"memory");
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
252 pix += line_size;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
253 p += line_size;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
254 } while (--h);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
255 #else
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
256 // this optimized code is not very usefull
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
257 // the above loop is definitely faster
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
258 // at least on Celeron 500MHz
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
259 hh = h & 3;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
260 while (hh) {
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
261 __asm __volatile(
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
262 "movq %1, %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
263 "movq %%mm0, %0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
264 :"=m"(*p)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
265 :"m"(*pix)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
266 :"memory");
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
267 pix += line_size;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
268 p += line_size;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
269 hh--;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
270 }
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
271 hh=h>>2;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
272 while (hh) {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
273 __asm __volatile(
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
274 "movq (%1), %%mm0 \n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
275 "movq (%1, %2), %%mm1 \n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
276 "movq (%1, %2, 2), %%mm2 \n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
277 "movq (%1, %3), %%mm3 \n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
278 "movq %%mm0, (%0) \n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
279 "movq %%mm1, (%0, %2) \n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
280 "movq %%mm2, (%0, %2, 2) \n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
281 "movq %%mm3, (%0, %3) \n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
282 ::"r"(p), "r"(pix), "r"(line_size), "r"(line_size*3)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
283 :"memory");
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
284 pix += line_size*4;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
285 p += line_size*4;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
286 hh--;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
287 }
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
288 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
289 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
290
986e461dc072 Initial revision
glantau
parents:
diff changeset
291 static void put_pixels_x2_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
292 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
293 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
294 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
295 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
296 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
297 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
298 MOVQ_WONE(mm4);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
299 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
300 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
301 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
302 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
303 "movq 1%1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
304 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
305 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
306 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
307 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
308 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
309 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
310 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
311 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
312 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
313 "paddusw %%mm4, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
314 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
315 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
316 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
317 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
318 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
319 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
320 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
321 pix += line_size; p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
322 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
323 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
324
986e461dc072 Initial revision
glantau
parents:
diff changeset
325 static void put_pixels_y2_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
326 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
327 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
328 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
329 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
330 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
331 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
332 MOVQ_WONE(mm4);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
333 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
334 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
335 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
336 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
337 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
338 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
339 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
340 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
341 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
342 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
343 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
344 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
345 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
346 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
347 "paddusw %%mm4, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
348 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
349 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
350 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
351 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
352 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
353 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
354 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
355 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
356 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
357 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
358 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
359 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
360
986e461dc072 Initial revision
glantau
parents:
diff changeset
361 static void put_pixels_xy2_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
362 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
363 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
364 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
365 p = block;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
366 pix = pixels; // 1s
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
367 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
368 MOVQ_WTWO(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
369 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
370 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
371 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
372 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
373 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
374 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
375 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
376 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
377 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
378 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
379 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
380 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
381 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
382 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
383 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
384 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
385 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
386 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
387 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
388 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
389 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
390 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
391 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
392 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
393 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
394 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
395 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
396 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
397 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
398 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
399 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
400 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
401 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
402 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
403 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
404 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
405 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
406 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
407 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
408
986e461dc072 Initial revision
glantau
parents:
diff changeset
409 static void put_no_rnd_pixels_x2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
410 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
411 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
412 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
413 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
414 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
415 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
416 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
417 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
418 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
419 "movq 1%1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
420 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
421 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
422 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
423 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
424 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
425 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
426 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
427 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
428 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
429 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
430 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
431 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
432 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
433 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
434 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
435 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
436 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
437 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
438 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
439
986e461dc072 Initial revision
glantau
parents:
diff changeset
440 static void put_no_rnd_pixels_y2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
441 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
442 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
443 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
444 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
445 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
446 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
447 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
448 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
449 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
450 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
451 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
452 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
453 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
454 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
455 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
456 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
457 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
458 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
459 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
460 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
461 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
462 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
463 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
464 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
465 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
466 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
467 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
468 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
469 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
470 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
471 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
472
986e461dc072 Initial revision
glantau
parents:
diff changeset
473 static void put_no_rnd_pixels_xy2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
474 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
475 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
476 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
477 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
478 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
479 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
480 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
481 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
482 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
483 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
484 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
485 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
486 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
487 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
488 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
489 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
490 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
491 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
492 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
493 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
494 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
495 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
496 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
497 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
498 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
499 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
500 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
501 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
502 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
503 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
504 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
505 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
506 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
507 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
508 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
509 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
510 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
511 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
512 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
513 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
514 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
515 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
516 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
517 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
518 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
519 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
520
986e461dc072 Initial revision
glantau
parents:
diff changeset
521 static void avg_pixels_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
522 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
523 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
524 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
525 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
526 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
527 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
528 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
529 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
530 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
531 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
532 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
533 "movq %1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
534 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
535 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
536 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
537 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
538 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
539 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
540 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
541 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
542 "paddusw %%mm6, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
543 "paddusw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
544 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
545 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
546 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
547 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
548 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
549 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
550 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
551 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
552 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
553 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
554 while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
555 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
556
986e461dc072 Initial revision
glantau
parents:
diff changeset
557 static void avg_pixels_x2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
558 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
559 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
560 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
561 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
562 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
563 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
564 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
565 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
566 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
567 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
568 "movq %1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
569 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
570 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
571 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
572 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
573 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
574 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
575 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
576 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
577 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
578 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
579 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
580 "paddusw %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
581 "paddusw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
582 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
583 "paddusw %%mm6, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
584 "psrlw $1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
585 "psrlw $1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
586 "paddusw %%mm6, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
587 "paddusw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
588 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
589 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
590 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
591 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
592 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
593 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
594 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
595 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
596 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
597 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
598 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
599 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
600 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
601
986e461dc072 Initial revision
glantau
parents:
diff changeset
602 static void avg_pixels_y2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
603 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
604 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
605 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
606 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
607 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
608 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
609 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
610 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
611 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
612 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
613 "movq %1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
614 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
615 "movq %2, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
616 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
617 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
618 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
619 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
620 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
621 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
622 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
623 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
624 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
625 "paddusw %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
626 "paddusw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
627 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
628 "paddusw %%mm6, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
629 "psrlw $1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
630 "psrlw $1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
631 "paddusw %%mm6, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
632 "paddusw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
633 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
634 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
635 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
636 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
637 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
638 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
639 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
640 :"m"(*pix), "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
641 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
642 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
643 p += line_size ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
644 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
645 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
646
986e461dc072 Initial revision
glantau
parents:
diff changeset
647 static void avg_pixels_xy2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
648 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
649 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
650 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
651 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
652 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
653 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
654 // this doesn't seem to be used offten - so
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
655 // the inside usage of mm_wone is not optimized
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
656 MOVQ_WTWO(mm6);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
657 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
658 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
659 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
660 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
661 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
662 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
663 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
664 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
665 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
666 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
667 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
668 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
669 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
670 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
671 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
672 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
673 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
674 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
675 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
676 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
677 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
678 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
679 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
680 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
681 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
682 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
683 "movq %3, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
684 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
685 "movq %0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
686 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
687 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
688 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
689 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
690 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
691 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
692 "paddusw %%mm5, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
693 "paddusw %%mm5, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
694 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
695 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
696 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
697 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
698 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
699 :"m"(*pix),
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents: 5
diff changeset
700 "m"(*(pix+line_size)), "m"(mm_wone)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
701 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
702 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
703 p += line_size ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
704 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
705 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
706
986e461dc072 Initial revision
glantau
parents:
diff changeset
707 static void avg_no_rnd_pixels_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
708 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
709 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
710 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
711 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
712 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
713 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
714 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
715 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
716 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
717 "movq %0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
718 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
719 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
720 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
721 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
722 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
723 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
724 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
725 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
726 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
727 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
728 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
729 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
730 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
731 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
732 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
733 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
734 p += line_size ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
735 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
736 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
737
986e461dc072 Initial revision
glantau
parents:
diff changeset
738 static void avg_no_rnd_pixels_x2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
739 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
740 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
741 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
742 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
743 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
744 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
745 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
746 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
747 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
748 "movq 1%1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
749 "movq %0, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
750 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
751 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
752 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
753 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
754 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
755 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
756 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
757 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
758 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
759 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
760 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
761 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
762 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
763 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
764 "paddusw %%mm5, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
765 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
766 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
767 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
768 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
769 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
770 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
771 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
772 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
773 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
774 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
775 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
776
986e461dc072 Initial revision
glantau
parents:
diff changeset
777 static void avg_no_rnd_pixels_y2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
778 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
779 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
780 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
781 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
782 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
783 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
784 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
785 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
786 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
787 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
788 "movq %0, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
789 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
790 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
791 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
792 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
793 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
794 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
795 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
796 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
797 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
798 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
799 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
800 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
801 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
802 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
803 "paddusw %%mm5, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
804 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
805 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
806 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
807 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
808 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
809 :"m"(*pix), "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
810 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
811 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
812 p += line_size ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
813 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
814 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
815
986e461dc072 Initial revision
glantau
parents:
diff changeset
816 static void avg_no_rnd_pixels_xy2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
817 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
818 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
819 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
820 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
821 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
822 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
823 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
824 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
825 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
826 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
827 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
828 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
829 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
830 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
831 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
832 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
833 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
834 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
835 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
836 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
837 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
838 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
839 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
840 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
841 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
842 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
843 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
844 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
845 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
846 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
847 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
848 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
849 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
850 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
851 "movq %0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
852 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
853 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
854 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
855 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
856 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
857 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
858 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
859 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
860 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
861 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
862 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
863 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
864 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
865 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
866 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
867 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
868 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
869 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
870 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
871
986e461dc072 Initial revision
glantau
parents:
diff changeset
872 static void sub_pixels_mmx( DCTELEM *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
873 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
874 DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
875 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
876 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
877 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
878 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
879 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
880 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
881 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
882 "movq %1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
883 "movq 8%0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
884 "movq %%mm2, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
885 "punpcklbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
886 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
887 "psubsw %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
888 "psubsw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
889 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
890 "movq %%mm1, 8%0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
891 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
892 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
893 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
894 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
895 p += 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
896 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
897 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
898
986e461dc072 Initial revision
glantau
parents:
diff changeset
899 static void sub_pixels_x2_mmx( DCTELEM *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
900 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
901 DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
902 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
903 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
904 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
905 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
906 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
907 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
908 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
909 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
910 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
911 "movq %1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
912 "movq 8%0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
913 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
914 "movq %%mm2, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
915 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
916 "punpcklbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
917 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
918 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
919 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
920 "paddusw %%mm4, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
921 "paddusw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
922 "paddusw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
923 "paddusw %%mm6, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
924 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
925 "psrlw $1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
926 "psubsw %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
927 "psubsw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
928 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
929 "movq %%mm1, 8%0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
930 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
931 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
932 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
933 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
934 p += 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
935 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
936 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
937
986e461dc072 Initial revision
glantau
parents:
diff changeset
938 static void sub_pixels_y2_mmx( DCTELEM *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
939 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
940 DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
941 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
942 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
943 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
944 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
945 MOVQ_WONE(mm6);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
946 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
947 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
948 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
949 "movq %1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
950 "movq 8%0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
951 "movq %2, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
952 "movq %%mm2, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
953 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
954 "punpcklbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
955 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
956 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
957 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
958 "paddusw %%mm4, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
959 "paddusw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
960 "paddusw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
961 "paddusw %%mm6, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
962 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
963 "psrlw $1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
964 "psubsw %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
965 "psubsw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
966 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
967 "movq %%mm1, 8%0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
968 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
969 :"m"(*pix), "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
970 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
971 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
972 p += 8;
986e461dc072 Initial revision
glantau
parents:
diff changeset
973 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
974 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
975
986e461dc072 Initial revision
glantau
parents:
diff changeset
976 static void sub_pixels_xy2_mmx( DCTELEM *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
977 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
978 DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
979 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
980 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
981 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
982 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
983 MOVQ_WTWO(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
984 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
985 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
986 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
987 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
988 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
989 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
990 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
991 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
992 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
993 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
994 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
995 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
996 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
997 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
998 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
999 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1000 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1001 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1002 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1003 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1004 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1005 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1006 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1007 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1008 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1009 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1010 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1011 "movq %0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1012 "movq 8%0, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1013 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1014 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1015 "psubsw %%mm0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1016 "psubsw %%mm2, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1017 "movq %%mm1, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
1018 "movq %%mm3, 8%0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
1019 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1020 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
1021 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
1022 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
1023 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1024 p += 8 ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1025 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
1026 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
1027
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1028 static void clear_blocks_mmx(DCTELEM *blocks)
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1029 {
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1030 asm volatile(
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1031 "pxor %%mm7, %%mm7 \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1032 "movl $-128*6, %%eax \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1033 "1: \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1034 "movq %%mm7, (%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1035 "movq %%mm7, 8(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1036 "movq %%mm7, 16(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1037 "movq %%mm7, 24(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1038 "addl $32, %%eax \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1039 " js 1b \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1040 : : "r" (((int)blocks)+128*6)
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1041 : "%eax"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1042 );
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1043 }
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1044
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1045 static void just_return() { return; }
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1046
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1047 void dsputil_init_mmx(void)
986e461dc072 Initial revision
glantau
parents:
diff changeset
1048 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
1049 mm_flags = mm_support();
188
5d56c2f7e712 print cpu flags
uid46427
parents: 174
diff changeset
1050 #if 1
5d56c2f7e712 print cpu flags
uid46427
parents: 174
diff changeset
1051 printf("libavcodec: CPU flags:");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1052 if (mm_flags & MM_MMX)
986e461dc072 Initial revision
glantau
parents:
diff changeset
1053 printf(" mmx");
986e461dc072 Initial revision
glantau
parents:
diff changeset
1054 if (mm_flags & MM_MMXEXT)
986e461dc072 Initial revision
glantau
parents:
diff changeset
1055 printf(" mmxext");
986e461dc072 Initial revision
glantau
parents:
diff changeset
1056 if (mm_flags & MM_3DNOW)
986e461dc072 Initial revision
glantau
parents:
diff changeset
1057 printf(" 3dnow");
986e461dc072 Initial revision
glantau
parents:
diff changeset
1058 if (mm_flags & MM_SSE)
986e461dc072 Initial revision
glantau
parents:
diff changeset
1059 printf(" sse");
986e461dc072 Initial revision
glantau
parents:
diff changeset
1060 if (mm_flags & MM_SSE2)
986e461dc072 Initial revision
glantau
parents:
diff changeset
1061 printf(" sse2");
986e461dc072 Initial revision
glantau
parents:
diff changeset
1062 printf("\n");
986e461dc072 Initial revision
glantau
parents:
diff changeset
1063 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
1064
986e461dc072 Initial revision
glantau
parents:
diff changeset
1065 if (mm_flags & MM_MMX) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
1066 get_pixels = get_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1067 put_pixels_clamped = put_pixels_clamped_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1068 add_pixels_clamped = add_pixels_clamped_mmx;
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1069 clear_blocks= clear_blocks_mmx;
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
1070
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1071 pix_abs16x16 = pix_abs16x16_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1072 pix_abs16x16_x2 = pix_abs16x16_x2_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1073 pix_abs16x16_y2 = pix_abs16x16_y2_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1074 pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx;
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1075 pix_abs8x8 = pix_abs8x8_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1076 pix_abs8x8_x2 = pix_abs8x8_x2_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1077 pix_abs8x8_y2 = pix_abs8x8_y2_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1078 pix_abs8x8_xy2= pix_abs8x8_xy2_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1079 av_fdct = fdct_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1080
986e461dc072 Initial revision
glantau
parents:
diff changeset
1081 put_pixels_tab[0] = put_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1082 put_pixels_tab[1] = put_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1083 put_pixels_tab[2] = put_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1084 put_pixels_tab[3] = put_pixels_xy2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1085
986e461dc072 Initial revision
glantau
parents:
diff changeset
1086 put_no_rnd_pixels_tab[0] = put_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1087 put_no_rnd_pixels_tab[1] = put_no_rnd_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1088 put_no_rnd_pixels_tab[2] = put_no_rnd_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1089 put_no_rnd_pixels_tab[3] = put_no_rnd_pixels_xy2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1090
986e461dc072 Initial revision
glantau
parents:
diff changeset
1091 avg_pixels_tab[0] = avg_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1092 avg_pixels_tab[1] = avg_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1093 avg_pixels_tab[2] = avg_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1094 avg_pixels_tab[3] = avg_pixels_xy2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1095
986e461dc072 Initial revision
glantau
parents:
diff changeset
1096 avg_no_rnd_pixels_tab[0] = avg_no_rnd_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1097 avg_no_rnd_pixels_tab[1] = avg_no_rnd_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1098 avg_no_rnd_pixels_tab[2] = avg_no_rnd_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1099 avg_no_rnd_pixels_tab[3] = avg_no_rnd_pixels_xy2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1100
986e461dc072 Initial revision
glantau
parents:
diff changeset
1101 sub_pixels_tab[0] = sub_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1102 sub_pixels_tab[1] = sub_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1103 sub_pixels_tab[2] = sub_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1104 sub_pixels_tab[3] = sub_pixels_xy2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1105
986e461dc072 Initial revision
glantau
parents:
diff changeset
1106 if (mm_flags & MM_MMXEXT) {
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1107 pix_abs16x16 = pix_abs16x16_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1108 pix_abs16x16_x2 = pix_abs16x16_x2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1109 pix_abs16x16_y2 = pix_abs16x16_y2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1110 pix_abs16x16_xy2= pix_abs16x16_xy2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1111
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1112 pix_abs8x8 = pix_abs8x8_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1113 pix_abs8x8_x2 = pix_abs8x8_x2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1114 pix_abs8x8_y2 = pix_abs8x8_y2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1115 pix_abs8x8_xy2= pix_abs8x8_xy2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
1116
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1117 put_pixels_tab[1] = put_pixels_x2_sse;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1118 put_pixels_tab[2] = put_pixels_y2_sse;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1119
986e461dc072 Initial revision
glantau
parents:
diff changeset
1120 avg_pixels_tab[0] = avg_pixels_sse;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1121 avg_pixels_tab[1] = avg_pixels_x2_sse;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1122 avg_pixels_tab[2] = avg_pixels_y2_sse;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1123 avg_pixels_tab[3] = avg_pixels_xy2_sse;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1124
986e461dc072 Initial revision
glantau
parents:
diff changeset
1125 sub_pixels_tab[1] = sub_pixels_x2_sse;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1126 sub_pixels_tab[2] = sub_pixels_y2_sse;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1127 } else if (mm_flags & MM_3DNOW) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
1128 put_pixels_tab[1] = put_pixels_x2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1129 put_pixels_tab[2] = put_pixels_y2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1130
986e461dc072 Initial revision
glantau
parents:
diff changeset
1131 avg_pixels_tab[0] = avg_pixels_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1132 avg_pixels_tab[1] = avg_pixels_x2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1133 avg_pixels_tab[2] = avg_pixels_y2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1134 avg_pixels_tab[3] = avg_pixels_xy2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1135
986e461dc072 Initial revision
glantau
parents:
diff changeset
1136 sub_pixels_tab[1] = sub_pixels_x2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1137 sub_pixels_tab[2] = sub_pixels_y2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
1138 }
19
82d4c9be9873 MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
arpi_esp
parents: 8
diff changeset
1139
42
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
1140 /* idct */
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
1141 if (mm_flags & MM_MMXEXT) {
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
1142 ff_idct = ff_mmxext_idct;
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
1143 } else {
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
1144 ff_idct = ff_mmx_idct;
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
1145 }
174
ac5075a55488 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents: 151
diff changeset
1146 #ifdef SIMPLE_IDCT
ac5075a55488 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents: 151
diff changeset
1147 // ff_idct = simple_idct;
ac5075a55488 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents: 151
diff changeset
1148 ff_idct = simple_idct_mmx;
ac5075a55488 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents: 151
diff changeset
1149 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1150 }
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1151
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1152 #if 0
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1153 // for speed testing
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1154 get_pixels = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1155 put_pixels_clamped = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1156 add_pixels_clamped = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1157
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1158 pix_abs16x16 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1159 pix_abs16x16_x2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1160 pix_abs16x16_y2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1161 pix_abs16x16_xy2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1162
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1163 put_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1164 put_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1165 put_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1166 put_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1167
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1168 put_no_rnd_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1169 put_no_rnd_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1170 put_no_rnd_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1171 put_no_rnd_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1172
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1173 avg_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1174 avg_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1175 avg_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1176 avg_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1177
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1178 avg_no_rnd_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1179 avg_no_rnd_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1180 avg_no_rnd_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1181 avg_no_rnd_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1182
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1183 sub_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1184 sub_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1185 sub_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1186 sub_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1187
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1188 //av_fdct = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1189 //ff_idct = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
1190 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1191 }