annotate i386/dsputil_mmx.c @ 2633:72e6ffa1f3a5 libavcodec

MMX for H.264 deblocking filter
author lorenm
date Mon, 25 Apr 2005 01:01:41 +0000
parents 86e2b1424801
children 24472383b36f
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.
1739
07a484280a82 copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents: 1729
diff changeset
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 *
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
6 * This library is free software; you can redistribute it and/or
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
8 * License as published by the Free Software Foundation; either
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
9 * version 2 of the License, or (at your option) any later version.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 *
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
11 * This library is distributed in the hope that it will be useful,
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
14 * Lesser General Public License for more details.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 *
429
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
17 * License along with this library; if not, write to the Free Software
718a22dc121f license/copyright change
glantau
parents: 422
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
22
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 #include "../dsputil.h"
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
24 #include "../simple_idct.h"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
25 #include "../mpegvideo.h"
1984
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
26 #include "mmx.h"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
27
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
28 //#undef NDEBUG
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
29 //#include <assert.h>
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
30
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
31 extern const uint8_t ff_h263_loop_filter_strength[32];
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
32
5
4479bcab253e suppressed no longer needed emms()
glantau
parents: 0
diff changeset
33 int mm_flags; /* multimedia extension flags */
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
34
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 /* pixel operations */
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
36 static const uint64_t mm_bone attribute_used __attribute__ ((aligned(8))) = 0x0101010101010101ULL;
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
37 static const uint64_t mm_wone attribute_used __attribute__ ((aligned(8))) = 0x0001000100010001ULL;
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
38 static const uint64_t mm_wtwo attribute_used __attribute__ ((aligned(8))) = 0x0002000200020002ULL;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
39
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
40 static const uint64_t ff_pw_20 attribute_used __attribute__ ((aligned(8))) = 0x0014001400140014ULL;
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
41 static const uint64_t ff_pw_3 attribute_used __attribute__ ((aligned(8))) = 0x0003000300030003ULL;
2633
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
42 static const uint64_t ff_pw_4 attribute_used __attribute__ ((aligned(8))) = 0x0004000400040004ULL;
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
43 static const uint64_t ff_pw_5 attribute_used __attribute__ ((aligned(8))) = 0x0005000500050005ULL;
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
44 static const uint64_t ff_pw_16 attribute_used __attribute__ ((aligned(8))) = 0x0010001000100010ULL;
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
45 static const uint64_t ff_pw_32 attribute_used __attribute__ ((aligned(8))) = 0x0020002000200020ULL;
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
46 static const uint64_t ff_pw_15 attribute_used __attribute__ ((aligned(8))) = 0x000F000F000F000FULL;
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
47
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
48 static const uint64_t ff_pb_FC attribute_used __attribute__ ((aligned(8))) = 0xFCFCFCFCFCFCFCFCULL;
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
49
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
50 #define JUMPALIGN() __asm __volatile (".balign 8"::)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
51 #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
52
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
53 #define MOVQ_WONE(regd) \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
54 __asm __volatile ( \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
55 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
56 "psrlw $15, %%" #regd ::)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
57
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
58 #define MOVQ_BFE(regd) \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
59 __asm __volatile ( \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
60 "pcmpeqd %%" #regd ", %%" #regd " \n\t"\
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
61 "paddb %%" #regd ", %%" #regd " \n\t" ::)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
62
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
63 #ifndef PIC
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
64 #define MOVQ_BONE(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_bone))
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
65 #define MOVQ_WTWO(regd) __asm __volatile ("movq %0, %%" #regd " \n\t" ::"m"(mm_wtwo))
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
66 #else
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
67 // 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
68 // pcmpeqd -> -1
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
69 #define MOVQ_BONE(regd) \
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
70 __asm __volatile ( \
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
71 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
72 "psrlw $15, %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
73 "packuswb %%" #regd ", %%" #regd " \n\t" ::)
247
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 ( \
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
77 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
78 "psrlw $15, %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
79 "psllw $1, %%" #regd " \n\t"::)
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
80
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
81 #endif
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
82
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
83 // using regr as temporary and for the output result
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
84 // first argument is unmodifed and second is trashed
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
85 // regfe is supposed to contain 0xfefefefefefefefe
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
86 #define PAVGB_MMX_NO_RND(rega, regb, regr, regfe) \
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
87 "movq " #rega ", " #regr " \n\t"\
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
88 "pand " #regb ", " #regr " \n\t"\
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
89 "pxor " #rega ", " #regb " \n\t"\
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
90 "pand " #regfe "," #regb " \n\t"\
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
91 "psrlq $1, " #regb " \n\t"\
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
92 "paddb " #regb ", " #regr " \n\t"
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
93
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
94 #define PAVGB_MMX(rega, regb, regr, regfe) \
445
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 "por " #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"\
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
98 "pand " #regfe "," #regb " \n\t"\
444
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 "psubb " #regb ", " #regr " \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
101
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
102 // mm6 is supposed to contain 0xfefefefefefefefe
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
103 #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
104 "movq " #rega ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
105 "movq " #regc ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
106 "pand " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
107 "pand " #regd ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
108 "pxor " #rega ", " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
109 "pxor " #regc ", " #regd " \n\t"\
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
110 "pand %%mm6, " #regb " \n\t"\
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
111 "pand %%mm6, " #regd " \n\t"\
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
112 "psrlq $1, " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
113 "psrlq $1, " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
114 "paddb " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
115 "paddb " #regd ", " #regp " \n\t"
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
116
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
117 #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
118 "movq " #rega ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
119 "movq " #regc ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
120 "por " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
121 "por " #regd ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
122 "pxor " #rega ", " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
123 "pxor " #regc ", " #regd " \n\t"\
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
124 "pand %%mm6, " #regb " \n\t"\
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
125 "pand %%mm6, " #regd " \n\t"\
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
126 "psrlq $1, " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
127 "psrlq $1, " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
128 "psubb " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
129 "psubb " #regd ", " #regp " \n\t"
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
130
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
131 /***********************************/
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
132 /* MMX no rounding */
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
133 #define DEF(x, y) x ## _no_rnd_ ## y ##_mmx
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
134 #define SET_RND MOVQ_WONE
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
135 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f)
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
136 #define PAVGB(a, b, c, e) PAVGB_MMX_NO_RND(a, b, c, e)
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
137
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
138 #include "dsputil_mmx_rnd.h"
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
139
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
140 #undef DEF
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
141 #undef SET_RND
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
142 #undef PAVGBP
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
143 #undef PAVGB
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
144 /***********************************/
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
145 /* MMX rounding */
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
146
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
147 #define DEF(x, y) x ## _ ## y ##_mmx
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
148 #define SET_RND MOVQ_WTWO
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
149 #define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f)
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
150 #define PAVGB(a, b, c, e) PAVGB_MMX(a, b, c, e)
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 #include "dsputil_mmx_rnd.h"
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 #undef DEF
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
155 #undef SET_RND
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
156 #undef PAVGBP
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
157 #undef PAVGB
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
158
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
159 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
160 /* 3Dnow specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
161
986e461dc072 Initial revision
glantau
parents:
diff changeset
162 #define DEF(x) x ## _3dnow
986e461dc072 Initial revision
glantau
parents:
diff changeset
163 /* for Athlons PAVGUSB is prefered */
986e461dc072 Initial revision
glantau
parents:
diff changeset
164 #define PAVGB "pavgusb"
986e461dc072 Initial revision
glantau
parents:
diff changeset
165
986e461dc072 Initial revision
glantau
parents:
diff changeset
166 #include "dsputil_mmx_avg.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
167
986e461dc072 Initial revision
glantau
parents:
diff changeset
168 #undef DEF
986e461dc072 Initial revision
glantau
parents:
diff changeset
169 #undef PAVGB
986e461dc072 Initial revision
glantau
parents:
diff changeset
170
986e461dc072 Initial revision
glantau
parents:
diff changeset
171 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
172 /* MMX2 specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
173
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
174 #define DEF(x) x ## _mmx2
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
175
986e461dc072 Initial revision
glantau
parents:
diff changeset
176 /* Introduced only in MMX2 set */
986e461dc072 Initial revision
glantau
parents:
diff changeset
177 #define PAVGB "pavgb"
986e461dc072 Initial revision
glantau
parents:
diff changeset
178
986e461dc072 Initial revision
glantau
parents:
diff changeset
179 #include "dsputil_mmx_avg.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
180
986e461dc072 Initial revision
glantau
parents:
diff changeset
181 #undef DEF
986e461dc072 Initial revision
glantau
parents:
diff changeset
182 #undef PAVGB
986e461dc072 Initial revision
glantau
parents:
diff changeset
183
986e461dc072 Initial revision
glantau
parents:
diff changeset
184 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
185 /* standard MMX */
986e461dc072 Initial revision
glantau
parents:
diff changeset
186
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
187 #ifdef CONFIG_ENCODERS
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
188 static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
189 {
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
190 asm volatile(
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
191 "mov $-128, %%"REG_a" \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
192 "pxor %%mm7, %%mm7 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
193 ".balign 16 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
194 "1: \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
195 "movq (%0), %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
196 "movq (%0, %2), %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
197 "movq %%mm0, %%mm1 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
198 "movq %%mm2, %%mm3 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
199 "punpcklbw %%mm7, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
200 "punpckhbw %%mm7, %%mm1 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
201 "punpcklbw %%mm7, %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
202 "punpckhbw %%mm7, %%mm3 \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
203 "movq %%mm0, (%1, %%"REG_a")\n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
204 "movq %%mm1, 8(%1, %%"REG_a")\n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
205 "movq %%mm2, 16(%1, %%"REG_a")\n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
206 "movq %%mm3, 24(%1, %%"REG_a")\n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
207 "add %3, %0 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
208 "add $32, %%"REG_a" \n\t"
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
209 "js 1b \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
210 : "+r" (pixels)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
211 : "r" (block+64), "r" ((long)line_size), "r" ((long)line_size*2)
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
212 : "%"REG_a
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
213 );
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
214 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
215
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
216 static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride)
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
217 {
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
218 asm volatile(
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
219 "pxor %%mm7, %%mm7 \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
220 "mov $-128, %%"REG_a" \n\t"
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
221 ".balign 16 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
222 "1: \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
223 "movq (%0), %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
224 "movq (%1), %%mm2 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
225 "movq %%mm0, %%mm1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
226 "movq %%mm2, %%mm3 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
227 "punpcklbw %%mm7, %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
228 "punpckhbw %%mm7, %%mm1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
229 "punpcklbw %%mm7, %%mm2 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
230 "punpckhbw %%mm7, %%mm3 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
231 "psubw %%mm2, %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
232 "psubw %%mm3, %%mm1 \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
233 "movq %%mm0, (%2, %%"REG_a")\n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
234 "movq %%mm1, 8(%2, %%"REG_a")\n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
235 "add %3, %0 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
236 "add %3, %1 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
237 "add $16, %%"REG_a" \n\t"
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
238 "jnz 1b \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
239 : "+r" (s1), "+r" (s2)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
240 : "r" (block+64), "r" ((long)stride)
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
241 : "%"REG_a
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
242 );
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
243 }
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
244 #endif //CONFIG_ENCODERS
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
245
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
246 void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
247 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
248 const DCTELEM *p;
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
249 uint8_t *pix;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
250
986e461dc072 Initial revision
glantau
parents:
diff changeset
251 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
252 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
253 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
254 /* unrolled loop */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
255 __asm __volatile(
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
256 "movq %3, %%mm0\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
257 "movq 8%3, %%mm1\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
258 "movq 16%3, %%mm2\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
259 "movq 24%3, %%mm3\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
260 "movq 32%3, %%mm4\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
261 "movq 40%3, %%mm5\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
262 "movq 48%3, %%mm6\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
263 "movq 56%3, %%mm7\n\t"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
264 "packuswb %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
265 "packuswb %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
266 "packuswb %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
267 "packuswb %%mm7, %%mm6\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
268 "movq %%mm0, (%0)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
269 "movq %%mm2, (%0, %1)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
270 "movq %%mm4, (%0, %1, 2)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
271 "movq %%mm6, (%0, %2)\n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
272 ::"r" (pix), "r" ((long)line_size), "r" ((long)line_size*3), "m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
273 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
274 pix += line_size*4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
275 p += 32;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
276
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
277 // 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
278 // compiler would generate some very strange code
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
279 // thus using "r"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
280 __asm __volatile(
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
281 "movq (%3), %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
282 "movq 8(%3), %%mm1\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
283 "movq 16(%3), %%mm2\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
284 "movq 24(%3), %%mm3\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
285 "movq 32(%3), %%mm4\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
286 "movq 40(%3), %%mm5\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
287 "movq 48(%3), %%mm6\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
288 "movq 56(%3), %%mm7\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
289 "packuswb %%mm1, %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
290 "packuswb %%mm3, %%mm2\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
291 "packuswb %%mm5, %%mm4\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
292 "packuswb %%mm7, %%mm6\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
293 "movq %%mm0, (%0)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
294 "movq %%mm2, (%0, %1)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
295 "movq %%mm4, (%0, %1, 2)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
296 "movq %%mm6, (%0, %2)\n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
297 ::"r" (pix), "r" ((long)line_size), "r" ((long)line_size*3), "r"(p)
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
298 :"memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
299 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
300
1985
b2bc62fdecc0 move the 0x80 vector outside of the function, thus saving the compiler
melanson
parents: 1984
diff changeset
301 static unsigned char __align8 vector128[8] =
b2bc62fdecc0 move the 0x80 vector outside of the function, thus saving the compiler
melanson
parents: 1984
diff changeset
302 { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
b2bc62fdecc0 move the 0x80 vector outside of the function, thus saving the compiler
melanson
parents: 1984
diff changeset
303
1984
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
304 void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
305 {
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
306 int i;
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
307
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
308 movq_m2r(*vector128, mm1);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
309 for (i = 0; i < 8; i++) {
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
310 movq_m2r(*(block), mm0);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
311 packsswb_m2r(*(block + 4), mm0);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
312 block += 8;
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
313 paddb_r2r(mm1, mm0);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
314 movq_r2m(mm0, *pixels);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
315 pixels += line_size;
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
316 }
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
317 }
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
318
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
319 void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
320 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
321 const DCTELEM *p;
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
322 uint8_t *pix;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
323 int i;
986e461dc072 Initial revision
glantau
parents:
diff changeset
324
986e461dc072 Initial revision
glantau
parents:
diff changeset
325 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
326 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
327 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
328 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
329 i = 4;
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
330 do {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
331 __asm __volatile(
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
332 "movq (%2), %%mm0\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
333 "movq 8(%2), %%mm1\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
334 "movq 16(%2), %%mm2\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
335 "movq 24(%2), %%mm3\n\t"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
336 "movq %0, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
337 "movq %1, %%mm6\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
338 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
339 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
340 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
341 "paddsw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
342 "paddsw %%mm5, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
343 "movq %%mm6, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
344 "punpcklbw %%mm7, %%mm6\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
345 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
346 "paddsw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
347 "paddsw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
348 "packuswb %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
349 "packuswb %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
350 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
351 "movq %%mm2, %1\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
352 :"+m"(*pix), "+m"(*(pix+line_size))
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
353 :"r"(p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
354 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
355 pix += line_size*2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
356 p += 16;
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
357 } while (--i);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
358 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
359
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
360 static void put_pixels4_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
361 {
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
362 __asm __volatile(
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
363 "lea (%3, %3), %%"REG_a" \n\t"
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
364 ".balign 8 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
365 "1: \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
366 "movd (%1), %%mm0 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
367 "movd (%1, %3), %%mm1 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
368 "movd %%mm0, (%2) \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
369 "movd %%mm1, (%2, %3) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
370 "add %%"REG_a", %1 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
371 "add %%"REG_a", %2 \n\t"
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
372 "movd (%1), %%mm0 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
373 "movd (%1, %3), %%mm1 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
374 "movd %%mm0, (%2) \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
375 "movd %%mm1, (%2, %3) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
376 "add %%"REG_a", %1 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
377 "add %%"REG_a", %2 \n\t"
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
378 "subl $4, %0 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
379 "jnz 1b \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
380 : "+g"(h), "+r" (pixels), "+r" (block)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
381 : "r"((long)line_size)
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
382 : "%"REG_a, "memory"
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
383 );
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
384 }
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
385
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
386 static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
387 {
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
388 __asm __volatile(
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
389 "lea (%3, %3), %%"REG_a" \n\t"
422
aa4a1c6209bd * baling 8 seems to have the same speed
kabi
parents: 421
diff changeset
390 ".balign 8 \n\t"
420
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
391 "1: \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
392 "movq (%1), %%mm0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
393 "movq (%1, %3), %%mm1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
394 "movq %%mm0, (%2) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
395 "movq %%mm1, (%2, %3) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
396 "add %%"REG_a", %1 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
397 "add %%"REG_a", %2 \n\t"
420
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
398 "movq (%1), %%mm0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
399 "movq (%1, %3), %%mm1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
400 "movq %%mm0, (%2) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
401 "movq %%mm1, (%2, %3) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
402 "add %%"REG_a", %1 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
403 "add %%"REG_a", %2 \n\t"
420
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
404 "subl $4, %0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
405 "jnz 1b \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
406 : "+g"(h), "+r" (pixels), "+r" (block)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
407 : "r"((long)line_size)
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
408 : "%"REG_a, "memory"
420
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
409 );
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
410 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
411
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
412 static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
413 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
414 __asm __volatile(
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
415 "lea (%3, %3), %%"REG_a" \n\t"
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
416 ".balign 8 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
417 "1: \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
418 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
419 "movq 8(%1), %%mm4 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
420 "movq (%1, %3), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
421 "movq 8(%1, %3), %%mm5 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
422 "movq %%mm0, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
423 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
424 "movq %%mm1, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
425 "movq %%mm5, 8(%2, %3) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
426 "add %%"REG_a", %1 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
427 "add %%"REG_a", %2 \n\t"
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
428 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
429 "movq 8(%1), %%mm4 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
430 "movq (%1, %3), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
431 "movq 8(%1, %3), %%mm5 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
432 "movq %%mm0, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
433 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
434 "movq %%mm1, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
435 "movq %%mm5, 8(%2, %3) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
436 "add %%"REG_a", %1 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
437 "add %%"REG_a", %2 \n\t"
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
438 "subl $4, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
439 "jnz 1b \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
440 : "+g"(h), "+r" (pixels), "+r" (block)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
441 : "r"((long)line_size)
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
442 : "%"REG_a, "memory"
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
443 );
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
444 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
445
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
446 static void clear_blocks_mmx(DCTELEM *blocks)
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
447 {
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
448 __asm __volatile(
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
449 "pxor %%mm7, %%mm7 \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
450 "mov $-128*6, %%"REG_a" \n\t"
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
451 "1: \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
452 "movq %%mm7, (%0, %%"REG_a") \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
453 "movq %%mm7, 8(%0, %%"REG_a") \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
454 "movq %%mm7, 16(%0, %%"REG_a") \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
455 "movq %%mm7, 24(%0, %%"REG_a") \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
456 "add $32, %%"REG_a" \n\t"
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
457 " js 1b \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
458 : : "r" (((uint8_t *)blocks)+128*6)
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
459 : "%"REG_a
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
460 );
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
461 }
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
462
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
463 #ifdef CONFIG_ENCODERS
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
464 static int pix_sum16_mmx(uint8_t * pix, int line_size){
688
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
465 const int h=16;
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
466 int sum;
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
467 long index= -line_size*h;
688
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
468
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
469 __asm __volatile(
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
470 "pxor %%mm7, %%mm7 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
471 "pxor %%mm6, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
472 "1: \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
473 "movq (%2, %1), %%mm0 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
474 "movq (%2, %1), %%mm1 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
475 "movq 8(%2, %1), %%mm2 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
476 "movq 8(%2, %1), %%mm3 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
477 "punpcklbw %%mm7, %%mm0 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
478 "punpckhbw %%mm7, %%mm1 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
479 "punpcklbw %%mm7, %%mm2 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
480 "punpckhbw %%mm7, %%mm3 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
481 "paddw %%mm0, %%mm1 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
482 "paddw %%mm2, %%mm3 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
483 "paddw %%mm1, %%mm3 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
484 "paddw %%mm3, %%mm6 \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
485 "add %3, %1 \n\t"
688
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
486 " js 1b \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
487 "movq %%mm6, %%mm5 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
488 "psrlq $32, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
489 "paddw %%mm5, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
490 "movq %%mm6, %%mm5 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
491 "psrlq $16, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
492 "paddw %%mm5, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
493 "movd %%mm6, %0 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
494 "andl $0xFFFF, %0 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
495 : "=&r" (sum), "+r" (index)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
496 : "r" (pix - index), "r" ((long)line_size)
688
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
497 );
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
498
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
499 return sum;
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
500 }
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
501 #endif //CONFIG_ENCODERS
688
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
502
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
503 static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
504 long i=0;
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
505 asm volatile(
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
506 "1: \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
507 "movq (%1, %0), %%mm0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
508 "movq (%2, %0), %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
509 "paddb %%mm0, %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
510 "movq %%mm1, (%2, %0) \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
511 "movq 8(%1, %0), %%mm0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
512 "movq 8(%2, %0), %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
513 "paddb %%mm0, %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
514 "movq %%mm1, 8(%2, %0) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
515 "add $16, %0 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
516 "cmp %3, %0 \n\t"
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
517 " jb 1b \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
518 : "+r" (i)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
519 : "r"(src), "r"(dst), "r"((long)w-15)
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
520 );
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
521 for(; i<w; i++)
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
522 dst[i+0] += src[i+0];
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
523 }
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
524
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
525 #define H263_LOOP_FILTER \
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
526 "pxor %%mm7, %%mm7 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
527 "movq %0, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
528 "movq %0, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
529 "movq %3, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
530 "movq %3, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
531 "punpcklbw %%mm7, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
532 "punpckhbw %%mm7, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
533 "punpcklbw %%mm7, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
534 "punpckhbw %%mm7, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
535 "psubw %%mm2, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
536 "psubw %%mm3, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
537 "movq %1, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
538 "movq %1, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
539 "movq %2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
540 "movq %2, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
541 "punpcklbw %%mm7, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
542 "punpckhbw %%mm7, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
543 "punpcklbw %%mm7, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
544 "punpckhbw %%mm7, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
545 "psubw %%mm2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
546 "psubw %%mm3, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
547 "psllw $2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
548 "psllw $2, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
549 "paddw %%mm0, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
550 "paddw %%mm1, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
551 "pxor %%mm6, %%mm6 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
552 "pcmpgtw %%mm4, %%mm6 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
553 "pcmpgtw %%mm5, %%mm7 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
554 "pxor %%mm6, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
555 "pxor %%mm7, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
556 "psubw %%mm6, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
557 "psubw %%mm7, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
558 "psrlw $3, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
559 "psrlw $3, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
560 "packuswb %%mm5, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
561 "packsswb %%mm7, %%mm6 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
562 "pxor %%mm7, %%mm7 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
563 "movd %4, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
564 "punpcklbw %%mm2, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
565 "punpcklbw %%mm2, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
566 "punpcklbw %%mm2, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
567 "psubusb %%mm4, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
568 "movq %%mm2, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
569 "psubusb %%mm4, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
570 "psubb %%mm3, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
571 "movq %1, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
572 "movq %2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
573 "pxor %%mm6, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
574 "pxor %%mm6, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
575 "paddusb %%mm2, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
576 "psubusb %%mm2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
577 "pxor %%mm6, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
578 "pxor %%mm6, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
579 "paddusb %%mm2, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
580 "packsswb %%mm1, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
581 "pcmpgtb %%mm0, %%mm7 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
582 "pxor %%mm7, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
583 "psubb %%mm7, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
584 "movq %%mm0, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
585 "psubusb %%mm2, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
586 "psubb %%mm0, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
587 "pand %5, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
588 "psrlw $2, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
589 "pxor %%mm7, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
590 "psubb %%mm7, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
591 "movq %0, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
592 "movq %3, %%mm6 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
593 "psubb %%mm1, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
594 "paddb %%mm1, %%mm6 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
595
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
596 static void h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale){
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
597 const int strength= ff_h263_loop_filter_strength[qscale];
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
598
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
599 asm volatile(
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
600
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
601 H263_LOOP_FILTER
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
602
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
603 "movq %%mm3, %1 \n\t"
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
604 "movq %%mm4, %2 \n\t"
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
605 "movq %%mm5, %0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
606 "movq %%mm6, %3 \n\t"
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
607 : "+m" (*(uint64_t*)(src - 2*stride)),
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
608 "+m" (*(uint64_t*)(src - 1*stride)),
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
609 "+m" (*(uint64_t*)(src + 0*stride)),
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
610 "+m" (*(uint64_t*)(src + 1*stride))
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
611 : "g" (2*strength), "m"(ff_pb_FC)
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
612 );
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
613 }
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
614
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
615 static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
616 asm volatile( //FIXME could save 1 instruction if done as 8x4 ...
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
617 "movd %4, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
618 "movd %5, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
619 "movd %6, %%mm2 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
620 "movd %7, %%mm3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
621 "punpcklbw %%mm1, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
622 "punpcklbw %%mm3, %%mm2 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
623 "movq %%mm0, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
624 "punpcklwd %%mm2, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
625 "punpckhwd %%mm2, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
626 "movd %%mm0, %0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
627 "punpckhdq %%mm0, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
628 "movd %%mm0, %1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
629 "movd %%mm1, %2 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
630 "punpckhdq %%mm1, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
631 "movd %%mm1, %3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
632
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
633 : "=m" (*(uint32_t*)(dst + 0*dst_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
634 "=m" (*(uint32_t*)(dst + 1*dst_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
635 "=m" (*(uint32_t*)(dst + 2*dst_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
636 "=m" (*(uint32_t*)(dst + 3*dst_stride))
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
637 : "m" (*(uint32_t*)(src + 0*src_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
638 "m" (*(uint32_t*)(src + 1*src_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
639 "m" (*(uint32_t*)(src + 2*src_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
640 "m" (*(uint32_t*)(src + 3*src_stride))
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
641 );
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
642 }
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
643
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
644 static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
645 const int strength= ff_h263_loop_filter_strength[qscale];
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
646 uint64_t temp[4] __attribute__ ((aligned(8)));
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
647 uint8_t *btemp= (uint8_t*)temp;
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
649 src -= 2;
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
650
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
651 transpose4x4(btemp , src , 8, stride);
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
652 transpose4x4(btemp+4, src + 4*stride, 8, stride);
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
653 asm volatile(
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
654 H263_LOOP_FILTER // 5 3 4 6
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
655
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
656 : "+m" (temp[0]),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
657 "+m" (temp[1]),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
658 "+m" (temp[2]),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
659 "+m" (temp[3])
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
660 : "g" (2*strength), "m"(ff_pb_FC)
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
661 );
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
662
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
663 asm volatile(
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
664 "movq %%mm5, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
665 "movq %%mm4, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
666 "punpcklbw %%mm3, %%mm5 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
667 "punpcklbw %%mm6, %%mm4 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
668 "punpckhbw %%mm3, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
669 "punpckhbw %%mm6, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
670 "movq %%mm5, %%mm3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
671 "movq %%mm1, %%mm6 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
672 "punpcklwd %%mm4, %%mm5 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
673 "punpcklwd %%mm0, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
674 "punpckhwd %%mm4, %%mm3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
675 "punpckhwd %%mm0, %%mm6 \n\t"
2505
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
676 "movd %%mm5, (%0) \n\t"
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
677 "punpckhdq %%mm5, %%mm5 \n\t"
2505
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
678 "movd %%mm5, (%0,%2) \n\t"
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
679 "movd %%mm3, (%0,%2,2) \n\t"
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
680 "punpckhdq %%mm3, %%mm3 \n\t"
2505
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
681 "movd %%mm3, (%0,%3) \n\t"
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
682 "movd %%mm1, (%1) \n\t"
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
683 "punpckhdq %%mm1, %%mm1 \n\t"
2505
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
684 "movd %%mm1, (%1,%2) \n\t"
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
685 "movd %%mm6, (%1,%2,2) \n\t"
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
686 "punpckhdq %%mm6, %%mm6 \n\t"
2505
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
687 "movd %%mm6, (%1,%3) \n\t"
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
688 :: "r" (src),
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
689 "r" (src + 4*stride),
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
690 "r" ((long) stride ),
86e2b1424801 optimization and gcc 4.0 bug workaround patch by (Martin Drab >drab kepler.fjfi.cvut cz<)
michael
parents: 2293
diff changeset
691 "r" ((long)(3*stride))
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
692 );
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
693 }
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
694
2633
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
695 // dst = ABS( a - b )
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
696 #define MMABS_DIFF_MMX2(a,b,dst,z)\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
697 "movq " #b ", " #dst " \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
698 "movq " #a ", " #z " \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
699 "psubusw " #b ", " #z " \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
700 "psubusw " #a ", " #dst " \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
701 "pmaxsw " #z ", " #dst " \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
702
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
703 // a = clip( a, -tc, tc )
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
704 #define CLIP_MMX2(a,tc,z)\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
705 "pxor " #z ", " #z " \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
706 "psubw " #tc ", " #z " \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
707 "pmaxsw " #z ", " #a " \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
708 "pminsw " #tc ", " #a " \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
709
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
710 // in: mm0=p1, mm1=p0, mm2=q0, mm3=q1
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
711 // out: mm7 = do we filter this pixel?
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
712 #define H264_DEBLOCK_THRESH(alpha,beta)\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
713 "pxor %%mm7, %%mm7 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
714 "punpcklbw %%mm7, %%mm0 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
715 "punpcklbw %%mm7, %%mm1 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
716 "punpcklbw %%mm7, %%mm2 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
717 "punpcklbw %%mm7, %%mm3 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
718 MMABS_DIFF_MMX2(%%mm1, %%mm2, %%mm5, %%mm4)\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
719 "movd " #alpha ", %%mm6 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
720 "pshufw $0, %%mm6, %%mm6 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
721 "pcmpgtw %%mm5, %%mm6 \n\t" /* ABS(p0-q0) < alpha */\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
722 MMABS_DIFF_MMX2(%%mm0, %%mm1, %%mm5, %%mm4)\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
723 MMABS_DIFF_MMX2(%%mm3, %%mm2, %%mm7, %%mm4)\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
724 "pmaxsw %%mm7, %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
725 "movd " #beta ", %%mm7 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
726 "pshufw $0, %%mm7, %%mm7 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
727 "movq %%mm7, %%mm4 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
728 "pcmpgtw %%mm5, %%mm7 \n\t" /* ABS(p1-p0) < beta && ABS(q1-q0) < beta */\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
729 "pand %%mm6, %%mm7 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
730
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
731 // in: mm0=p1, mm1=p0, mm2=q0, mm3=q1, mm6=tc
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
732 // out: mm1=p0', mm2=q0'
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
733 #define H264_DEBLOCK_P0_Q0(pw4)\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
734 "movq " #pw4 ", %%mm4 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
735 "movq %%mm2, %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
736 "paddw %%mm4, %%mm0 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
737 "psubw %%mm1, %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
738 "psubw %%mm3, %%mm0 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
739 "psllw $2, %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
740 "paddw %%mm0, %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
741 "psraw $3, %%mm5 \n\t" /* mm5 = (((q0 - p0) << 2) + (p1 - q1) + 4) >> 3 */\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
742 CLIP_MMX2(%%mm5, %%mm6, %%mm4) /* delta = clip( mm5, -tc, tc ) */\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
743 "paddw %%mm5, %%mm1 \n\t" /* p0 += delta */\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
744 "psubw %%mm5, %%mm2 \n\t" /* q0 -= delta */
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
745
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
746 // in: mm1=p0, mm2=q0, mm6=tc0
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
747 // out: mm5=delta
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
748 #define H264_DEBLOCK_DELTA_PQ1(p1,p2,z)\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
749 "movq %%mm1, %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
750 "pavgb %%mm2, %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
751 "paddw " #p2 ", %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
752 "psraw $1, %%mm5 \n\t"\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
753 "psubw " #p1 ", %%mm5 \n\t" /* ( ( q2 + ((p0+q0+1)>>1) ) >> 1 ) - q1 */\
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
754 CLIP_MMX2(%%mm5, %%mm6, z)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
755
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
756 static inline void h264_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int tc0)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
757 {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
758 uint64_t tmp0, tmp1;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
759 asm volatile(
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
760 "movd (%2,%4), %%mm0 \n\t" //p1
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
761 "movd (%2,%4,2), %%mm1 \n\t" //p0
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
762 "movd (%3), %%mm2 \n\t" //q0
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
763 "movd (%3,%4), %%mm3 \n\t" //q1
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
764 H264_DEBLOCK_THRESH(%6,%7)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
765 "movq %%mm7, %0 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
766
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
767 // filter p1 if ABS(p2-p0) < beta
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
768 "movd (%2), %%mm3 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
769 "pxor %%mm6, %%mm6 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
770 "punpcklbw %%mm6, %%mm3 \n\t" //p2
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
771 MMABS_DIFF_MMX2(%%mm1, %%mm3, %%mm5, %%mm6)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
772 "pcmpgtw %%mm5, %%mm4 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
773 "pand %%mm7, %%mm4 \n\t" // mm4 = ( ABS( p2 - p0 ) < beta && filterp )
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
774 "movd %5, %%mm6 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
775 "pshufw $0, %%mm6, %%mm6 \n\t" //tc
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
776
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
777 H264_DEBLOCK_DELTA_PQ1(%%mm0, %%mm3, %%mm7) // delta = clip( ( p2 + ((p0+q0+1)>>1) ) >> 1 ) - p1 )
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
778 "pand %%mm4, %%mm5 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
779 "paddw %%mm0, %%mm5 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
780 "packuswb %%mm5, %%mm5 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
781 "movd %%mm5, (%2,%4) \n\t" // *p1 += delta
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
782 "psrlw $15, %%mm4 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
783 "paddw %%mm6, %%mm4 \n\t" // tc++
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
784 "movq %%mm4, %1 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
785
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
786 // filter q1 if ABS(q2-q0) < beta
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
787 "pxor %%mm7, %%mm7 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
788 "movd (%3,%4), %%mm3 \n\t" //q1
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
789 "movd (%3,%4,2), %%mm4 \n\t" //q2
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
790 "punpcklbw %%mm7, %%mm3 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
791 "punpcklbw %%mm7, %%mm4 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
792 MMABS_DIFF_MMX2(%%mm2, %%mm4, %%mm5, %%mm7)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
793 "movd %7, %%mm7 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
794 "pshufw $0, %%mm7, %%mm7 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
795 "pcmpgtw %%mm5, %%mm7 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
796
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
797 H264_DEBLOCK_DELTA_PQ1(%%mm3, %%mm4, %%mm4) // delta = clip( ( q2 + ((p0+q0+1)>>1) ) >> 1 ) - q1 )
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
798 "movq %0, %%mm4 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
799 "pand %%mm4, %%mm7 \n\t" // mm7 = ( ABS( q2 - q0 ) < beta && filterp )
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
800 "pand %%mm7, %%mm5 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
801 "paddw %%mm3, %%mm5 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
802 "packuswb %%mm5, %%mm5 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
803 "movd %%mm5, (%3,%4) \n\t" // *q1 += delta
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
804 "movq %1, %%mm6 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
805 "psrlw $15, %%mm7 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
806 "paddw %%mm7, %%mm6 \n\t" // tc++
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
807 "movq %0, %%mm4 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
808 "pand %%mm4, %%mm6 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
809
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
810 H264_DEBLOCK_P0_Q0(%8)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
811 "packuswb %%mm1, %%mm1 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
812 "packuswb %%mm2, %%mm2 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
813 "movd %%mm1, (%2,%4,2) \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
814 "movd %%mm2, (%3) \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
815
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
816 : "=m"(tmp0), "=m"(tmp1)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
817 : "r"(pix-3*stride), "r"(pix), "r"((long)stride),
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
818 "r"(tc0), "r"(alpha), "r"(beta), "m"(ff_pw_4)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
819 );
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
820 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
821
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
822 static void h264_v_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int *tc0)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
823 {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
824 int i;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
825 for(i=0; i<4; i++, pix+=4) {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
826 if(tc0[i] < 0)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
827 continue;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
828 h264_loop_filter_luma_mmx2(pix, stride, alpha, beta, tc0[i]);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
829 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
830 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
831
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
832 static void h264_h_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int *tc0)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
833 {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
834 uint8_t trans[4*8];
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
835 int i;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
836 for(i=0; i<4; i++, pix+=4*stride) {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
837 if(tc0[i] < 0)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
838 continue;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
839 //FIXME: could cut some load/stores by merging transpose with filter
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
840 transpose4x4(trans, pix-4, 4, stride);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
841 transpose4x4(trans+4*4, pix, 4, stride);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
842 h264_loop_filter_luma_mmx2(trans+4*4, 4, alpha, beta, tc0[i]);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
843 transpose4x4(pix-2, trans+2*4, stride, 4);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
844 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
845 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
846
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
847 static inline void h264_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int *tc0)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
848 {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
849 asm volatile(
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
850 "movd (%0), %%mm0 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
851 "movd (%0,%2), %%mm1 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
852 "movd (%1), %%mm2 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
853 "movd (%1,%2), %%mm3 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
854 H264_DEBLOCK_THRESH(%4,%5)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
855 "movd %3, %%mm6 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
856 "pshufw $0x50, %%mm6, %%mm6 \n\t" // mm6 = tc[1], tc[1], tc[0], tc[0]
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
857 "pand %%mm7, %%mm6 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
858 H264_DEBLOCK_P0_Q0(%6)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
859 "packuswb %%mm1, %%mm1 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
860 "packuswb %%mm2, %%mm2 \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
861 "movd %%mm1, (%0,%2) \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
862 "movd %%mm2, (%1) \n\t"
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
863 :: "r"(pix-2*stride), "r"(pix), "r"((long)stride),
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
864 "r"(tc0[1]<<16 | tc0[0]),
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
865 "r"(alpha), "r"(beta), "m"(ff_pw_4)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
866 );
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
867 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
868
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
869 static void h264_v_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int *tc0)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
870 {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
871 int i;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
872 for(i=0; i<2; i++) {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
873 h264_loop_filter_chroma_mmx2(pix, stride, alpha, beta, tc0);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
874 pix += 4;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
875 tc0 += 2;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
876 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
877 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
878
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
879 static void h264_h_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int *tc0)
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
880 {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
881 uint8_t trans[4*4];
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
882 int i;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
883 for(i=0; i<2; i++) {
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
884 //FIXME: could cut some load/stores by merging transpose with filter
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
885 transpose4x4(trans, pix-2, 4, stride);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
886 h264_loop_filter_chroma_mmx2(trans+2*4, 4, alpha, beta, tc0);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
887 transpose4x4(pix-2, trans, stride, 4);
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
888 pix += 4*stride;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
889 tc0 += 2;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
890 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
891 }
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
892
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
893 #ifdef CONFIG_ENCODERS
997
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
894 static int pix_norm1_mmx(uint8_t *pix, int line_size) {
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
895 int tmp;
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
896 asm volatile (
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
897 "movl $16,%%ecx\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
898 "pxor %%mm0,%%mm0\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
899 "pxor %%mm7,%%mm7\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
900 "1:\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
901 "movq (%0),%%mm2\n" /* mm2 = pix[0-7] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
902 "movq 8(%0),%%mm3\n" /* mm3 = pix[8-15] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
903
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
904 "movq %%mm2,%%mm1\n" /* mm1 = mm2 = pix[0-7] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
905
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
906 "punpckhbw %%mm0,%%mm1\n" /* mm1 = [pix4-7] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
907 "punpcklbw %%mm0,%%mm2\n" /* mm2 = [pix0-3] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
908
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
909 "movq %%mm3,%%mm4\n" /* mm4 = mm3 = pix[8-15] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
910 "punpckhbw %%mm0,%%mm3\n" /* mm3 = [pix12-15] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
911 "punpcklbw %%mm0,%%mm4\n" /* mm4 = [pix8-11] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
912
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
913 "pmaddwd %%mm1,%%mm1\n" /* mm1 = (pix0^2+pix1^2,pix2^2+pix3^2) */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
914 "pmaddwd %%mm2,%%mm2\n" /* mm2 = (pix4^2+pix5^2,pix6^2+pix7^2) */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
915
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
916 "pmaddwd %%mm3,%%mm3\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
917 "pmaddwd %%mm4,%%mm4\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
918
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
919 "paddd %%mm1,%%mm2\n" /* mm2 = (pix0^2+pix1^2+pix4^2+pix5^2,
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
920 pix2^2+pix3^2+pix6^2+pix7^2) */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
921 "paddd %%mm3,%%mm4\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
922 "paddd %%mm2,%%mm7\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
923
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
924 "add %2, %0\n"
997
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
925 "paddd %%mm4,%%mm7\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
926 "dec %%ecx\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
927 "jnz 1b\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
928
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
929 "movq %%mm7,%%mm1\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
930 "psrlq $32, %%mm7\n" /* shift hi dword to lo */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
931 "paddd %%mm7,%%mm1\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
932 "movd %%mm1,%1\n"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
933 : "+r" (pix), "=r"(tmp) : "r" ((long)line_size) : "%ecx" );
997
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
934 return tmp;
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
935 }
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
936
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
937 static int sse8_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
938 int tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
939 asm volatile (
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
940 "movl %4,%%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
941 "pxor %%mm0,%%mm0\n" /* mm0 = 0 */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
942 "pxor %%mm7,%%mm7\n" /* mm7 holds the sum */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
943 "1:\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
944 "movq (%0),%%mm1\n" /* mm1 = pix1[0-7] */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
945 "movq (%1),%%mm2\n" /* mm2 = pix2[0-7] */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
946
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
947 "movq %%mm1,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
948 "psubusb %%mm2,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
949 "psubusb %%mm5,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
950
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
951 "por %%mm1,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
952
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
953 "movq %%mm2,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
954
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
955 "punpckhbw %%mm0,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
956 "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
957
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
958 "pmaddwd %%mm2,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
959 "pmaddwd %%mm1,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
960
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
961 "add %3,%0\n"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
962 "add %3,%1\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
963
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
964 "paddd %%mm2,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
965 "paddd %%mm1,%%mm7\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
966
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
967 "decl %%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
968 "jnz 1b\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
969
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
970 "movq %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
971 "psrlq $32, %%mm7\n" /* shift hi dword to lo */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
972 "paddd %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
973 "movd %%mm1,%2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
974 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
975 : "r" ((long)line_size) , "m" (h)
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
976 : "%ecx");
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
977 return tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
978 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
979
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
980 static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
997
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
981 int tmp;
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
982 asm volatile (
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
983 "movl %4,%%ecx\n"
997
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
984 "pxor %%mm0,%%mm0\n" /* mm0 = 0 */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
985 "pxor %%mm7,%%mm7\n" /* mm7 holds the sum */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
986 "1:\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
987 "movq (%0),%%mm1\n" /* mm1 = pix1[0-7] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
988 "movq (%1),%%mm2\n" /* mm2 = pix2[0-7] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
989 "movq 8(%0),%%mm3\n" /* mm3 = pix1[8-15] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
990 "movq 8(%1),%%mm4\n" /* mm4 = pix2[8-15] */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
991
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
992 /* todo: mm1-mm2, mm3-mm4 */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
993 /* algo: substract mm1 from mm2 with saturation and vice versa */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
994 /* OR the results to get absolute difference */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
995 "movq %%mm1,%%mm5\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
996 "movq %%mm3,%%mm6\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
997 "psubusb %%mm2,%%mm1\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
998 "psubusb %%mm4,%%mm3\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
999 "psubusb %%mm5,%%mm2\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1000 "psubusb %%mm6,%%mm4\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1001
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1002 "por %%mm1,%%mm2\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1003 "por %%mm3,%%mm4\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1004
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1005 /* now convert to 16-bit vectors so we can square them */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1006 "movq %%mm2,%%mm1\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1007 "movq %%mm4,%%mm3\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1008
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1009 "punpckhbw %%mm0,%%mm2\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1010 "punpckhbw %%mm0,%%mm4\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1011 "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1012 "punpcklbw %%mm0,%%mm3\n" /* mm4 now spread over (mm3,mm4) */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1013
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1014 "pmaddwd %%mm2,%%mm2\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1015 "pmaddwd %%mm4,%%mm4\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1016 "pmaddwd %%mm1,%%mm1\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1017 "pmaddwd %%mm3,%%mm3\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1018
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1019 "add %3,%0\n"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1020 "add %3,%1\n"
997
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1021
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1022 "paddd %%mm2,%%mm1\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1023 "paddd %%mm4,%%mm3\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1024 "paddd %%mm1,%%mm7\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1025 "paddd %%mm3,%%mm7\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1026
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1027 "decl %%ecx\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1028 "jnz 1b\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1029
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1030 "movq %%mm7,%%mm1\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1031 "psrlq $32, %%mm7\n" /* shift hi dword to lo */
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1032 "paddd %%mm7,%%mm1\n"
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1033 "movd %%mm1,%2\n"
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1034 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1035 : "r" ((long)line_size) , "m" (h)
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1036 : "%ecx");
997
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1037 return tmp;
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1038 }
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
1039
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1040 static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) {
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1041 int tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1042 asm volatile (
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1043 "movl %3,%%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1044 "pxor %%mm7,%%mm7\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1045 "pxor %%mm6,%%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1046
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1047 "movq (%0),%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1048 "movq %%mm0, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1049 "psllq $8, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1050 "psrlq $8, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1051 "psrlq $8, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1052 "movq %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1053 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1054 "punpcklbw %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1055 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1056 "punpckhbw %%mm7,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1057 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1058 "psubw %%mm1, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1059 "psubw %%mm3, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1060
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1061 "add %2,%0\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1062
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1063 "movq (%0),%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1064 "movq %%mm4, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1065 "psllq $8, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1066 "psrlq $8, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1067 "psrlq $8, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1068 "movq %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1069 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1070 "punpcklbw %%mm7,%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1071 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1072 "punpckhbw %%mm7,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1073 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1074 "psubw %%mm1, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1075 "psubw %%mm3, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1076 "psubw %%mm4, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1077 "psubw %%mm5, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1078 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1079 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1080 "pcmpgtw %%mm0, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1081 "pcmpgtw %%mm2, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1082 "pxor %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1083 "pxor %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1084 "psubw %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1085 "psubw %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1086 "paddw %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1087 "paddw %%mm2, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1088
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1089 "add %2,%0\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1090 "1:\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1091
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1092 "movq (%0),%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1093 "movq %%mm0, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1094 "psllq $8, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1095 "psrlq $8, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1096 "psrlq $8, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1097 "movq %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1098 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1099 "punpcklbw %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1100 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1101 "punpckhbw %%mm7,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1102 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1103 "psubw %%mm1, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1104 "psubw %%mm3, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1105 "psubw %%mm0, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1106 "psubw %%mm2, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1107 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1108 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1109 "pcmpgtw %%mm4, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1110 "pcmpgtw %%mm5, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1111 "pxor %%mm3, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1112 "pxor %%mm1, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1113 "psubw %%mm3, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1114 "psubw %%mm1, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1115 "paddw %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1116 "paddw %%mm5, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1117
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1118 "add %2,%0\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1119
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1120 "movq (%0),%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1121 "movq %%mm4, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1122 "psllq $8, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1123 "psrlq $8, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1124 "psrlq $8, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1125 "movq %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1126 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1127 "punpcklbw %%mm7,%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1128 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1129 "punpckhbw %%mm7,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1130 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1131 "psubw %%mm1, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1132 "psubw %%mm3, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1133 "psubw %%mm4, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1134 "psubw %%mm5, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1135 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1136 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1137 "pcmpgtw %%mm0, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1138 "pcmpgtw %%mm2, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1139 "pxor %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1140 "pxor %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1141 "psubw %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1142 "psubw %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1143 "paddw %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1144 "paddw %%mm2, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1145
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1146 "add %2,%0\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1147 "subl $2, %%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1148 " jnz 1b\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1149
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1150 "movq %%mm6, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1151 "punpcklwd %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1152 "punpckhwd %%mm7,%%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1153 "paddd %%mm0, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1154
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1155 "movq %%mm6,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1156 "psrlq $32, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1157 "paddd %%mm6,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1158 "movd %%mm0,%1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1159 : "+r" (pix1), "=r"(tmp)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1160 : "r" ((long)line_size) , "g" (h-2)
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1161 : "%ecx");
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1162 return tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1163 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1164
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1165 static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) {
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1166 int tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1167 uint8_t * pix= pix1;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1168 asm volatile (
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1169 "movl %3,%%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1170 "pxor %%mm7,%%mm7\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1171 "pxor %%mm6,%%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1172
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1173 "movq (%0),%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1174 "movq 1(%0),%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1175 "movq %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1176 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1177 "punpcklbw %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1178 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1179 "punpckhbw %%mm7,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1180 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1181 "psubw %%mm1, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1182 "psubw %%mm3, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1183
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1184 "add %2,%0\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1185
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1186 "movq (%0),%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1187 "movq 1(%0),%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1188 "movq %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1189 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1190 "punpcklbw %%mm7,%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1191 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1192 "punpckhbw %%mm7,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1193 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1194 "psubw %%mm1, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1195 "psubw %%mm3, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1196 "psubw %%mm4, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1197 "psubw %%mm5, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1198 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1199 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1200 "pcmpgtw %%mm0, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1201 "pcmpgtw %%mm2, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1202 "pxor %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1203 "pxor %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1204 "psubw %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1205 "psubw %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1206 "paddw %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1207 "paddw %%mm2, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1208
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1209 "add %2,%0\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1210 "1:\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1211
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1212 "movq (%0),%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1213 "movq 1(%0),%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1214 "movq %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1215 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1216 "punpcklbw %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1217 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1218 "punpckhbw %%mm7,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1219 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1220 "psubw %%mm1, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1221 "psubw %%mm3, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1222 "psubw %%mm0, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1223 "psubw %%mm2, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1224 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1225 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1226 "pcmpgtw %%mm4, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1227 "pcmpgtw %%mm5, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1228 "pxor %%mm3, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1229 "pxor %%mm1, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1230 "psubw %%mm3, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1231 "psubw %%mm1, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1232 "paddw %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1233 "paddw %%mm5, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1234
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1235 "add %2,%0\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1236
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1237 "movq (%0),%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1238 "movq 1(%0),%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1239 "movq %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1240 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1241 "punpcklbw %%mm7,%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1242 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1243 "punpckhbw %%mm7,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1244 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1245 "psubw %%mm1, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1246 "psubw %%mm3, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1247 "psubw %%mm4, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1248 "psubw %%mm5, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1249 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1250 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1251 "pcmpgtw %%mm0, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1252 "pcmpgtw %%mm2, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1253 "pxor %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1254 "pxor %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1255 "psubw %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1256 "psubw %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1257 "paddw %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1258 "paddw %%mm2, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1259
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1260 "add %2,%0\n"
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1261 "subl $2, %%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1262 " jnz 1b\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1263
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1264 "movq %%mm6, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1265 "punpcklwd %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1266 "punpckhwd %%mm7,%%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1267 "paddd %%mm0, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1268
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1269 "movq %%mm6,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1270 "psrlq $32, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1271 "paddd %%mm6,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1272 "movd %%mm0,%1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1273 : "+r" (pix1), "=r"(tmp)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1274 : "r" ((long)line_size) , "g" (h-2)
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1275 : "%ecx");
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1276 return tmp + hf_noise8_mmx(pix+8, line_size, h);
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1277 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1278
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1279 static int nsse16_mmx(MpegEncContext *c, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1280 int score1= sse16_mmx(c, pix1, pix2, line_size, h);
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1281 int score2= hf_noise16_mmx(pix1, line_size, h) - hf_noise16_mmx(pix2, line_size, h);
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1282
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1283 if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1284 else return score1 + ABS(score2)*8;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1285 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1286
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1287 static int nsse8_mmx(MpegEncContext *c, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1288 int score1= sse8_mmx(c, pix1, pix2, line_size, h);
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1289 int score2= hf_noise8_mmx(pix1, line_size, h) - hf_noise8_mmx(pix2, line_size, h);
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1290
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1291 if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1292 else return score1 + ABS(score2)*8;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1293 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1294
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1295 static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) {
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1296 int tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1297
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1298 assert( (((int)pix) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1299 assert((line_size &7) ==0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1300
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1301 #define SUM(in0, in1, out0, out1) \
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1302 "movq (%0), %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1303 "movq 8(%0), %%mm3\n"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1304 "add %2,%0\n"\
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1305 "movq %%mm2, " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1306 "movq %%mm3, " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1307 "psubusb " #in0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1308 "psubusb " #in1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1309 "psubusb " #out0 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1310 "psubusb " #out1 ", " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1311 "por %%mm2, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1312 "por %%mm3, " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1313 "movq " #in0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1314 "movq " #in1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1315 "punpcklbw %%mm7, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1316 "punpcklbw %%mm7, " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1317 "punpckhbw %%mm7, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1318 "punpckhbw %%mm7, %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1319 "paddw " #in1 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1320 "paddw %%mm3, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1321 "paddw %%mm2, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1322 "paddw " #in0 ", %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1323
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1324
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1325 asm volatile (
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1326 "movl %3,%%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1327 "pxor %%mm6,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1328 "pxor %%mm7,%%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1329 "movq (%0),%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1330 "movq 8(%0),%%mm1\n"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1331 "add %2,%0\n"
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1332 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1333 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1334 "1:\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1335
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1336 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1337
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1338 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1339
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1340 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1341 "jnz 1b\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1342
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1343 "movq %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1344 "psrlq $32, %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1345 "paddw %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1346 "movq %%mm0,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1347 "psrlq $16, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1348 "paddw %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1349 "movd %%mm0,%1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1350 : "+r" (pix), "=r"(tmp)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1351 : "r" ((long)line_size) , "m" (h)
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1352 : "%ecx");
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1353 return tmp & 0xFFFF;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1354 }
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1355 #undef SUM
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1356
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1357 static int vsad_intra16_mmx2(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) {
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1358 int tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1359
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1360 assert( (((int)pix) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1361 assert((line_size &7) ==0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1362
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1363 #define SUM(in0, in1, out0, out1) \
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1364 "movq (%0), " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1365 "movq 8(%0), " #out1 "\n"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1366 "add %2,%0\n"\
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1367 "psadbw " #out0 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1368 "psadbw " #out1 ", " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1369 "paddw " #in1 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1370 "paddw " #in0 ", %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1371
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1372 asm volatile (
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1373 "movl %3,%%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1374 "pxor %%mm6,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1375 "pxor %%mm7,%%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1376 "movq (%0),%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1377 "movq 8(%0),%%mm1\n"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1378 "add %2,%0\n"
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1379 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1380 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1381 "1:\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1382
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1383 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1384
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1385 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1386
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1387 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1388 "jnz 1b\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1389
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1390 "movd %%mm6,%1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1391 : "+r" (pix), "=r"(tmp)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1392 : "r" ((long)line_size) , "m" (h)
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1393 : "%ecx");
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1394 return tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1395 }
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1396 #undef SUM
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1397
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1398 static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1399 int tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1400
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1401 assert( (((int)pix1) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1402 assert( (((int)pix2) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1403 assert((line_size &7) ==0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1404
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1405 #define SUM(in0, in1, out0, out1) \
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1406 "movq (%0),%%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1407 "movq (%1)," #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1408 "movq 8(%0),%%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1409 "movq 8(%1)," #out1 "\n"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1410 "add %3,%0\n"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1411 "add %3,%1\n"\
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1412 "psubb " #out0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1413 "psubb " #out1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1414 "pxor %%mm7, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1415 "pxor %%mm7, %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1416 "movq %%mm2, " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1417 "movq %%mm3, " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1418 "psubusb " #in0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1419 "psubusb " #in1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1420 "psubusb " #out0 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1421 "psubusb " #out1 ", " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1422 "por %%mm2, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1423 "por %%mm3, " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1424 "movq " #in0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1425 "movq " #in1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1426 "punpcklbw %%mm7, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1427 "punpcklbw %%mm7, " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1428 "punpckhbw %%mm7, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1429 "punpckhbw %%mm7, %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1430 "paddw " #in1 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1431 "paddw %%mm3, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1432 "paddw %%mm2, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1433 "paddw " #in0 ", %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1434
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1435
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1436 asm volatile (
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1437 "movl %4,%%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1438 "pxor %%mm6,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1439 "pcmpeqw %%mm7,%%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1440 "psllw $15, %%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1441 "packsswb %%mm7, %%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1442 "movq (%0),%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1443 "movq (%1),%%mm2\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1444 "movq 8(%0),%%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1445 "movq 8(%1),%%mm3\n"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1446 "add %3,%0\n"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1447 "add %3,%1\n"
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1448 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1449 "psubb %%mm2, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1450 "psubb %%mm3, %%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1451 "pxor %%mm7, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1452 "pxor %%mm7, %%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1453 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1454 "1:\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1455
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1456 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1457
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1458 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1459
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1460 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1461 "jnz 1b\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1462
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1463 "movq %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1464 "psrlq $32, %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1465 "paddw %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1466 "movq %%mm0,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1467 "psrlq $16, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1468 "paddw %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1469 "movd %%mm0,%2\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1470 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1471 : "r" ((long)line_size) , "m" (h)
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1472 : "%ecx");
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1473 return tmp & 0x7FFF;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1474 }
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1475 #undef SUM
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1476
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1477 static int vsad16_mmx2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1478 int tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1479
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1480 assert( (((int)pix1) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1481 assert( (((int)pix2) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1482 assert((line_size &7) ==0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1483
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1484 #define SUM(in0, in1, out0, out1) \
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1485 "movq (%0)," #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1486 "movq (%1),%%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1487 "movq 8(%0)," #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1488 "movq 8(%1),%%mm3\n"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1489 "add %3,%0\n"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1490 "add %3,%1\n"\
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1491 "psubb %%mm2, " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1492 "psubb %%mm3, " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1493 "pxor %%mm7, " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1494 "pxor %%mm7, " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1495 "psadbw " #out0 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1496 "psadbw " #out1 ", " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1497 "paddw " #in1 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1498 "paddw " #in0 ", %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1499
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1500 asm volatile (
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1501 "movl %4,%%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1502 "pxor %%mm6,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1503 "pcmpeqw %%mm7,%%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1504 "psllw $15, %%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1505 "packsswb %%mm7, %%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1506 "movq (%0),%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1507 "movq (%1),%%mm2\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1508 "movq 8(%0),%%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1509 "movq 8(%1),%%mm3\n"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1510 "add %3,%0\n"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1511 "add %3,%1\n"
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1512 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1513 "psubb %%mm2, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1514 "psubb %%mm3, %%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1515 "pxor %%mm7, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1516 "pxor %%mm7, %%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1517 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1518 "1:\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1519
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1520 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1521
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1522 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1523
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1524 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1525 "jnz 1b\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1526
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1527 "movd %%mm6,%2\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1528 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1529 : "r" ((long)line_size) , "m" (h)
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1530 : "%ecx");
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1531 return tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1532 }
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1533 #undef SUM
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1534
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1535 static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1536 long i=0;
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1537 asm volatile(
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1538 "1: \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1539 "movq (%2, %0), %%mm0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1540 "movq (%1, %0), %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1541 "psubb %%mm0, %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1542 "movq %%mm1, (%3, %0) \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1543 "movq 8(%2, %0), %%mm0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1544 "movq 8(%1, %0), %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1545 "psubb %%mm0, %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1546 "movq %%mm1, 8(%3, %0) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1547 "add $16, %0 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1548 "cmp %4, %0 \n\t"
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1549 " jb 1b \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1550 : "+r" (i)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1551 : "r"(src1), "r"(src2), "r"(dst), "r"((long)w-15)
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1552 );
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1553 for(; i<w; i++)
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1554 dst[i+0] = src1[i+0]-src2[i+0];
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1555 }
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1556
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1557 static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1558 long i=0;
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1559 uint8_t l, lt;
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
1560
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1561 asm volatile(
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1562 "1: \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1563 "movq -1(%1, %0), %%mm0 \n\t" // LT
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1564 "movq (%1, %0), %%mm1 \n\t" // T
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1565 "movq -1(%2, %0), %%mm2 \n\t" // L
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1566 "movq (%2, %0), %%mm3 \n\t" // X
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1567 "movq %%mm2, %%mm4 \n\t" // L
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1568 "psubb %%mm0, %%mm2 \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1569 "paddb %%mm1, %%mm2 \n\t" // L + T - LT
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1570 "movq %%mm4, %%mm5 \n\t" // L
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1571 "pmaxub %%mm1, %%mm4 \n\t" // max(T, L)
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1572 "pminub %%mm5, %%mm1 \n\t" // min(T, L)
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1573 "pminub %%mm2, %%mm4 \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1574 "pmaxub %%mm1, %%mm4 \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1575 "psubb %%mm4, %%mm3 \n\t" // dst - pred
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1576 "movq %%mm3, (%3, %0) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1577 "add $8, %0 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1578 "cmp %4, %0 \n\t"
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1579 " jb 1b \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1580 : "+r" (i)
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1581 : "r"(src1), "r"(src2), "r"(dst), "r"((long)w)
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1582 );
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1583
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1584 l= *left;
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1585 lt= *left_top;
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1586
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1587 dst[0]= src2[0] - mid_pred(l, src1[0], (l + src1[0] - lt)&0xFF);
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1588
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1589 *left_top= src1[w-1];
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1590 *left = src2[w-1];
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1591 }
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1592
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1593 #define LBUTTERFLY2(a1,b1,a2,b2)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1594 "paddw " #b1 ", " #a1 " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1595 "paddw " #b2 ", " #a2 " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1596 "paddw " #b1 ", " #b1 " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1597 "paddw " #b2 ", " #b2 " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1598 "psubw " #a1 ", " #b1 " \n\t"\
1186
4f0072371bb9 10l (hadamard fix)
michaelni
parents: 1153
diff changeset
1599 "psubw " #a2 ", " #b2 " \n\t"
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1600
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1601 #define HADAMARD48\
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1602 LBUTTERFLY2(%%mm0, %%mm1, %%mm2, %%mm3)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1603 LBUTTERFLY2(%%mm4, %%mm5, %%mm6, %%mm7)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1604 LBUTTERFLY2(%%mm0, %%mm2, %%mm1, %%mm3)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1605 LBUTTERFLY2(%%mm4, %%mm6, %%mm5, %%mm7)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1606 LBUTTERFLY2(%%mm0, %%mm4, %%mm1, %%mm5)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1607 LBUTTERFLY2(%%mm2, %%mm6, %%mm3, %%mm7)\
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1608
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1609 #define MMABS(a,z)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1610 "pxor " #z ", " #z " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1611 "pcmpgtw " #a ", " #z " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1612 "pxor " #z ", " #a " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1613 "psubw " #z ", " #a " \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1614
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1615 #define MMABS_SUM(a,z, sum)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1616 "pxor " #z ", " #z " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1617 "pcmpgtw " #a ", " #z " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1618 "pxor " #z ", " #a " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1619 "psubw " #z ", " #a " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1620 "paddusw " #a ", " #sum " \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1621
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1622 #define MMABS_MMX2(a,z)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1623 "pxor " #z ", " #z " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1624 "psubw " #a ", " #z " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1625 "pmaxsw " #z ", " #a " \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1626
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1627 #define MMABS_SUM_MMX2(a,z, sum)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1628 "pxor " #z ", " #z " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1629 "psubw " #a ", " #z " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1630 "pmaxsw " #z ", " #a " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1631 "paddusw " #a ", " #sum " \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1632
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1633 #define SBUTTERFLY(a,b,t,n)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1634 "movq " #a ", " #t " \n\t" /* abcd */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1635 "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1636 "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1637
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1638 #define TRANSPOSE4(a,b,c,d,t)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1639 SBUTTERFLY(a,b,t,wd) /* a=aebf t=cgdh */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1640 SBUTTERFLY(c,d,b,wd) /* c=imjn b=kolp */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1641 SBUTTERFLY(a,c,d,dq) /* a=aeim d=bfjn */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1642 SBUTTERFLY(t,b,c,dq) /* t=cgko c=dhlp */
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1643
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1644 #define LOAD4(o, a, b, c, d)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1645 "movq "#o"(%1), " #a " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1646 "movq "#o"+16(%1), " #b " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1647 "movq "#o"+32(%1), " #c " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1648 "movq "#o"+48(%1), " #d " \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1649
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1650 #define STORE4(o, a, b, c, d)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1651 "movq "#a", "#o"(%1) \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1652 "movq "#b", "#o"+16(%1) \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1653 "movq "#c", "#o"+32(%1) \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1654 "movq "#d", "#o"+48(%1) \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1655
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1656 static int hadamard8_diff_mmx(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1657 uint64_t temp[16] __align8;
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1658 int sum=0;
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1659
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1660 assert(h==8);
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1661
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1662 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride);
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1663
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1664 asm volatile(
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1665 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1666 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1667
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1668 HADAMARD48
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1669
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1670 "movq %%mm7, 112(%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1671
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1672 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1673 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1674
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1675 "movq 112(%1), %%mm7 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1676 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1677 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1678
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1679 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1680 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1681
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1682 HADAMARD48
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1683
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1684 "movq %%mm7, 120(%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1685
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1686 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1687 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1688
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1689 "movq 120(%1), %%mm7 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1690 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1691 "movq %%mm7, %%mm5 \n\t"//FIXME remove
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1692 "movq %%mm6, %%mm7 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1693 "movq %%mm0, %%mm6 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1694 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1695
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1696 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1697 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1698
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1699 HADAMARD48
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1700 "movq %%mm7, 64(%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1701 MMABS(%%mm0, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1702 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1703 MMABS_SUM(%%mm2, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1704 MMABS_SUM(%%mm3, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1705 MMABS_SUM(%%mm4, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1706 MMABS_SUM(%%mm5, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1707 MMABS_SUM(%%mm6, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1708 "movq 64(%1), %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1709 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1710 "movq %%mm0, 64(%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1711
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1712 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1713 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1714
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1715 HADAMARD48
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1716 "movq %%mm7, (%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1717 MMABS(%%mm0, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1718 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1719 MMABS_SUM(%%mm2, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1720 MMABS_SUM(%%mm3, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1721 MMABS_SUM(%%mm4, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1722 MMABS_SUM(%%mm5, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1723 MMABS_SUM(%%mm6, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1724 "movq (%1), %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1725 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1726 "movq 64(%1), %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1727 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1728
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1729 "movq %%mm0, %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1730 "psrlq $32, %%mm0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1731 "paddusw %%mm1, %%mm0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1732 "movq %%mm0, %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1733 "psrlq $16, %%mm0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1734 "paddusw %%mm1, %%mm0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1735 "movd %%mm0, %0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1736
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1737 : "=r" (sum)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1738 : "r"(temp)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1739 );
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1740 return sum&0xFFFF;
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1741 }
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1742
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1743 static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1744 uint64_t temp[16] __align8;
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1745 int sum=0;
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1746
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1747 assert(h==8);
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1748
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1749 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride);
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1750
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1751 asm volatile(
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1752 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1753 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1754
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1755 HADAMARD48
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1756
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1757 "movq %%mm7, 112(%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1758
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1759 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1760 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1761
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1762 "movq 112(%1), %%mm7 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1763 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1764 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1765
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1766 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1767 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1768
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1769 HADAMARD48
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1770
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1771 "movq %%mm7, 120(%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1772
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1773 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1774 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1775
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1776 "movq 120(%1), %%mm7 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1777 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1778 "movq %%mm7, %%mm5 \n\t"//FIXME remove
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1779 "movq %%mm6, %%mm7 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1780 "movq %%mm0, %%mm6 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1781 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1782
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1783 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1784 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1785
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1786 HADAMARD48
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1787 "movq %%mm7, 64(%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1788 MMABS_MMX2(%%mm0, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1789 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1790 MMABS_SUM_MMX2(%%mm2, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1791 MMABS_SUM_MMX2(%%mm3, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1792 MMABS_SUM_MMX2(%%mm4, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1793 MMABS_SUM_MMX2(%%mm5, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1794 MMABS_SUM_MMX2(%%mm6, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1795 "movq 64(%1), %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1796 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1797 "movq %%mm0, 64(%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1798
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1799 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1800 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1801
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1802 HADAMARD48
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1803 "movq %%mm7, (%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1804 MMABS_MMX2(%%mm0, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1805 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1806 MMABS_SUM_MMX2(%%mm2, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1807 MMABS_SUM_MMX2(%%mm3, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1808 MMABS_SUM_MMX2(%%mm4, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1809 MMABS_SUM_MMX2(%%mm5, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1810 MMABS_SUM_MMX2(%%mm6, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1811 "movq (%1), %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1812 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1813 "movq 64(%1), %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1814 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1815
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1816 "movq %%mm0, %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1817 "psrlq $32, %%mm0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1818 "paddusw %%mm1, %%mm0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1819 "movq %%mm0, %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1820 "psrlq $16, %%mm0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1821 "paddusw %%mm1, %%mm0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1822 "movd %%mm0, %0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1823
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1824 : "=r" (sum)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1825 : "r"(temp)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1826 );
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1827 return sum&0xFFFF;
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1828 }
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1829
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1830
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1831 WARPER8_16_SQ(hadamard8_diff_mmx, hadamard8_diff16_mmx)
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1832 WARPER8_16_SQ(hadamard8_diff_mmx2, hadamard8_diff16_mmx2)
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
1833 #endif //CONFIG_ENCODERS
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1834
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1835 #define put_no_rnd_pixels8_mmx(a,b,c,d) put_pixels8_mmx(a,b,c,d)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1836 #define put_no_rnd_pixels16_mmx(a,b,c,d) put_pixels16_mmx(a,b,c,d)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1837
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1838 #define QPEL_V_LOW(m3,m4,m5,m6, pw_20, pw_3, rnd, in0, in1, in2, in7, out, OP)\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1839 "paddw " #m4 ", " #m3 " \n\t" /* x1 */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1840 "movq "MANGLE(ff_pw_20)", %%mm4 \n\t" /* 20 */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1841 "pmullw " #m3 ", %%mm4 \n\t" /* 20x1 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1842 "movq "#in7", " #m3 " \n\t" /* d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1843 "movq "#in0", %%mm5 \n\t" /* D */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1844 "paddw " #m3 ", %%mm5 \n\t" /* x4 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1845 "psubw %%mm5, %%mm4 \n\t" /* 20x1 - x4 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1846 "movq "#in1", %%mm5 \n\t" /* C */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1847 "movq "#in2", %%mm6 \n\t" /* B */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1848 "paddw " #m6 ", %%mm5 \n\t" /* x3 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1849 "paddw " #m5 ", %%mm6 \n\t" /* x2 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1850 "paddw %%mm6, %%mm6 \n\t" /* 2x2 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1851 "psubw %%mm6, %%mm5 \n\t" /* -2x2 + x3 */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1852 "pmullw "MANGLE(ff_pw_3)", %%mm5 \n\t" /* -6x2 + 3x3 */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1853 "paddw " #rnd ", %%mm4 \n\t" /* x2 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1854 "paddw %%mm4, %%mm5 \n\t" /* 20x1 - 6x2 + 3x3 - x4 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1855 "psraw $5, %%mm5 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1856 "packuswb %%mm5, %%mm5 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1857 OP(%%mm5, out, %%mm7, d)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1858
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1859 #define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 997
diff changeset
1860 static void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1861 uint64_t temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1862 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1863 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1864 "pxor %%mm7, %%mm7 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1865 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1866 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1867 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1868 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1869 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1870 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1871 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1872 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1873 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1874 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1875 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1876 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1877 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1878 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1879 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1880 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1881 "paddw %%mm3, %%mm5 \n\t" /* b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1882 "paddw %%mm2, %%mm6 \n\t" /* c */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1883 "paddw %%mm5, %%mm5 \n\t" /* 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1884 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1885 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1886 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1887 "paddw %%mm4, %%mm0 \n\t" /* a */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1888 "paddw %%mm1, %%mm5 \n\t" /* d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1889 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1890 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1891 "paddw %6, %%mm6 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1892 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1893 "psraw $5, %%mm0 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1894 "movq %%mm0, %5 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1895 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1896 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1897 "movq 5(%0), %%mm0 \n\t" /* FGHIJKLM */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1898 "movq %%mm0, %%mm5 \n\t" /* FGHIJKLM */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1899 "movq %%mm0, %%mm6 \n\t" /* FGHIJKLM */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1900 "psrlq $8, %%mm0 \n\t" /* GHIJKLM0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1901 "psrlq $16, %%mm5 \n\t" /* HIJKLM00 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1902 "punpcklbw %%mm7, %%mm0 \n\t" /* 0G0H0I0J */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1903 "punpcklbw %%mm7, %%mm5 \n\t" /* 0H0I0J0K */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1904 "paddw %%mm0, %%mm2 \n\t" /* b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1905 "paddw %%mm5, %%mm3 \n\t" /* c */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1906 "paddw %%mm2, %%mm2 \n\t" /* 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1907 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1908 "movq %%mm6, %%mm2 \n\t" /* FGHIJKLM */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1909 "psrlq $24, %%mm6 \n\t" /* IJKLM000 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1910 "punpcklbw %%mm7, %%mm2 \n\t" /* 0F0G0H0I */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1911 "punpcklbw %%mm7, %%mm6 \n\t" /* 0I0J0K0L */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1912 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1913 "paddw %%mm2, %%mm1 \n\t" /* a */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1914 "paddw %%mm6, %%mm4 \n\t" /* d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1915 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1916 "psubw %%mm4, %%mm3 \n\t" /* - 6b +3c - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1917 "paddw %6, %%mm1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1918 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b +3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1919 "psraw $5, %%mm3 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1920 "movq %5, %%mm1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1921 "packuswb %%mm3, %%mm1 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1922 OP_MMX2(%%mm1, (%1),%%mm4, q)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1923 /* mm0= GHIJ, mm2=FGHI, mm5=HIJK, mm6=IJKL, mm7=0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1924 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1925 "movq 9(%0), %%mm1 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1926 "movq %%mm1, %%mm4 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1927 "movq %%mm1, %%mm3 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1928 "psrlq $8, %%mm1 \n\t" /* KLMNOPQ0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1929 "psrlq $16, %%mm4 \n\t" /* LMNOPQ00 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1930 "punpcklbw %%mm7, %%mm1 \n\t" /* 0K0L0M0N */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1931 "punpcklbw %%mm7, %%mm4 \n\t" /* 0L0M0N0O */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1932 "paddw %%mm1, %%mm5 \n\t" /* b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1933 "paddw %%mm4, %%mm0 \n\t" /* c */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1934 "paddw %%mm5, %%mm5 \n\t" /* 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1935 "psubw %%mm5, %%mm0 \n\t" /* c - 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1936 "movq %%mm3, %%mm5 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1937 "psrlq $24, %%mm3 \n\t" /* MNOPQ000 */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1938 "pmullw "MANGLE(ff_pw_3)", %%mm0 \n\t" /* 3c - 6b */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1939 "punpcklbw %%mm7, %%mm3 \n\t" /* 0M0N0O0P */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1940 "paddw %%mm3, %%mm2 \n\t" /* d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1941 "psubw %%mm2, %%mm0 \n\t" /* -6b + 3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1942 "movq %%mm5, %%mm2 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1943 "punpcklbw %%mm7, %%mm2 \n\t" /* 0J0K0L0M */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1944 "punpckhbw %%mm7, %%mm5 \n\t" /* 0N0O0P0Q */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1945 "paddw %%mm2, %%mm6 \n\t" /* a */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1946 "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" /* 20a */\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1947 "paddw %6, %%mm0 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1948 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1949 "psraw $5, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1950 /* mm1=KLMN, mm2=JKLM, mm3=MNOP, mm4=LMNO, mm5=NOPQ mm7=0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1951 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1952 "paddw %%mm5, %%mm3 \n\t" /* a */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1953 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0O0P0Q0Q */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1954 "paddw %%mm4, %%mm6 \n\t" /* b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1955 "pshufw $0xBE, %%mm5, %%mm4 \n\t" /* 0P0Q0Q0P */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1956 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0Q0Q0P0O */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1957 "paddw %%mm1, %%mm4 \n\t" /* c */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1958 "paddw %%mm2, %%mm5 \n\t" /* d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1959 "paddw %%mm6, %%mm6 \n\t" /* 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1960 "psubw %%mm6, %%mm4 \n\t" /* c - 2b */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1961 "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" /* 20a */\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1962 "pmullw "MANGLE(ff_pw_3)", %%mm4 \n\t" /* 3c - 6b */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1963 "psubw %%mm5, %%mm3 \n\t" /* -6b + 3c - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1964 "paddw %6, %%mm4 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1965 "paddw %%mm3, %%mm4 \n\t" /* 20a - 6b + 3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1966 "psraw $5, %%mm4 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1967 "packuswb %%mm4, %%mm0 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1968 OP_MMX2(%%mm0, 8(%1), %%mm4, q)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1969 \
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1970 "add %3, %0 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1971 "add %4, %1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1972 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1973 " jnz 1b \n\t"\
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
1974 : "+a"(src), "+c"(dst), "+m"(h)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
1975 : "d"((long)srcStride), "S"((long)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
1976 : "memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1977 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1978 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1979 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1980 static void OPNAME ## mpeg4_qpel16_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1981 int i;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1982 int16_t temp[16];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1983 /* quick HACK, XXX FIXME MUST be optimized */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1984 for(i=0; i<h; i++)\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1985 {\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1986 temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1987 temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1988 temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1989 temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1990 temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1991 temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1992 temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1993 temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1994 temp[ 8]= (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1995 temp[ 9]= (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1996 temp[10]= (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1997 temp[11]= (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1998 temp[12]= (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1999 temp[13]= (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2000 temp[14]= (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2001 temp[15]= (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2002 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2003 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2004 "movq 8(%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2005 "paddw %2, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2006 "paddw %2, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2007 "psraw $5, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2008 "psraw $5, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2009 "packuswb %%mm1, %%mm0 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2010 OP_3DNOW(%%mm0, (%1), %%mm1, q)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2011 "movq 16(%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2012 "movq 24(%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2013 "paddw %2, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2014 "paddw %2, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2015 "psraw $5, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2016 "psraw $5, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2017 "packuswb %%mm1, %%mm0 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2018 OP_3DNOW(%%mm0, 8(%1), %%mm1, q)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2019 :: "r"(temp), "r"(dst), "m"(ROUNDER)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2020 : "memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2021 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2022 dst+=dstStride;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2023 src+=srcStride;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2024 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2025 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2026 \
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 997
diff changeset
2027 static void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2028 uint64_t temp;\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2029 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2030 asm volatile(\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2031 "pxor %%mm7, %%mm7 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2032 "1: \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2033 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2034 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2035 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2036 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2037 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2038 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2039 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2040 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2041 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2042 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2043 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2044 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2045 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2046 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2047 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2048 "paddw %%mm3, %%mm5 \n\t" /* b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2049 "paddw %%mm2, %%mm6 \n\t" /* c */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2050 "paddw %%mm5, %%mm5 \n\t" /* 2b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2051 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2052 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2053 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2054 "paddw %%mm4, %%mm0 \n\t" /* a */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2055 "paddw %%mm1, %%mm5 \n\t" /* d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2056 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2057 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2058 "paddw %6, %%mm6 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2059 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2060 "psraw $5, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2061 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2062 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2063 "movd 5(%0), %%mm5 \n\t" /* FGHI */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2064 "punpcklbw %%mm7, %%mm5 \n\t" /* 0F0G0H0I */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2065 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0G0H0I0I */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2066 "paddw %%mm5, %%mm1 \n\t" /* a */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2067 "paddw %%mm6, %%mm2 \n\t" /* b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2068 "pshufw $0xBE, %%mm5, %%mm6 \n\t" /* 0H0I0I0H */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2069 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0I0I0H0G */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2070 "paddw %%mm6, %%mm3 \n\t" /* c */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2071 "paddw %%mm5, %%mm4 \n\t" /* d */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2072 "paddw %%mm2, %%mm2 \n\t" /* 2b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2073 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2074 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2075 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2076 "psubw %%mm4, %%mm3 \n\t" /* -6b + 3c - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2077 "paddw %6, %%mm1 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2078 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b + 3c - d */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2079 "psraw $5, %%mm3 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2080 "packuswb %%mm3, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2081 OP_MMX2(%%mm0, (%1), %%mm4, q)\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2082 \
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2083 "add %3, %0 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2084 "add %4, %1 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2085 "decl %2 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2086 " jnz 1b \n\t"\
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
2087 : "+a"(src), "+c"(dst), "+m"(h)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2088 : "S"((long)srcStride), "D"((long)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2089 : "memory"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2090 );\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2091 }\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2092 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2093 static void OPNAME ## mpeg4_qpel8_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2094 int i;\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2095 int16_t temp[8];\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2096 /* quick HACK, XXX FIXME MUST be optimized */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2097 for(i=0; i<h; i++)\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2098 {\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2099 temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2100 temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2101 temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2102 temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2103 temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2104 temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 8]);\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2105 temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 8])*3 - (src[ 3]+src[ 7]);\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2106 temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 8])*6 + (src[ 5]+src[ 7])*3 - (src[ 4]+src[ 6]);\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2107 asm volatile(\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2108 "movq (%0), %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2109 "movq 8(%0), %%mm1 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2110 "paddw %2, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2111 "paddw %2, %%mm1 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2112 "psraw $5, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2113 "psraw $5, %%mm1 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2114 "packuswb %%mm1, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2115 OP_3DNOW(%%mm0, (%1), %%mm1, q)\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2116 :: "r"(temp), "r"(dst), "m"(ROUNDER)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2117 :"memory"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2118 );\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2119 dst+=dstStride;\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2120 src+=srcStride;\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2121 }\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2122 }
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2123
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2124 #define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX)\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2125 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2126 static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2127 uint64_t temp[17*4];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2128 uint64_t *temp_ptr= temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2129 int count= 17;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2130 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2131 /*FIXME unroll */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2132 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2133 "pxor %%mm7, %%mm7 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2134 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2135 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2136 "movq (%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2137 "movq 8(%0), %%mm2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2138 "movq 8(%0), %%mm3 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2139 "punpcklbw %%mm7, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2140 "punpckhbw %%mm7, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2141 "punpcklbw %%mm7, %%mm2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2142 "punpckhbw %%mm7, %%mm3 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2143 "movq %%mm0, (%1) \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2144 "movq %%mm1, 17*8(%1) \n\t"\
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
2145 "movq %%mm2, 2*17*8(%1) \n\t"\
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
2146 "movq %%mm3, 3*17*8(%1) \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2147 "add $8, %1 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2148 "add %3, %0 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2149 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2150 " jnz 1b \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2151 : "+r" (src), "+r" (temp_ptr), "+r"(count)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2152 : "r" ((long)srcStride)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2153 : "memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2154 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2155 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2156 temp_ptr= temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2157 count=4;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2158 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2159 /*FIXME reorder for speed */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2160 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2161 /*"pxor %%mm7, %%mm7 \n\t"*/\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2162 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2163 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2164 "movq 8(%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2165 "movq 16(%0), %%mm2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2166 "movq 24(%0), %%mm3 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2167 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2168 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2169 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2170 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2171 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2172 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2173 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2174 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2175 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2176 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2177 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 80(%0), (%1), OP)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2178 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2179 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2180 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 40(%0), 48(%0), 56(%0), 96(%0), (%1), OP)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2181 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0),104(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2182 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2183 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 56(%0), 64(%0), 72(%0),112(%0), (%1), OP)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2184 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0),120(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2185 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2186 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 72(%0), 80(%0), 88(%0),128(%0), (%1), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2187 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2188 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0),128(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2189 "add %4, %1 \n\t" \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2190 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 88(%0), 96(%0),104(%0),120(%0), (%1), OP)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2191 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 96(%0),104(%0),112(%0),112(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2192 \
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2193 "add $136, %0 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2194 "add %6, %1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2195 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2196 " jnz 1b \n\t"\
958
9bb668034ecf slowdown / gcc 2.95.* bug workaround (this should be reversed as soon as gcc 2.95.* support is droped)
michaelni
parents: 954
diff changeset
2197 \
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
2198 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2199 : "r"((long)dstStride), "r"(2*(long)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-14*(long)dstStride)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2200 :"memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2201 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2202 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2203 \
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 997
diff changeset
2204 static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2205 uint64_t temp[9*2];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2206 uint64_t *temp_ptr= temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2207 int count= 9;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2208 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2209 /*FIXME unroll */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2210 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2211 "pxor %%mm7, %%mm7 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2212 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2213 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2214 "movq (%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2215 "punpcklbw %%mm7, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2216 "punpckhbw %%mm7, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2217 "movq %%mm0, (%1) \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2218 "movq %%mm1, 9*8(%1) \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2219 "add $8, %1 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2220 "add %3, %0 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2221 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2222 " jnz 1b \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2223 : "+r" (src), "+r" (temp_ptr), "+r"(count)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2224 : "r" ((long)srcStride)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2225 : "memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2226 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2227 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2228 temp_ptr= temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2229 count=2;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2230 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2231 /*FIXME reorder for speed */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2232 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2233 /*"pxor %%mm7, %%mm7 \n\t"*/\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2234 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2235 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2236 "movq 8(%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2237 "movq 16(%0), %%mm2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2238 "movq 24(%0), %%mm3 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2239 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0), 8(%0), (%0), 32(%0), (%1), OP)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2240 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2241 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2242 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, (%0), (%0), 8(%0), 48(%0), (%1), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2243 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2244 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2245 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2246 QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2247 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2248 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2249 "add %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2250 QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 56(%0), (%1), OP)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2251 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 48(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2252 \
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2253 "add $72, %0 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2254 "add %6, %1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2255 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2256 " jnz 1b \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2257 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2258 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2259 : "r"((long)dstStride), "r"(2*(long)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-6*(long)dstStride)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2260 : "memory"\
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2261 );\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2262 }\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2263 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2264 static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2265 OPNAME ## pixels8_mmx(dst, src, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2266 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2267 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2268 static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2269 uint64_t temp[8];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2270 uint8_t * const half= (uint8_t*)temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2271 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2272 OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2273 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2274 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2275 static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2276 OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2277 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2278 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2279 static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2280 uint64_t temp[8];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2281 uint8_t * const half= (uint8_t*)temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2282 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2283 OPNAME ## pixels8_l2_ ## MMX(dst, src+1, half, stride, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2284 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2285 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2286 static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2287 uint64_t temp[8];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2288 uint8_t * const half= (uint8_t*)temp;\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2289 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2290 OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2291 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2292 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2293 static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2294 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2295 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2296 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2297 static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2298 uint64_t temp[8];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2299 uint8_t * const half= (uint8_t*)temp;\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2300 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2301 OPNAME ## pixels8_l2_ ## MMX(dst, src+stride, half, stride, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2302 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2303 static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2304 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2305 uint8_t * const halfH= ((uint8_t*)half) + 64;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2306 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2307 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2308 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2309 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2310 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2311 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2312 static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2313 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2314 uint8_t * const halfH= ((uint8_t*)half) + 64;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2315 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2316 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2317 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2318 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2319 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2320 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2321 static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2322 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2323 uint8_t * const halfH= ((uint8_t*)half) + 64;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2324 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2325 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2326 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2327 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2328 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2329 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2330 static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2331 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2332 uint8_t * const halfH= ((uint8_t*)half) + 64;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2333 uint8_t * const halfHV= ((uint8_t*)half);\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2334 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2335 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2336 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2337 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2338 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2339 static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2340 uint64_t half[8 + 9];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2341 uint8_t * const halfH= ((uint8_t*)half) + 64;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2342 uint8_t * const halfHV= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2343 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2344 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2345 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2346 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2347 static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2348 uint64_t half[8 + 9];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2349 uint8_t * const halfH= ((uint8_t*)half) + 64;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2350 uint8_t * const halfHV= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2351 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2352 put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2353 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2354 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2355 static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2356 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2357 uint8_t * const halfH= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2358 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2359 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2360 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2361 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2362 static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2363 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2364 uint8_t * const halfH= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2365 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2366 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2367 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2368 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2369 static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2370 uint64_t half[9];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2371 uint8_t * const halfH= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2372 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2373 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2374 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2375 static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2376 OPNAME ## pixels16_mmx(dst, src, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2377 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2378 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2379 static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2380 uint64_t temp[32];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2381 uint8_t * const half= (uint8_t*)temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2382 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2383 OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2384 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2385 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2386 static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2387 OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2388 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2389 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2390 static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2391 uint64_t temp[32];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2392 uint8_t * const half= (uint8_t*)temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2393 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2394 OPNAME ## pixels16_l2_ ## MMX(dst, src+1, half, stride, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2395 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2396 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2397 static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2398 uint64_t temp[32];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2399 uint8_t * const half= (uint8_t*)temp;\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2400 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2401 OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2402 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2403 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2404 static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2405 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2406 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2407 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2408 static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2409 uint64_t temp[32];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2410 uint8_t * const half= (uint8_t*)temp;\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2411 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2412 OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, stride, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2413 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2414 static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2415 uint64_t half[16*2 + 17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2416 uint8_t * const halfH= ((uint8_t*)half) + 256;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2417 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2418 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2419 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2420 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2421 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2422 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2423 static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2424 uint64_t half[16*2 + 17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2425 uint8_t * const halfH= ((uint8_t*)half) + 256;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2426 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2427 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2428 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2429 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2430 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2431 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2432 static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2433 uint64_t half[16*2 + 17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2434 uint8_t * const halfH= ((uint8_t*)half) + 256;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2435 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2436 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2437 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2438 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2439 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2440 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2441 static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2442 uint64_t half[16*2 + 17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2443 uint8_t * const halfH= ((uint8_t*)half) + 256;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2444 uint8_t * const halfHV= ((uint8_t*)half);\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2445 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2446 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2447 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2448 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2449 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2450 static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2451 uint64_t half[16*2 + 17*2];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2452 uint8_t * const halfH= ((uint8_t*)half) + 256;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2453 uint8_t * const halfHV= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2454 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2455 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2456 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2457 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2458 static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2459 uint64_t half[16*2 + 17*2];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2460 uint8_t * const halfH= ((uint8_t*)half) + 256;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2461 uint8_t * const halfHV= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2462 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2463 put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2464 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2465 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2466 static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2467 uint64_t half[17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2468 uint8_t * const halfH= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2469 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2470 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2471 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2472 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2473 static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2474 uint64_t half[17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2475 uint8_t * const halfH= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2476 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
2207
22b768f1261a 10000l fix and use more mmx2/3dnow code for mpeg4 qpel which has been written and commited long time ago but appearently never used, qpel motion compensation is 5% faster
michael
parents: 2067
diff changeset
2477 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2478 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2479 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2480 static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2481 uint64_t half[17*2];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2482 uint8_t * const halfH= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2483 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2484 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2485 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2486
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2487 #define QPEL_H264V(A,B,C,D,E,F,OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2488 "movd (%0), "#F" \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2489 "movq "#C", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2490 "paddw "#D", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2491 "psllw $2, %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2492 "psubw "#B", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2493 "psubw "#E", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2494 "pmullw %4, %%mm6 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2495 "add %2, %0 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2496 "punpcklbw %%mm7, "#F" \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2497 "paddw %5, "#A" \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2498 "paddw "#F", "#A" \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2499 "paddw "#A", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2500 "psraw $5, %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2501 "packuswb %%mm6, %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2502 OP(%%mm6, (%1), A, d)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2503 "add %3, %1 \n\t"
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2504
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2505 #define QPEL_H264HV(A,B,C,D,E,F,OF)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2506 "movd (%0), "#F" \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2507 "movq "#C", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2508 "paddw "#D", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2509 "psllw $2, %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2510 "psubw "#B", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2511 "psubw "#E", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2512 "pmullw %3, %%mm6 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2513 "add %2, %0 \n\t"\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2514 "punpcklbw %%mm7, "#F" \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2515 "paddw "#F", "#A" \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2516 "paddw "#A", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2517 "movq %%mm6, "#OF"(%1) \n\t"
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2518
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2519 #define QPEL_H264(OPNAME, OP, MMX)\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2520 static void OPNAME ## h264_qpel4_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2521 int h=4;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2522 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2523 asm volatile(\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2524 "pxor %%mm7, %%mm7 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2525 "movq %5, %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2526 "movq %6, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2527 "1: \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2528 "movd -1(%0), %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2529 "movd (%0), %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2530 "movd 1(%0), %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2531 "movd 2(%0), %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2532 "punpcklbw %%mm7, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2533 "punpcklbw %%mm7, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2534 "punpcklbw %%mm7, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2535 "punpcklbw %%mm7, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2536 "paddw %%mm0, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2537 "paddw %%mm3, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2538 "movd -2(%0), %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2539 "movd 3(%0), %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2540 "punpcklbw %%mm7, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2541 "punpcklbw %%mm7, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2542 "paddw %%mm3, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2543 "psllw $2, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2544 "psubw %%mm1, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2545 "pmullw %%mm4, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2546 "paddw %%mm5, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2547 "paddw %%mm2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2548 "psraw $5, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2549 "packuswb %%mm0, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2550 OP(%%mm0, (%1),%%mm6, d)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2551 "add %3, %0 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2552 "add %4, %1 \n\t"\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2553 "decl %2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2554 " jnz 1b \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2555 : "+a"(src), "+c"(dst), "+m"(h)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2556 : "d"((long)srcStride), "S"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2557 : "memory"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2558 );\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2559 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2560 static void OPNAME ## h264_qpel4_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2561 src -= 2*srcStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2562 asm volatile(\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2563 "pxor %%mm7, %%mm7 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2564 "movd (%0), %%mm0 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2565 "add %2, %0 \n\t"\
2212
93091141f75e optimization
michael
parents: 2211
diff changeset
2566 "movd (%0), %%mm1 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2567 "add %2, %0 \n\t"\
2212
93091141f75e optimization
michael
parents: 2211
diff changeset
2568 "movd (%0), %%mm2 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2569 "add %2, %0 \n\t"\
2212
93091141f75e optimization
michael
parents: 2211
diff changeset
2570 "movd (%0), %%mm3 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2571 "add %2, %0 \n\t"\
2212
93091141f75e optimization
michael
parents: 2211
diff changeset
2572 "movd (%0), %%mm4 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2573 "add %2, %0 \n\t"\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2574 "punpcklbw %%mm7, %%mm0 \n\t"\
2212
93091141f75e optimization
michael
parents: 2211
diff changeset
2575 "punpcklbw %%mm7, %%mm1 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2576 "punpcklbw %%mm7, %%mm2 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2577 "punpcklbw %%mm7, %%mm3 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2578 "punpcklbw %%mm7, %%mm4 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2579 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2580 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2581 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2582 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2583 \
93091141f75e optimization
michael
parents: 2211
diff changeset
2584 : "+a"(src), "+c"(dst)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2585 : "S"((long)srcStride), "D"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2586 : "memory"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2587 );\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2588 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2589 static void OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2590 int h=4;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2591 int w=3;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2592 src -= 2*srcStride+2;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2593 while(w--){\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2594 asm volatile(\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2595 "pxor %%mm7, %%mm7 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2596 "movd (%0), %%mm0 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2597 "add %2, %0 \n\t"\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2598 "movd (%0), %%mm1 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2599 "add %2, %0 \n\t"\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2600 "movd (%0), %%mm2 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2601 "add %2, %0 \n\t"\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2602 "movd (%0), %%mm3 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2603 "add %2, %0 \n\t"\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2604 "movd (%0), %%mm4 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2605 "add %2, %0 \n\t"\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2606 "punpcklbw %%mm7, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2607 "punpcklbw %%mm7, %%mm1 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2608 "punpcklbw %%mm7, %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2609 "punpcklbw %%mm7, %%mm3 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2610 "punpcklbw %%mm7, %%mm4 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2611 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*3)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2612 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*3)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2613 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*3)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2614 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*3)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2615 \
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2616 : "+a"(src)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2617 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5)\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2618 : "memory"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2619 );\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2620 tmp += 4;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2621 src += 4 - 9*srcStride;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2622 }\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2623 tmp -= 3*4;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2624 asm volatile(\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2625 "movq %4, %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2626 "1: \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2627 "movq (%0), %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2628 "paddw 10(%0), %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2629 "movq 2(%0), %%mm1 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2630 "paddw 8(%0), %%mm1 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2631 "movq 4(%0), %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2632 "paddw 6(%0), %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2633 "psubw %%mm1, %%mm0 \n\t"/*a-b (abccba)*/\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2634 "psraw $2, %%mm0 \n\t"/*(a-b)/4 */\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2635 "psubw %%mm1, %%mm0 \n\t"/*(a-b)/4-b */\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2636 "paddsw %%mm2, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2637 "psraw $2, %%mm0 \n\t"/*((a-b)/4-b)/4 */\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2638 "paddw %%mm6, %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2639 "paddw %%mm2, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2640 "psraw $6, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2641 "packuswb %%mm0, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2642 OP(%%mm0, (%1),%%mm7, d)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2643 "add $24, %0 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2644 "add %3, %1 \n\t"\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2645 "decl %2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2646 " jnz 1b \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2647 : "+a"(tmp), "+c"(dst), "+m"(h)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2648 : "S"((long)dstStride), "m"(ff_pw_32)\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2649 : "memory"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2650 );\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2651 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2652 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2653 static void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2654 int h=8;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2655 asm volatile(\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2656 "pxor %%mm7, %%mm7 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2657 "movq %5, %%mm6 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2658 "1: \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2659 "movq (%0), %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2660 "movq 1(%0), %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2661 "movq %%mm0, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2662 "movq %%mm2, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2663 "punpcklbw %%mm7, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2664 "punpckhbw %%mm7, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2665 "punpcklbw %%mm7, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2666 "punpckhbw %%mm7, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2667 "paddw %%mm2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2668 "paddw %%mm3, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2669 "psllw $2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2670 "psllw $2, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2671 "movq -1(%0), %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2672 "movq 2(%0), %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2673 "movq %%mm2, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2674 "movq %%mm4, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2675 "punpcklbw %%mm7, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2676 "punpckhbw %%mm7, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2677 "punpcklbw %%mm7, %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2678 "punpckhbw %%mm7, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2679 "paddw %%mm4, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2680 "paddw %%mm3, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2681 "psubw %%mm2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2682 "psubw %%mm5, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2683 "pmullw %%mm6, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2684 "pmullw %%mm6, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2685 "movd -2(%0), %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2686 "movd 7(%0), %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2687 "punpcklbw %%mm7, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2688 "punpcklbw %%mm7, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2689 "paddw %%mm3, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2690 "paddw %%mm5, %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2691 "movq %6, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2692 "paddw %%mm5, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2693 "paddw %%mm5, %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2694 "paddw %%mm2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2695 "paddw %%mm4, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2696 "psraw $5, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2697 "psraw $5, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2698 "packuswb %%mm1, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2699 OP(%%mm0, (%1),%%mm5, q)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2700 "add %3, %0 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2701 "add %4, %1 \n\t"\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2702 "decl %2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2703 " jnz 1b \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2704 : "+a"(src), "+c"(dst), "+m"(h)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2705 : "d"((long)srcStride), "S"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2706 : "memory"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2707 );\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2708 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2709 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2710 static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2711 int h= 2;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2712 src -= 2*srcStride;\
2210
e1c60876a0ae optimization
michael
parents: 2209
diff changeset
2713 \
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2714 while(h--){\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2715 asm volatile(\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2716 "pxor %%mm7, %%mm7 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2717 "movd (%0), %%mm0 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2718 "add %2, %0 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2719 "movd (%0), %%mm1 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2720 "add %2, %0 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2721 "movd (%0), %%mm2 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2722 "add %2, %0 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2723 "movd (%0), %%mm3 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2724 "add %2, %0 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2725 "movd (%0), %%mm4 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2726 "add %2, %0 \n\t"\
2210
e1c60876a0ae optimization
michael
parents: 2209
diff changeset
2727 "punpcklbw %%mm7, %%mm0 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2728 "punpcklbw %%mm7, %%mm1 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2729 "punpcklbw %%mm7, %%mm2 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2730 "punpcklbw %%mm7, %%mm3 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2731 "punpcklbw %%mm7, %%mm4 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2732 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2733 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2734 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2735 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2736 QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2737 QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2738 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2739 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2740 \
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2741 : "+a"(src), "+c"(dst)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2742 : "S"((long)srcStride), "D"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2743 : "memory"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2744 );\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2745 src += 4-13*srcStride;\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2746 dst += 4-8*dstStride;\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2747 }\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2748 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2749 static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2750 int h=8;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2751 int w=4;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2752 src -= 2*srcStride+2;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2753 while(w--){\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2754 asm volatile(\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2755 "pxor %%mm7, %%mm7 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2756 "movd (%0), %%mm0 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2757 "add %2, %0 \n\t"\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2758 "movd (%0), %%mm1 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2759 "add %2, %0 \n\t"\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2760 "movd (%0), %%mm2 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2761 "add %2, %0 \n\t"\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2762 "movd (%0), %%mm3 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2763 "add %2, %0 \n\t"\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2764 "movd (%0), %%mm4 \n\t"\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2765 "add %2, %0 \n\t"\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2766 "punpcklbw %%mm7, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2767 "punpcklbw %%mm7, %%mm1 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2768 "punpcklbw %%mm7, %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2769 "punpcklbw %%mm7, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2770 "punpcklbw %%mm7, %%mm4 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2771 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2772 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2773 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2774 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2775 QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2776 QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2777 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2778 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 7*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2779 \
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2780 : "+a"(src)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2781 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5)\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2782 : "memory"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2783 );\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2784 tmp += 4;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2785 src += 4 - 13*srcStride;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2786 }\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2787 tmp -= 4*4;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2788 asm volatile(\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2789 "movq %4, %%mm6 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2790 "1: \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2791 "movq (%0), %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2792 "movq 8(%0), %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2793 "movq 2(%0), %%mm1 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2794 "movq 10(%0), %%mm4 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2795 "paddw %%mm4, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2796 "paddw %%mm3, %%mm1 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2797 "paddw 18(%0), %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2798 "paddw 16(%0), %%mm4 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2799 "movq 4(%0), %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2800 "movq 12(%0), %%mm5 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2801 "paddw 6(%0), %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2802 "paddw 14(%0), %%mm5 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2803 "psubw %%mm1, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2804 "psubw %%mm4, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2805 "psraw $2, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2806 "psraw $2, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2807 "psubw %%mm1, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2808 "psubw %%mm4, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2809 "paddsw %%mm2, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2810 "paddsw %%mm5, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2811 "psraw $2, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2812 "psraw $2, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2813 "paddw %%mm6, %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2814 "paddw %%mm6, %%mm5 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2815 "paddw %%mm2, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2816 "paddw %%mm5, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2817 "psraw $6, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2818 "psraw $6, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2819 "packuswb %%mm3, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2820 OP(%%mm0, (%1),%%mm7, q)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2821 "add $32, %0 \n\t"\
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2822 "add %3, %1 \n\t"\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2823 "decl %2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2824 " jnz 1b \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2825 : "+a"(tmp), "+c"(dst), "+m"(h)\
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
2826 : "S"((long)dstStride), "m"(ff_pw_32)\
2217
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2827 : "memory"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2828 );\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2829 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2830 static void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2831 OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2832 OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2833 src += 8*srcStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2834 dst += 8*dstStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2835 OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2836 OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2837 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2838 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2839 static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2840 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2841 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2842 src += 8*srcStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2843 dst += 8*dstStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2844 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2845 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2846 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2847 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2848 static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2849 OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride);\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2850 OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(dst+8, tmp , src+8, dstStride, tmpStride, srcStride);\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2851 src += 8*srcStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2852 dst += 8*dstStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2853 OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride);\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2854 OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(dst+8, tmp , src+8, dstStride, tmpStride, srcStride);\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2855 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2856
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2857 #define H264_MC(OPNAME, SIZE, MMX) \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2858 static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2859 OPNAME ## pixels ## SIZE ## _mmx(dst, src, stride, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2860 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2861 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2862 static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2863 uint64_t temp[SIZE*SIZE/8];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2864 uint8_t * const half= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2865 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(half, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2866 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, half, stride, stride, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2867 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2868 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2869 static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2870 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2871 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2872 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2873 static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2874 uint64_t temp[SIZE*SIZE/8];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2875 uint8_t * const half= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2876 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(half, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2877 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+1, half, stride, stride, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2878 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2879 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2880 static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2881 uint64_t temp[SIZE*SIZE/8];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2882 uint8_t * const half= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2883 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(half, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2884 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, half, stride, stride, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2885 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2886 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2887 static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2888 OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2889 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2890 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2891 static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2892 uint64_t temp[SIZE*SIZE/8];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2893 uint8_t * const half= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2894 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(half, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2895 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, half, stride, stride, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2896 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2897 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2898 static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2899 uint64_t temp[SIZE*SIZE/4];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2900 uint8_t * const halfH= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2901 uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2902 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2903 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2904 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2905 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2906 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2907 static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2908 uint64_t temp[SIZE*SIZE/4];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2909 uint8_t * const halfH= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2910 uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2911 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2912 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src+1, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2913 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2914 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2915 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2916 static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2917 uint64_t temp[SIZE*SIZE/4];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2918 uint8_t * const halfH= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2919 uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2920 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src + stride, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2921 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2922 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2923 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2924 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2925 static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2926 uint64_t temp[SIZE*SIZE/4];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2927 uint8_t * const halfH= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2928 uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2929 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src + stride, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2930 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src+1, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2931 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2932 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2933 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2934 static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2935 uint64_t temp[SIZE*(SIZE+8)/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2936 int16_t * const tmp= (int16_t*)temp;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2937 OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, tmp, src, stride, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2938 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2939 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2940 static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2941 uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2942 uint8_t * const halfH= (uint8_t*)temp;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2943 uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2944 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2945 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2946 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2947 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfHV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2948 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2949 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2950 static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2951 uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2952 uint8_t * const halfH= (uint8_t*)temp;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2953 uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2954 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2955 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src + stride, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2956 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2957 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfHV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2958 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2959 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2960 static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2961 uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2962 uint8_t * const halfV= (uint8_t*)temp;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2963 uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2964 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2965 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2966 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2967 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfV, halfHV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2968 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2969 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2970 static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2971 uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2972 uint8_t * const halfV= (uint8_t*)temp;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2973 uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2974 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2975 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src+1, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2976 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2977 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfV, halfHV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2978 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2979
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2980
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2981 #define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t"
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2982 #define AVG_3DNOW_OP(a,b,temp, size) \
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2983 "mov" #size " " #b ", " #temp " \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2984 "pavgusb " #temp ", " #a " \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2985 "mov" #size " " #a ", " #b " \n\t"
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2986 #define AVG_MMX2_OP(a,b,temp, size) \
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2987 "mov" #size " " #b ", " #temp " \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2988 "pavgb " #temp ", " #a " \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2989 "mov" #size " " #a ", " #b " \n\t"
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2990
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2991 QPEL_BASE(put_ , ff_pw_16, _ , PUT_OP, PUT_OP)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2992 QPEL_BASE(avg_ , ff_pw_16, _ , AVG_MMX2_OP, AVG_3DNOW_OP)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2993 QPEL_BASE(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, PUT_OP)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2994 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, 3dnow)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2995 QPEL_OP(avg_ , ff_pw_16, _ , AVG_3DNOW_OP, 3dnow)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2996 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, 3dnow)
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2997 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, mmx2)
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2998 QPEL_OP(avg_ , ff_pw_16, _ , AVG_MMX2_OP, mmx2)
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2999 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3000
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3001 QPEL_H264(put_ , PUT_OP, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3002 QPEL_H264(avg_ , AVG_3DNOW_OP, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3003 QPEL_H264(put_ , PUT_OP, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3004 QPEL_H264(avg_ , AVG_MMX2_OP, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3005
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3006 H264_MC(put_, 4, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3007 H264_MC(put_, 8, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3008 H264_MC(put_, 16,3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3009 H264_MC(avg_, 4, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3010 H264_MC(avg_, 8, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3011 H264_MC(avg_, 16,3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3012 H264_MC(put_, 4, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3013 H264_MC(put_, 8, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3014 H264_MC(put_, 16,mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3015 H264_MC(avg_, 4, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3016 H264_MC(avg_, 8, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3017 H264_MC(avg_, 16,mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3018
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
3019 #if 0
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3020 static void just_return() { return; }
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
3021 #endif
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3022
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3023 #define SET_QPEL_FUNC(postfix1, postfix2) \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3024 c->put_ ## postfix1 = put_ ## postfix2;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3025 c->put_no_rnd_ ## postfix1 = put_no_rnd_ ## postfix2;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3026 c->avg_ ## postfix1 = avg_ ## postfix2;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3027
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3028 static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
3029 long i=0;
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3030
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3031 assert(ABS(scale) < 256);
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3032 scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3033
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3034 asm volatile(
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3035 "pcmpeqw %%mm6, %%mm6 \n\t" // -1w
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3036 "psrlw $15, %%mm6 \n\t" // 1w
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3037 "pxor %%mm7, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3038 "movd %4, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3039 "punpcklwd %%mm5, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3040 "punpcklwd %%mm5, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3041 "1: \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3042 "movq (%1, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3043 "movq 8(%1, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3044 "pmulhw %%mm5, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3045 "pmulhw %%mm5, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3046 "paddw %%mm6, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3047 "paddw %%mm6, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3048 "psraw $1, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3049 "psraw $1, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3050 "paddw (%2, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3051 "paddw 8(%2, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3052 "psraw $6, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3053 "psraw $6, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3054 "pmullw (%3, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3055 "pmullw 8(%3, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3056 "pmaddwd %%mm0, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3057 "pmaddwd %%mm1, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3058 "paddd %%mm1, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3059 "psrld $4, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3060 "paddd %%mm0, %%mm7 \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
3061 "add $16, %0 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
3062 "cmp $128, %0 \n\t" //FIXME optimize & bench
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3063 " jb 1b \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3064 "movq %%mm7, %%mm6 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3065 "psrlq $32, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3066 "paddd %%mm6, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3067 "psrld $2, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3068 "movd %%mm7, %0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3069
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3070 : "+r" (i)
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3071 : "r"(basis), "r"(rem), "r"(weight), "g"(scale)
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3072 );
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3073 return i;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3074 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3075
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3076 static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
3077 long i=0;
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3078
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3079 if(ABS(scale) < 256){
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3080 scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3081 asm volatile(
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3082 "pcmpeqw %%mm6, %%mm6 \n\t" // -1w
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3083 "psrlw $15, %%mm6 \n\t" // 1w
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3084 "movd %3, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3085 "punpcklwd %%mm5, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3086 "punpcklwd %%mm5, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3087 "1: \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3088 "movq (%1, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3089 "movq 8(%1, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3090 "pmulhw %%mm5, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3091 "pmulhw %%mm5, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3092 "paddw %%mm6, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3093 "paddw %%mm6, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3094 "psraw $1, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3095 "psraw $1, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3096 "paddw (%2, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3097 "paddw 8(%2, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3098 "movq %%mm0, (%2, %0) \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3099 "movq %%mm1, 8(%2, %0) \n\t"
2293
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
3100 "add $16, %0 \n\t"
15cfba1b97b5 adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents: 2256
diff changeset
3101 "cmp $128, %0 \n\t" //FIXME optimize & bench
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3102 " jb 1b \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3103
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3104 : "+r" (i)
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3105 : "r"(basis), "r"(rem), "g"(scale)
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3106 );
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3107 }else{
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3108 for(i=0; i<8*8; i++){
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3109 rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT);
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3110 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3111 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3112 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3113
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3114 /* external functions, from idct_mmx.c */
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3115 void ff_mmx_idct(DCTELEM *block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3116 void ff_mmxext_idct(DCTELEM *block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3117
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3118 /* XXX: those functions should be suppressed ASAP when all IDCTs are
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3119 converted */
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3120 static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3121 {
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3122 ff_mmx_idct (block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3123 put_pixels_clamped_mmx(block, dest, line_size);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3124 }
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3125 static void ff_libmpeg2mmx_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3126 {
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3127 ff_mmx_idct (block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3128 add_pixels_clamped_mmx(block, dest, line_size);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3129 }
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3130 static void ff_libmpeg2mmx2_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3131 {
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3132 ff_mmxext_idct (block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3133 put_pixels_clamped_mmx(block, dest, line_size);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3134 }
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3135 static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3136 {
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3137 ff_mmxext_idct (block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3138 add_pixels_clamped_mmx(block, dest, line_size);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3139 }
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3140
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3141 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3142 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
3143 mm_flags = mm_support();
1115
74a46d77e061 * support FF_MM_FORCE
kabi
parents: 1092
diff changeset
3144
1122
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
3145 if (avctx->dsp_mask) {
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
3146 if (avctx->dsp_mask & FF_MM_FORCE)
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
3147 mm_flags |= (avctx->dsp_mask & 0xffff);
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
3148 else
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
3149 mm_flags &= ~(avctx->dsp_mask & 0xffff);
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
3150 }
1115
74a46d77e061 * support FF_MM_FORCE
kabi
parents: 1092
diff changeset
3151
631
47a8964ba5cd be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents: 629
diff changeset
3152 #if 0
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3153 av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3154 if (mm_flags & MM_MMX)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3155 av_log(avctx, AV_LOG_INFO, " mmx");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3156 if (mm_flags & MM_MMXEXT)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3157 av_log(avctx, AV_LOG_INFO, " mmxext");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3158 if (mm_flags & MM_3DNOW)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3159 av_log(avctx, AV_LOG_INFO, " 3dnow");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3160 if (mm_flags & MM_SSE)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3161 av_log(avctx, AV_LOG_INFO, " sse");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3162 if (mm_flags & MM_SSE2)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3163 av_log(avctx, AV_LOG_INFO, " sse2");
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3164 av_log(avctx, AV_LOG_INFO, "\n");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3165 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
3166
986e461dc072 Initial revision
glantau
parents:
diff changeset
3167 if (mm_flags & MM_MMX) {
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3168 const int idct_algo= avctx->idct_algo;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3169
1232
e88d3b1fb2a1 more #ifdef CONFIG_ENCODERS by (Wolfgang Hesseler <qv at multimediaware dot com>)
michaelni
parents: 1186
diff changeset
3170 #ifdef CONFIG_ENCODERS
2024
f65d87bfdd5a some of the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents: 1985
diff changeset
3171 const int dct_algo = avctx->dct_algo;
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
3172 if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
1765
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
3173 if(mm_flags & MM_SSE2){
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
3174 c->fdct = ff_fdct_sse2;
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
3175 }else if(mm_flags & MM_MMXEXT){
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
3176 c->fdct = ff_fdct_mmx2;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
3177 }else{
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
3178 c->fdct = ff_fdct_mmx;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
3179 }
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
3180 }
1232
e88d3b1fb2a1 more #ifdef CONFIG_ENCODERS by (Wolfgang Hesseler <qv at multimediaware dot com>)
michaelni
parents: 1186
diff changeset
3181 #endif //CONFIG_ENCODERS
2256
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3182 if(avctx->lowres==0){
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3183 if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3184 c->idct_put= ff_simple_idct_put_mmx;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3185 c->idct_add= ff_simple_idct_add_mmx;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3186 c->idct = ff_simple_idct_mmx;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3187 c->idct_permutation_type= FF_SIMPLE_IDCT_PERM;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3188 }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3189 if(mm_flags & MM_MMXEXT){
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3190 c->idct_put= ff_libmpeg2mmx2_idct_put;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3191 c->idct_add= ff_libmpeg2mmx2_idct_add;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3192 c->idct = ff_mmxext_idct;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3193 }else{
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3194 c->idct_put= ff_libmpeg2mmx_idct_put;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3195 c->idct_add= ff_libmpeg2mmx_idct_add;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3196 c->idct = ff_mmx_idct;
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3197 }
7e0b2e86afa9 1/2 resolution decoding
michael
parents: 2217
diff changeset
3198 c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3199 }
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3200 }
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3201
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3202 /* VP3 optimized DSP functions */
1972
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3203 if (mm_flags & MM_SSE2) {
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3204 c->vp3_dsp_init = vp3_dsp_init_sse2;
1977
89422281f6f6 reorganize and simplify the VP3 IDCT stuff
melanson
parents: 1972
diff changeset
3205 c->vp3_idct = vp3_idct_sse2;
1972
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3206 } else {
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3207 c->vp3_dsp_init = vp3_dsp_init_mmx;
1977
89422281f6f6 reorganize and simplify the VP3 IDCT stuff
melanson
parents: 1972
diff changeset
3208 c->vp3_idct = vp3_idct_mmx;
1972
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3209 }
1977
89422281f6f6 reorganize and simplify the VP3 IDCT stuff
melanson
parents: 1972
diff changeset
3210
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3211 #ifdef CONFIG_ENCODERS
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3212 c->get_pixels = get_pixels_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3213 c->diff_pixels = diff_pixels_mmx;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3214 #endif //CONFIG_ENCODERS
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3215 c->put_pixels_clamped = put_pixels_clamped_mmx;
1984
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
3216 c->put_signed_pixels_clamped = put_signed_pixels_clamped_mmx;
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3217 c->add_pixels_clamped = add_pixels_clamped_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3218 c->clear_blocks = clear_blocks_mmx;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3219 #ifdef CONFIG_ENCODERS
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3220 c->pix_sum = pix_sum16_mmx;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3221 #endif //CONFIG_ENCODERS
415
1c3f42442fba * added simple test main - see comments about how to
kabi
parents: 402
diff changeset
3222
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3223 c->put_pixels_tab[0][0] = put_pixels16_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3224 c->put_pixels_tab[0][1] = put_pixels16_x2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3225 c->put_pixels_tab[0][2] = put_pixels16_y2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3226 c->put_pixels_tab[0][3] = put_pixels16_xy2_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3227
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3228 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3229 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3230 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3231 c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_mmx;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3232
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3233 c->avg_pixels_tab[0][0] = avg_pixels16_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3234 c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3235 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3236 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx;
415
1c3f42442fba * added simple test main - see comments about how to
kabi
parents: 402
diff changeset
3237
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3238 c->avg_no_rnd_pixels_tab[0][0] = avg_no_rnd_pixels16_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3239 c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3240 c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3241 c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3242
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3243 c->put_pixels_tab[1][0] = put_pixels8_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3244 c->put_pixels_tab[1][1] = put_pixels8_x2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3245 c->put_pixels_tab[1][2] = put_pixels8_y2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3246 c->put_pixels_tab[1][3] = put_pixels8_xy2_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3247
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3248 c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3249 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3250 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3251 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_mmx;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3252
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3253 c->avg_pixels_tab[1][0] = avg_pixels8_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3254 c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3255 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3256 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3257
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3258 c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3259 c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3260 c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_mmx;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3261 c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx;
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3262
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
3263 c->add_bytes= add_bytes_mmx;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3264 #ifdef CONFIG_ENCODERS
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
3265 c->diff_bytes= diff_bytes_mmx;
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3266
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3267 c->hadamard8_diff[0]= hadamard8_diff16_mmx;
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3268 c->hadamard8_diff[1]= hadamard8_diff_mmx;
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3269
997
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
3270 c->pix_norm1 = pix_norm1_mmx;
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
3271 c->sse[0] = sse16_mmx;
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
3272 c->sse[1] = sse8_mmx;
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3273 c->vsad[4]= vsad_intra16_mmx;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3274
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
3275 c->nsse[0] = nsse16_mmx;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
3276 c->nsse[1] = nsse8_mmx;
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3277 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3278 c->vsad[0] = vsad16_mmx;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3279 }
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3280
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3281 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3282 c->try_8x8basis= try_8x8basis_mmx;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3283 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3284 c->add_8x8basis= add_8x8basis_mmx;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3285
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3286 #endif //CONFIG_ENCODERS
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
3287
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
3288 c->h263_v_loop_filter= h263_v_loop_filter_mmx;
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3289 c->h263_h_loop_filter= h263_h_loop_filter_mmx;
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3290
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3291 if (mm_flags & MM_MMXEXT) {
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3292 c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3293 c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3294
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3295 c->avg_pixels_tab[0][0] = avg_pixels16_mmx2;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3296 c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx2;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3297 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2;
415
1c3f42442fba * added simple test main - see comments about how to
kabi
parents: 402
diff changeset
3298
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3299 c->put_pixels_tab[1][1] = put_pixels8_x2_mmx2;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3300 c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3301
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3302 c->avg_pixels_tab[1][0] = avg_pixels8_mmx2;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3303 c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3304 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3305
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3306 #ifdef CONFIG_ENCODERS
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
3307 c->hadamard8_diff[0]= hadamard8_diff16_mmx2;
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
3308 c->hadamard8_diff[1]= hadamard8_diff_mmx2;
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3309 c->vsad[4]= vsad_intra16_mmx2;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3310 #endif //CONFIG_ENCODERS
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
3311
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3312 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3313 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3314 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3315 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3316 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3317 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3318 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2;
1772
8cd5257195c9 vsad16_mmx2 only applies if encoders are turned on
melanson
parents: 1765
diff changeset
3319 #ifdef CONFIG_ENCODERS
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3320 c->vsad[0] = vsad16_mmx2;
1772
8cd5257195c9 vsad16_mmx2 only applies if encoders are turned on
melanson
parents: 1765
diff changeset
3321 #endif //CONFIG_ENCODERS
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3322 }
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
3323
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
3324 #if 1
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3325 SET_QPEL_FUNC(qpel_pixels_tab[0][ 0], qpel16_mc00_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3326 SET_QPEL_FUNC(qpel_pixels_tab[0][ 1], qpel16_mc10_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3327 SET_QPEL_FUNC(qpel_pixels_tab[0][ 2], qpel16_mc20_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3328 SET_QPEL_FUNC(qpel_pixels_tab[0][ 3], qpel16_mc30_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3329 SET_QPEL_FUNC(qpel_pixels_tab[0][ 4], qpel16_mc01_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3330 SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3331 SET_QPEL_FUNC(qpel_pixels_tab[0][ 6], qpel16_mc21_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3332 SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3333 SET_QPEL_FUNC(qpel_pixels_tab[0][ 8], qpel16_mc02_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3334 SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3335 SET_QPEL_FUNC(qpel_pixels_tab[0][10], qpel16_mc22_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3336 SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3337 SET_QPEL_FUNC(qpel_pixels_tab[0][12], qpel16_mc03_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3338 SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3339 SET_QPEL_FUNC(qpel_pixels_tab[0][14], qpel16_mc23_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3340 SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3341 SET_QPEL_FUNC(qpel_pixels_tab[1][ 0], qpel8_mc00_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3342 SET_QPEL_FUNC(qpel_pixels_tab[1][ 1], qpel8_mc10_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3343 SET_QPEL_FUNC(qpel_pixels_tab[1][ 2], qpel8_mc20_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3344 SET_QPEL_FUNC(qpel_pixels_tab[1][ 3], qpel8_mc30_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3345 SET_QPEL_FUNC(qpel_pixels_tab[1][ 4], qpel8_mc01_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3346 SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3347 SET_QPEL_FUNC(qpel_pixels_tab[1][ 6], qpel8_mc21_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3348 SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3349 SET_QPEL_FUNC(qpel_pixels_tab[1][ 8], qpel8_mc02_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3350 SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3351 SET_QPEL_FUNC(qpel_pixels_tab[1][10], qpel8_mc22_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3352 SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3353 SET_QPEL_FUNC(qpel_pixels_tab[1][12], qpel8_mc03_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3354 SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3355 SET_QPEL_FUNC(qpel_pixels_tab[1][14], qpel8_mc23_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3356 SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_mmx2)
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
3357 #endif
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
3358
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3359 //FIXME 3dnow too
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3360 #define dspfunc(PFX, IDX, NUM) \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3361 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3362 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3363 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3364 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3365 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3366 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3367 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3368 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3369 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3370 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3371 c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3372 c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3373 c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3374 c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3375 c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3376 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_mmx2
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3377
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3378 dspfunc(put_h264_qpel, 0, 16);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3379 dspfunc(put_h264_qpel, 1, 8);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3380 dspfunc(put_h264_qpel, 2, 4);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3381 dspfunc(avg_h264_qpel, 0, 16);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3382 dspfunc(avg_h264_qpel, 1, 8);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3383 dspfunc(avg_h264_qpel, 2, 4);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3384 #undef dspfunc
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3385
2633
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
3386 c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_mmx2;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
3387 c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_mmx2;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
3388 c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_mmx2;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
3389 c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_mmx2;
72e6ffa1f3a5 MMX for H.264 deblocking filter
lorenm
parents: 2505
diff changeset
3390
1686
68abbec33289 Here are juste two added #ifdef CONFIG_ENCODERS to allow
michael
parents: 1648
diff changeset
3391 #ifdef CONFIG_ENCODERS
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
3392 c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2;
1686
68abbec33289 Here are juste two added #ifdef CONFIG_ENCODERS to allow
michael
parents: 1648
diff changeset
3393 #endif //CONFIG_ENCODERS
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3394 } else if (mm_flags & MM_3DNOW) {
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3395 c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3396 c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow;
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
3397
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3398 c->avg_pixels_tab[0][0] = avg_pixels16_3dnow;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3399 c->avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3400 c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3401
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3402 c->put_pixels_tab[1][1] = put_pixels8_x2_3dnow;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3403 c->put_pixels_tab[1][2] = put_pixels8_y2_3dnow;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3404
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3405 c->avg_pixels_tab[1][0] = avg_pixels8_3dnow;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3406 c->avg_pixels_tab[1][1] = avg_pixels8_x2_3dnow;
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3407 c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3408
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3409 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3410 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3411 c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3412 c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3413 c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3414 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3415 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3416 }
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
3417
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3418 SET_QPEL_FUNC(qpel_pixels_tab[0][ 0], qpel16_mc00_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3419 SET_QPEL_FUNC(qpel_pixels_tab[0][ 1], qpel16_mc10_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3420 SET_QPEL_FUNC(qpel_pixels_tab[0][ 2], qpel16_mc20_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3421 SET_QPEL_FUNC(qpel_pixels_tab[0][ 3], qpel16_mc30_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3422 SET_QPEL_FUNC(qpel_pixels_tab[0][ 4], qpel16_mc01_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3423 SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3424 SET_QPEL_FUNC(qpel_pixels_tab[0][ 6], qpel16_mc21_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3425 SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3426 SET_QPEL_FUNC(qpel_pixels_tab[0][ 8], qpel16_mc02_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3427 SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3428 SET_QPEL_FUNC(qpel_pixels_tab[0][10], qpel16_mc22_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3429 SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3430 SET_QPEL_FUNC(qpel_pixels_tab[0][12], qpel16_mc03_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3431 SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3432 SET_QPEL_FUNC(qpel_pixels_tab[0][14], qpel16_mc23_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3433 SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3434 SET_QPEL_FUNC(qpel_pixels_tab[1][ 0], qpel8_mc00_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3435 SET_QPEL_FUNC(qpel_pixels_tab[1][ 1], qpel8_mc10_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3436 SET_QPEL_FUNC(qpel_pixels_tab[1][ 2], qpel8_mc20_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3437 SET_QPEL_FUNC(qpel_pixels_tab[1][ 3], qpel8_mc30_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3438 SET_QPEL_FUNC(qpel_pixels_tab[1][ 4], qpel8_mc01_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3439 SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3440 SET_QPEL_FUNC(qpel_pixels_tab[1][ 6], qpel8_mc21_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3441 SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3442 SET_QPEL_FUNC(qpel_pixels_tab[1][ 8], qpel8_mc02_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3443 SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3444 SET_QPEL_FUNC(qpel_pixels_tab[1][10], qpel8_mc22_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3445 SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3446 SET_QPEL_FUNC(qpel_pixels_tab[1][12], qpel8_mc03_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3447 SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3448 SET_QPEL_FUNC(qpel_pixels_tab[1][14], qpel8_mc23_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3449 SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_3dnow)
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3450
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3451 #define dspfunc(PFX, IDX, NUM) \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3452 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3453 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3454 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3455 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3456 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3457 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3458 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3459 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3460 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3461 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3462 c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3463 c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3464 c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3465 c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3466 c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3467 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_3dnow
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3468
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3469 dspfunc(put_h264_qpel, 0, 16);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3470 dspfunc(put_h264_qpel, 1, 8);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3471 dspfunc(put_h264_qpel, 2, 4);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3472 dspfunc(avg_h264_qpel, 0, 16);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3473 dspfunc(avg_h264_qpel, 1, 8);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3474 dspfunc(avg_h264_qpel, 2, 4);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3475 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
3476 }
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3477
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3478 #ifdef CONFIG_ENCODERS
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3479 dsputil_init_pix_mmx(c, avctx);
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3480 #endif //CONFIG_ENCODERS
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3481 #if 0
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3482 // for speed testing
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3483 get_pixels = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3484 put_pixels_clamped = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3485 add_pixels_clamped = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3486
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3487 pix_abs16x16 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3488 pix_abs16x16_x2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3489 pix_abs16x16_y2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3490 pix_abs16x16_xy2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3491
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3492 put_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3493 put_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3494 put_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3495 put_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3496
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3497 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
3498 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
3499 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
3500 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
3501
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3502 avg_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3503 avg_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3504 avg_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3505 avg_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3506
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3507 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
3508 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
3509 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
3510 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
3511
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3512 //av_fdct = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3513 //ff_idct = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3514 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3515 }