annotate i386/dsputil_mmx.c @ 446:efe0c0d40577 libavcodec

* reenabled original xy2 put routine - rounding error is really bad with the new code * added PAVGP macros for parallel processing to safe few more cycles on celerons
author kabi
date Wed, 29 May 2002 19:57:21 +0000
parents 62c01dbdc1e0
children e8c8ca9106aa
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
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 *
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
5 * This library is free software; you can redistribute it and/or
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
7 * License as published by the Free Software Foundation; either
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
8 * version 2 of the License, or (at your option) any later version.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 *
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
10 * This library is distributed in the hope that it will be useful,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
13 * Lesser General Public License for more details.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 *
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
16 * License along with this library; if not, write to the Free Software
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0
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
42
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
47 /* external functions, from idct_mmx.c */
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
48 void ff_mmx_idct(DCTELEM *block);
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
49 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
50
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 /* pixel operations */
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
52 static const uint64_t mm_bfe __attribute__ ((aligned(8))) = 0xfefefefefefefefeULL;
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
53 static const uint64_t mm_bone __attribute__ ((aligned(8))) = 0x0101010101010101ULL;
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
54 static const uint64_t mm_wone __attribute__ ((aligned(8))) = 0x0001000100010001ULL;
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
55 static const uint64_t mm_wtwo __attribute__ ((aligned(8))) = 0x0002000200020002ULL;
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents: 5
diff changeset
56 //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
57 //static const unsigned short mm_wtwo[4] __attribute__ ((aligned(8))) = { 0x2, 0x2, 0x2, 0x2 };
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
58
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
59 #define JUMPALIGN() __asm __volatile (".balign 8"::)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
60 #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
61
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
62 #ifndef PIC
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
63 #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
64 #define MOVQ_WTWO(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_wtwo))
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
65 #define MOVQ_BONE(regd) "movq "MANGLE(mm_bone)", "#regd" \n\t"
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
66 #define MOVQ_BFE(regd) "movq "MANGLE(mm_bfe)", "#regd" \n\t"
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
67 #else
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
68 // 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
69 // pcmpeqd -> -1
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
70 #define MOVQ_WONE(regd) \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
71 __asm __volatile ( \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
72 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
73 "psrlw $15, %%" #regd ::)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
74
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
75 #define MOVQ_WTWO(regd) \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
76 __asm __volatile ( \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
77 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
78 "psrlw $15, %%" #regd " \n\t" \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
79 "psllw $1, %%" #regd ::)
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
80
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
81 #define MOVQ_BONE(regd) \
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
82 "pcmpeqd " #regd ", " #regd " \n\t" \
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
83 "psrlw $15, " #regd " \n\t"\
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
84 "packuswb " #regd ", " #regd " \n\t"
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
85
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
86 #define MOVQ_BFE(regd) \
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
87 "pcmpeqd " #regd ", " #regd " \n\t"\
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
88 "paddb " #regd ", " #regd " \n\t"
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
89 #endif
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
90
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
91 // using mm6 as temporary and for the output result
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
92 // first argument is unmodifed and second is trashed
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
93 // mm7 is supposed to contain 0xfefefefefefefefe
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
94 #define PAVGB_MMX_NO_RND(rega, regb, regr) \
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
95 "movq " #rega ", " #regr " \n\t"\
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
96 "pand " #regb ", " #regr " \n\t"\
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
97 "pxor " #rega ", " #regb " \n\t"\
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
98 "pand %%mm7, " #regb " \n\t"\
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
99 "psrlq $1, " #regb " \n\t"\
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
100 "paddb " #regb ", " #regr " \n\t"
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
101
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
102 #define PAVGB_MMX(rega, regb, regr) \
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
103 "movq " #rega ", " #regr " \n\t"\
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
104 "por " #regb ", " #regr " \n\t"\
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
105 "pxor " #rega ", " #regb " \n\t"\
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
106 "pand %%mm7, " #regb " \n\t"\
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
107 "psrlq $1, " #regb " \n\t"\
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
108 "psubb " #regb ", " #regr " \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
109
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
110 #define PAVGBP_MMX_NO_RND(rega, regb, regr, regc, regd, regp) \
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
111 "movq " #rega ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
112 "movq " #regc ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
113 "pand " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
114 "pand " #regd ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
115 "pxor " #rega ", " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
116 "pxor " #regc ", " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
117 "pand %%mm7, " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
118 "pand %%mm7, " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
119 "psrlq $1, " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
120 "psrlq $1, " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
121 "paddb " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
122 "paddb " #regd ", " #regp " \n\t"
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
123
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
124 #define PAVGBP_MMX(rega, regb, regr, regc, regd, regp) \
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
125 "movq " #rega ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
126 "movq " #regc ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
127 "por " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
128 "por " #regd ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
129 "pxor " #rega ", " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
130 "pxor " #regc ", " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
131 "pand %%mm7, " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
132 "pand %%mm7, " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
133 "psrlq $1, " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
134 "psrlq $1, " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
135 "psubb " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
136 "psubb " #regd ", " #regp " \n\t"
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
137
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
138 /***********************************/
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
139 /* MMX no rounding */
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
140 #define DEF(x, y) x ## _no_rnd_ ## y ##_mmx
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
141
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
142 #define PAVGB(a, b) PAVGB_MMX_NO_RND(a, b, %%mm6)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
143 #define PAVGBR(a, b, c) PAVGB_MMX_NO_RND(a, b, c)
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
144 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
145 #include "dsputil_mmx_rnd.h"
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
146
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
147 #undef DEF
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
148 #undef PAVGB
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
149 #undef PAVGBR
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
150 #undef PAVGBP
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
151 /***********************************/
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
152 /* MMX rounding */
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
153
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
154 #define DEF(x, y) x ## _ ## y ##_mmx
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
155
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
156 #define PAVGB(a, b) PAVGB_MMX(a, b, %%mm6)
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
157 #define PAVGBR(a, b, c) PAVGB_MMX(a, b, c)
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
158 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
159 #include "dsputil_mmx_rnd.h"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
160
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
161 #undef DEF
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
162 #undef PAVGB
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
163 #undef PAVGBR
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
164 #undef PAVGBP
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
165
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
166 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
167 /* 3Dnow specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
168
986e461dc072 Initial revision
glantau
parents:
diff changeset
169 #define DEF(x) x ## _3dnow
986e461dc072 Initial revision
glantau
parents:
diff changeset
170 /* for Athlons PAVGUSB is prefered */
986e461dc072 Initial revision
glantau
parents:
diff changeset
171 #define PAVGB "pavgusb"
986e461dc072 Initial revision
glantau
parents:
diff changeset
172
986e461dc072 Initial revision
glantau
parents:
diff changeset
173 #include "dsputil_mmx_avg.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
174
986e461dc072 Initial revision
glantau
parents:
diff changeset
175 #undef DEF
986e461dc072 Initial revision
glantau
parents:
diff changeset
176 #undef PAVGB
986e461dc072 Initial revision
glantau
parents:
diff changeset
177
986e461dc072 Initial revision
glantau
parents:
diff changeset
178 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
179 /* MMX2 specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
180
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
181 #define DEF(x) x ## _mmx2
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
182
986e461dc072 Initial revision
glantau
parents:
diff changeset
183 /* Introduced only in MMX2 set */
986e461dc072 Initial revision
glantau
parents:
diff changeset
184 #define PAVGB "pavgb"
986e461dc072 Initial revision
glantau
parents:
diff changeset
185
986e461dc072 Initial revision
glantau
parents:
diff changeset
186 #include "dsputil_mmx_avg.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
187
986e461dc072 Initial revision
glantau
parents:
diff changeset
188 #undef DEF
986e461dc072 Initial revision
glantau
parents:
diff changeset
189 #undef PAVGB
986e461dc072 Initial revision
glantau
parents:
diff changeset
190
986e461dc072 Initial revision
glantau
parents:
diff changeset
191 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
192 /* standard MMX */
986e461dc072 Initial revision
glantau
parents:
diff changeset
193
986e461dc072 Initial revision
glantau
parents:
diff changeset
194 static void get_pixels_mmx(DCTELEM *block, const UINT8 *pixels, int line_size)
986e461dc072 Initial revision
glantau
parents:
diff changeset
195 {
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
196 asm volatile(
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
197 "movl $-128, %%eax \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
198 "pxor %%mm7, %%mm7 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
199 ".balign 16 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
200 "1: \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
201 "movq (%0), %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
202 "movq (%0, %2), %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
203 "movq %%mm0, %%mm1 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
204 "movq %%mm2, %%mm3 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
205 "punpcklbw %%mm7, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
206 "punpckhbw %%mm7, %%mm1 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
207 "punpcklbw %%mm7, %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
208 "punpckhbw %%mm7, %%mm3 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
209 "movq %%mm0, (%1, %%eax)\n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
210 "movq %%mm1, 8(%1, %%eax)\n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
211 "movq %%mm2, 16(%1, %%eax)\n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
212 "movq %%mm3, 24(%1, %%eax)\n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
213 "addl %3, %0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
214 "addl $32, %%eax \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
215 "js 1b \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
216 : "+r" (pixels)
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
217 : "r" (block+64), "r" (line_size), "r" (line_size*2)
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
218 : "%eax"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
219 );
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
220 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
221
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
222 static void diff_pixels_mmx(DCTELEM *block, const UINT8 *s1, const UINT8 *s2, int stride)
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
223 {
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
224 asm volatile(
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
225 "pxor %%mm7, %%mm7 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
226 "movl $-128, %%eax \n\t"
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
227 ".balign 16 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
228 "1: \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
229 "movq (%0), %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
230 "movq (%1), %%mm2 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
231 "movq %%mm0, %%mm1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
232 "movq %%mm2, %%mm3 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
233 "punpcklbw %%mm7, %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
234 "punpckhbw %%mm7, %%mm1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
235 "punpcklbw %%mm7, %%mm2 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
236 "punpckhbw %%mm7, %%mm3 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
237 "psubw %%mm2, %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
238 "psubw %%mm3, %%mm1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
239 "movq %%mm0, (%2, %%eax)\n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
240 "movq %%mm1, 8(%2, %%eax)\n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
241 "addl %3, %0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
242 "addl %3, %1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
243 "addl $16, %%eax \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
244 "jnz 1b \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
245 : "+r" (s1), "+r" (s2)
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
246 : "r" (block+64), "r" (stride)
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
247 : "%eax"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
248 );
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
249 }
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
250
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
251 static void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
986e461dc072 Initial revision
glantau
parents:
diff changeset
252 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
253 const DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
254 UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
255
986e461dc072 Initial revision
glantau
parents:
diff changeset
256 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
257 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
258 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
259 /* unrolled loop */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
260 __asm __volatile(
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
261 "movq %3, %%mm0\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
262 "movq 8%3, %%mm1\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
263 "movq 16%3, %%mm2\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
264 "movq 24%3, %%mm3\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
265 "movq 32%3, %%mm4\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
266 "movq 40%3, %%mm5\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
267 "movq 48%3, %%mm6\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
268 "movq 56%3, %%mm7\n\t"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
269 "packuswb %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
270 "packuswb %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
271 "packuswb %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
272 "packuswb %%mm7, %%mm6\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
273 "movq %%mm0, (%0)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
274 "movq %%mm2, (%0, %1)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
275 "movq %%mm4, (%0, %1, 2)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
276 "movq %%mm6, (%0, %2)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
277 ::"r" (pix), "r" (line_size), "r" (line_size*3), "m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
278 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
279 pix += line_size*4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
280 p += 32;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
281
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
282 // 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
283 // compiler would generate some very strange code
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
284 // thus using "r"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
285 __asm __volatile(
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
286 "movq (%3), %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
287 "movq 8(%3), %%mm1\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
288 "movq 16(%3), %%mm2\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
289 "movq 24(%3), %%mm3\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
290 "movq 32(%3), %%mm4\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
291 "movq 40(%3), %%mm5\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
292 "movq 48(%3), %%mm6\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
293 "movq 56(%3), %%mm7\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
294 "packuswb %%mm1, %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
295 "packuswb %%mm3, %%mm2\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
296 "packuswb %%mm5, %%mm4\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
297 "packuswb %%mm7, %%mm6\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
298 "movq %%mm0, (%0)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
299 "movq %%mm2, (%0, %1)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
300 "movq %%mm4, (%0, %1, 2)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
301 "movq %%mm6, (%0, %2)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
302 ::"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
303 :"memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
304 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
305
986e461dc072 Initial revision
glantau
parents:
diff changeset
306 static void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
986e461dc072 Initial revision
glantau
parents:
diff changeset
307 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
308 const DCTELEM *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
309 UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
310 int i;
986e461dc072 Initial revision
glantau
parents:
diff changeset
311
986e461dc072 Initial revision
glantau
parents:
diff changeset
312 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
313 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
314 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
315 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
316 i = 4;
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
317 do {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
318 __asm __volatile(
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
319 "movq (%2), %%mm0\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
320 "movq 8(%2), %%mm1\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
321 "movq 16(%2), %%mm2\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
322 "movq 24(%2), %%mm3\n\t"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
323 "movq %0, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
324 "movq %1, %%mm6\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
325 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
326 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
327 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
328 "paddsw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
329 "paddsw %%mm5, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
330 "movq %%mm6, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
331 "punpcklbw %%mm7, %%mm6\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
332 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
333 "paddsw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
334 "paddsw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
335 "packuswb %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
336 "packuswb %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
337 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
338 "movq %%mm2, %1\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
339 :"+m"(*pix), "+m"(*(pix+line_size))
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
340 :"r"(p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
341 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
342 pix += line_size*2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
343 p += 16;
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
344 } while (--i);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
345 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
346
986e461dc072 Initial revision
glantau
parents:
diff changeset
347 static void put_pixels_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
348 {
420
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
349 asm volatile
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
350 (
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
351 "lea (%3, %3), %%eax \n\t"
422
aa4a1c6209bd * baling 8 seems to have the same speed
kabi
parents: 421
diff changeset
352 ".balign 8 \n\t"
420
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
353 "1: \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
354 "movq (%1), %%mm0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
355 "movq (%1, %3), %%mm1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
356 "movq %%mm0, (%2) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
357 "movq %%mm1, (%2, %3) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
358 "addl %%eax, %1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
359 "addl %%eax, %2 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
360 "movq (%1), %%mm0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
361 "movq (%1, %3), %%mm1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
362 "movq %%mm0, (%2) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
363 "movq %%mm1, (%2, %3) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
364 "addl %%eax, %1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
365 "addl %%eax, %2 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
366 "subl $4, %0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
367 "jnz 1b \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
368 : "+g"(h), "+r" (pixels), "+r" (block)
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
369 : "r"(line_size)
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
370 : "%eax", "memory"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
371 );
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
372 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
373
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
374 #if 1
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
375 static void put_pixels_xy2_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
376 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
377 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
378 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
379 p = block;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
380 pix = pixels; // 1s
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
381 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
382 MOVQ_WTWO(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
383 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
384 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
385 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
386 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
387 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
388 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
389 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
390 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
391 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
392 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
393 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
394 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
395 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
396 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
397 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
398 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
399 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
400 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
401 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
402 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
403 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
404 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
405 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
406 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
407 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
408 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
409 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
410 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
411 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
412 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
413 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
414 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
415 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
416 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
417 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
418 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
419 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
420 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
421 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
422
986e461dc072 Initial revision
glantau
parents:
diff changeset
423 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
424 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
425 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
426 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
427 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
428 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
429 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
430 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
431 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
432 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
433 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
434 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
435 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
436 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
437 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
438 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
439 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
440 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
441 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
442 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
443 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
444 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
445 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
446 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
447 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
448 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
449 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
450 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
451 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
452 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
453 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
454 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
455 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
456 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
457 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
458 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
459 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
460 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
461 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
462 :"=m"(*p)
986e461dc072 Initial revision
glantau
parents:
diff changeset
463 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
464 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
465 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
466 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
467 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
468 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
469 }
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
470 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
471 static void avg_pixels_mmx(UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
472 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
473 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
474 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
475 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
476 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
477 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
478 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
479 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
480 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
481 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
482 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
483 "movq %1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
484 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
485 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
486 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
487 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
488 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
489 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
490 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
491 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
492 "paddusw %%mm6, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
493 "paddusw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
494 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
495 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
496 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
497 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
498 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
499 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
500 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
501 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
502 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
503 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
504 while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
505 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
506
986e461dc072 Initial revision
glantau
parents:
diff changeset
507 static void avg_pixels_x2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
508 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
509 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
510 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
511 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
512 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
513 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
514 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
515 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
516 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
517 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
518 "movq %1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
519 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
520 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
521 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
522 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
523 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
524 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
525 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
526 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
527 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
528 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
529 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
530 "paddusw %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
531 "paddusw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
532 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
533 "paddusw %%mm6, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
534 "psrlw $1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
535 "psrlw $1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
536 "paddusw %%mm6, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
537 "paddusw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
538 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
539 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
540 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
541 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
542 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
543 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
544 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
545 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
546 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
547 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
548 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
549 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
550 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
551
986e461dc072 Initial revision
glantau
parents:
diff changeset
552 static void avg_pixels_y2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
553 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
554 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
555 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
556 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
557 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
558 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
559 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
560 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
561 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
562 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
563 "movq %1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
564 "movq %0, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
565 "movq %2, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
566 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
567 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
568 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
569 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
570 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
571 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
572 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
573 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
574 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
575 "paddusw %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
576 "paddusw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
577 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
578 "paddusw %%mm6, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
579 "psrlw $1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
580 "psrlw $1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
581 "paddusw %%mm6, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
582 "paddusw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
583 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
584 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
585 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
586 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
587 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
588 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
589 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
590 :"m"(*pix), "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
591 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
592 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
593 p += line_size ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
594 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
595 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
596
986e461dc072 Initial revision
glantau
parents:
diff changeset
597 static void avg_pixels_xy2_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
598 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
599 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
600 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
601 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
602 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
603 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
604 // 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
605 // 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
606 MOVQ_WTWO(mm6);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
607 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
608 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
609 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
610 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
611 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
612 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
613 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
614 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
615 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
616 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
617 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
618 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
619 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
620 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
621 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
622 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
623 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
624 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
625 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
626 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
627 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
628 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
629 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
630 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
631 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
632 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
633 "movq %3, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
634 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
635 "movq %0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
636 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
637 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
638 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
639 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
640 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
641 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
642 "paddusw %%mm5, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
643 "paddusw %%mm5, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
644 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
645 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
646 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
647 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
648 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
649 :"m"(*pix),
8
1b4461b5a7fb Sync with mplayer's stuff
nickols_k
parents: 5
diff changeset
650 "m"(*(pix+line_size)), "m"(mm_wone)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
651 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
652 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
653 p += line_size ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
654 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
655 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
656
986e461dc072 Initial revision
glantau
parents:
diff changeset
657 static void avg_no_rnd_pixels_mmx( UINT8 *block, const UINT8 *pixels, int line_size, int h)
986e461dc072 Initial revision
glantau
parents:
diff changeset
658 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
659 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
660 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
661 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
662 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
663 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
664 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
665 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
666 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
667 "movq %0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
668 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
669 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
670 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
671 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
672 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
673 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
674 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
675 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
676 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
677 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
678 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
679 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
680 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
681 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
682 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
683 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
684 p += line_size ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
685 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
686 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
687
986e461dc072 Initial revision
glantau
parents:
diff changeset
688 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
689 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
690 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
691 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
692 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
693 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
694 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
695 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
696 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
697 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
698 "movq 1%1, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
699 "movq %0, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
700 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
701 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
702 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
703 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
704 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
705 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
706 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
707 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
708 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
709 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
710 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
711 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
712 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
713 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
714 "paddusw %%mm5, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
715 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
716 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
717 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
718 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
719 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
720 :"m"(*pix)
986e461dc072 Initial revision
glantau
parents:
diff changeset
721 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
722 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
723 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
724 } while (--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
725 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
726
986e461dc072 Initial revision
glantau
parents:
diff changeset
727 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
728 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
729 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
730 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
731 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
732 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
733 MOVQ_ZERO(mm7);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
734 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
735 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
736 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
737 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
738 "movq %0, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
739 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
740 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
741 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
742 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
743 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
744 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
745 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
746 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
747 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
748 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
749 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
750 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
751 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
752 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
753 "paddusw %%mm5, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
754 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
755 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
756 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
757 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
758 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
759 :"m"(*pix), "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
760 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
761 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
762 p += line_size ;
986e461dc072 Initial revision
glantau
parents:
diff changeset
763 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
764 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
765
986e461dc072 Initial revision
glantau
parents:
diff changeset
766 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
767 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
768 UINT8 *p;
986e461dc072 Initial revision
glantau
parents:
diff changeset
769 const UINT8 *pix;
986e461dc072 Initial revision
glantau
parents:
diff changeset
770 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
771 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
772 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
773 MOVQ_WONE(mm6);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
774 JUMPALIGN();
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
775 do {
986e461dc072 Initial revision
glantau
parents:
diff changeset
776 __asm __volatile(
986e461dc072 Initial revision
glantau
parents:
diff changeset
777 "movq %1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
778 "movq %2, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
779 "movq 1%1, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
780 "movq 1%2, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
781 "movq %%mm0, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
782 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
783 "punpcklbw %%mm7, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
784 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
785 "punpckhbw %%mm7, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
786 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
787 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
788 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
789 "movq %%mm4, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
790 "movq %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
791 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
792 "punpcklbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
793 "punpckhbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
794 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
795 "paddusw %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
796 "paddusw %%mm3, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
797 "paddusw %%mm6, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
798 "paddusw %%mm6, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
799 "paddusw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
800 "paddusw %%mm1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
801 "movq %0, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
802 "psrlw $2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
803 "movq %%mm1, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
804 "psrlw $2, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
805 "punpcklbw %%mm7, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
806 "punpckhbw %%mm7, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
807 "paddusw %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
808 "paddusw %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
809 "psrlw $1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
810 "psrlw $1, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
811 "packuswb %%mm2, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
812 "movq %%mm0, %0\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
813 :"+m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
814 :"m"(*pix),
986e461dc072 Initial revision
glantau
parents:
diff changeset
815 "m"(*(pix+line_size))
986e461dc072 Initial revision
glantau
parents:
diff changeset
816 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
817 pix += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
818 p += line_size;
986e461dc072 Initial revision
glantau
parents:
diff changeset
819 } while(--h);
986e461dc072 Initial revision
glantau
parents:
diff changeset
820 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
821
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
822 static void clear_blocks_mmx(DCTELEM *blocks)
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
823 {
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
824 asm volatile(
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
825 "pxor %%mm7, %%mm7 \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
826 "movl $-128*6, %%eax \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
827 "1: \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
828 "movq %%mm7, (%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
829 "movq %%mm7, 8(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
830 "movq %%mm7, 16(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
831 "movq %%mm7, 24(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
832 "addl $32, %%eax \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
833 " js 1b \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
834 : : "r" (((int)blocks)+128*6)
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
835 : "%eax"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
836 );
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
837 }
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
838
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
839 #if 0
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
840 static void just_return() { return; }
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
841 #endif
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
842
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
843 void dsputil_init_mmx(void)
986e461dc072 Initial revision
glantau
parents:
diff changeset
844 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
845 mm_flags = mm_support();
188
5d56c2f7e712 print cpu flags
uid46427
parents: 174
diff changeset
846 #if 1
5d56c2f7e712 print cpu flags
uid46427
parents: 174
diff changeset
847 printf("libavcodec: CPU flags:");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
848 if (mm_flags & MM_MMX)
986e461dc072 Initial revision
glantau
parents:
diff changeset
849 printf(" mmx");
986e461dc072 Initial revision
glantau
parents:
diff changeset
850 if (mm_flags & MM_MMXEXT)
986e461dc072 Initial revision
glantau
parents:
diff changeset
851 printf(" mmxext");
986e461dc072 Initial revision
glantau
parents:
diff changeset
852 if (mm_flags & MM_3DNOW)
986e461dc072 Initial revision
glantau
parents:
diff changeset
853 printf(" 3dnow");
986e461dc072 Initial revision
glantau
parents:
diff changeset
854 if (mm_flags & MM_SSE)
986e461dc072 Initial revision
glantau
parents:
diff changeset
855 printf(" sse");
986e461dc072 Initial revision
glantau
parents:
diff changeset
856 if (mm_flags & MM_SSE2)
986e461dc072 Initial revision
glantau
parents:
diff changeset
857 printf(" sse2");
986e461dc072 Initial revision
glantau
parents:
diff changeset
858 printf("\n");
986e461dc072 Initial revision
glantau
parents:
diff changeset
859 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
860
986e461dc072 Initial revision
glantau
parents:
diff changeset
861 if (mm_flags & MM_MMX) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
862 get_pixels = get_pixels_mmx;
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
863 diff_pixels = diff_pixels_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
864 put_pixels_clamped = put_pixels_clamped_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
865 add_pixels_clamped = add_pixels_clamped_mmx;
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
866 clear_blocks= clear_blocks_mmx;
415
1c3f42442fba * added simple test main - see comments about how to
kabi
parents: 402
diff changeset
867
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
868 pix_abs16x16 = pix_abs16x16_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
869 pix_abs16x16_x2 = pix_abs16x16_x2_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
870 pix_abs16x16_y2 = pix_abs16x16_y2_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
871 pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx;
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
872 pix_abs8x8 = pix_abs8x8_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
873 pix_abs8x8_x2 = pix_abs8x8_x2_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
874 pix_abs8x8_y2 = pix_abs8x8_y2_mmx;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
875 pix_abs8x8_xy2= pix_abs8x8_xy2_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
876 av_fdct = fdct_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
877
986e461dc072 Initial revision
glantau
parents:
diff changeset
878 put_pixels_tab[0] = put_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
879 put_pixels_tab[1] = put_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
880 put_pixels_tab[2] = put_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
881 put_pixels_tab[3] = put_pixels_xy2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
882
986e461dc072 Initial revision
glantau
parents:
diff changeset
883 put_no_rnd_pixels_tab[0] = put_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
884 put_no_rnd_pixels_tab[1] = put_no_rnd_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
885 put_no_rnd_pixels_tab[2] = put_no_rnd_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
886 put_no_rnd_pixels_tab[3] = put_no_rnd_pixels_xy2_mmx;
415
1c3f42442fba * added simple test main - see comments about how to
kabi
parents: 402
diff changeset
887
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
888 avg_pixels_tab[0] = avg_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
889 avg_pixels_tab[1] = avg_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
890 avg_pixels_tab[2] = avg_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
891 avg_pixels_tab[3] = avg_pixels_xy2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
892
986e461dc072 Initial revision
glantau
parents:
diff changeset
893 avg_no_rnd_pixels_tab[0] = avg_no_rnd_pixels_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
894 avg_no_rnd_pixels_tab[1] = avg_no_rnd_pixels_x2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
895 avg_no_rnd_pixels_tab[2] = avg_no_rnd_pixels_y2_mmx;
986e461dc072 Initial revision
glantau
parents:
diff changeset
896 avg_no_rnd_pixels_tab[3] = avg_no_rnd_pixels_xy2_mmx;
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
897
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
898 if (mm_flags & MM_MMXEXT) {
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
899 pix_abs16x16 = pix_abs16x16_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
900 pix_abs16x16_x2 = pix_abs16x16_x2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
901 pix_abs16x16_y2 = pix_abs16x16_y2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
902 pix_abs16x16_xy2= pix_abs16x16_xy2_mmx2;
415
1c3f42442fba * added simple test main - see comments about how to
kabi
parents: 402
diff changeset
903
294
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
904 pix_abs8x8 = pix_abs8x8_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
905 pix_abs8x8_x2 = pix_abs8x8_x2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
906 pix_abs8x8_y2 = pix_abs8x8_y2_mmx2;
944632089814 4MV motion estimation (not finished yet)
michaelni
parents: 247
diff changeset
907 pix_abs8x8_xy2= pix_abs8x8_xy2_mmx2;
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
908
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
909 put_pixels_tab[1] = put_pixels_x2_mmx2;
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
910 put_pixels_tab[2] = put_pixels_y2_mmx2;
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
911 put_no_rnd_pixels_tab[1] = put_no_rnd_pixels_x2_mmx2;
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
912 put_no_rnd_pixels_tab[2] = put_no_rnd_pixels_y2_mmx2;
415
1c3f42442fba * added simple test main - see comments about how to
kabi
parents: 402
diff changeset
913
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
914 avg_pixels_tab[0] = avg_pixels_mmx2;
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
915 avg_pixels_tab[1] = avg_pixels_x2_mmx2;
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
916 avg_pixels_tab[2] = avg_pixels_y2_mmx2;
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
917 avg_pixels_tab[3] = avg_pixels_xy2_mmx2;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
918 } else if (mm_flags & MM_3DNOW) {
986e461dc072 Initial revision
glantau
parents:
diff changeset
919 put_pixels_tab[1] = put_pixels_x2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
920 put_pixels_tab[2] = put_pixels_y2_3dnow;
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
921 put_no_rnd_pixels_tab[1] = put_no_rnd_pixels_x2_3dnow;
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
922 put_no_rnd_pixels_tab[2] = put_no_rnd_pixels_y2_3dnow;
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
923
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
924 avg_pixels_tab[0] = avg_pixels_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
925 avg_pixels_tab[1] = avg_pixels_x2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
926 avg_pixels_tab[2] = avg_pixels_y2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
927 avg_pixels_tab[3] = avg_pixels_xy2_3dnow;
986e461dc072 Initial revision
glantau
parents:
diff changeset
928 }
19
82d4c9be9873 MMX/MMXEXT iDCT support, using external functions currently defined in libmpeg2
arpi_esp
parents: 8
diff changeset
929
42
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
930 /* idct */
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
931 if (mm_flags & MM_MMXEXT) {
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
932 ff_idct = ff_mmxext_idct;
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
933 } else {
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
934 ff_idct = ff_mmx_idct;
8068c4bce9c1 added mmx idct
glantau
parents: 19
diff changeset
935 }
174
ac5075a55488 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents: 151
diff changeset
936 #ifdef SIMPLE_IDCT
ac5075a55488 new IDCT code by Michael Niedermayer (michaelni@gmx.at) - #define SIMPLE_IDCT to enable
arpi_esp
parents: 151
diff changeset
937 // 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
938 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
939 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
940 }
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
941
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
942 #if 0
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
943 // for speed testing
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
944 get_pixels = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
945 put_pixels_clamped = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
946 add_pixels_clamped = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
947
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
948 pix_abs16x16 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
949 pix_abs16x16_x2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
950 pix_abs16x16_y2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
951 pix_abs16x16_xy2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
952
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
953 put_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
954 put_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
955 put_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
956 put_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
957
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
958 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
959 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
960 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
961 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
962
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
963 avg_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
964 avg_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
965 avg_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
966 avg_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
967
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
968 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
969 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
970 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
971 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
972
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
973 //av_fdct = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
974 //ff_idct = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
975 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
976 }
402
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
977
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
978 /* remove any non bit exact operation (testing purpose). NOTE that
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
979 this function should be kept as small as possible because it is
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
980 always difficult to test automatically non bit exact cases. */
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
981 void dsputil_set_bit_exact_mmx(void)
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
982 {
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
983 if (mm_flags & MM_MMX) {
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
984 if (mm_flags & MM_MMXEXT) {
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
985 put_no_rnd_pixels_tab[1] = put_no_rnd_pixels_x2_mmx;
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
986 put_no_rnd_pixels_tab[2] = put_no_rnd_pixels_y2_mmx;
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
987 avg_pixels_tab[3] = avg_pixels_xy2_mmx;
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
988 } else if (mm_flags & MM_3DNOW) {
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
989 put_no_rnd_pixels_tab[1] = put_no_rnd_pixels_x2_mmx;
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
990 put_no_rnd_pixels_tab[2] = put_no_rnd_pixels_y2_mmx;
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
991 avg_pixels_tab[3] = avg_pixels_xy2_mmx;
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
992 }
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
993 }
92d143c2d5a8 removed unused code
glantau
parents: 393
diff changeset
994 }