annotate i386/dsputil_mmx.c @ 2237:d43321e67acd libavcodec

(non)interlaced huffyuv patch by (Loren Merritt <lorenm at u dot washington dot edu>)
author michael
date Fri, 17 Sep 2004 10:57:57 +0000
parents 9492be49de46
children 7e0b2e86afa9
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;
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
42 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
43 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
44 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
45 static const uint64_t ff_pw_15 attribute_used __attribute__ ((aligned(8))) = 0x000F000F000F000FULL;
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
46
1845
3054613980a8 attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents: 1784
diff changeset
47 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
48
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
49 #define JUMPALIGN() __asm __volatile (".balign 8"::)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
50 #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
51
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
52 #define MOVQ_WONE(regd) \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
53 __asm __volatile ( \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
54 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
55 "psrlw $15, %%" #regd ::)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
56
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
57 #define MOVQ_BFE(regd) \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
58 __asm __volatile ( \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
59 "pcmpeqd %%" #regd ", %%" #regd " \n\t"\
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
60 "paddb %%" #regd ", %%" #regd " \n\t" ::)
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
61
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
62 #ifndef PIC
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
63 #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
64 #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
65 #else
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
66 // 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
67 // pcmpeqd -> -1
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
68 #define MOVQ_BONE(regd) \
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
69 __asm __volatile ( \
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
70 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
71 "psrlw $15, %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
72 "packuswb %%" #regd ", %%" #regd " \n\t" ::)
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
73
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
74 #define MOVQ_WTWO(regd) \
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
75 __asm __volatile ( \
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
76 "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
77 "psrlw $15, %%" #regd " \n\t" \
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
78 "psllw $1, %%" #regd " \n\t"::)
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
79
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
80 #endif
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
81
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
82 // 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
83 // first argument is unmodifed and second is trashed
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
84 // regfe is supposed to contain 0xfefefefefefefefe
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
85 #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
86 "movq " #rega ", " #regr " \n\t"\
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
87 "pand " #regb ", " #regr " \n\t"\
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
88 "pxor " #rega ", " #regb " \n\t"\
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
89 "pand " #regfe "," #regb " \n\t"\
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
90 "psrlq $1, " #regb " \n\t"\
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
91 "paddb " #regb ", " #regr " \n\t"
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
92
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
93 #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
94 "movq " #rega ", " #regr " \n\t"\
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
95 "por " #regb ", " #regr " \n\t"\
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
96 "pxor " #rega ", " #regb " \n\t"\
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
97 "pand " #regfe "," #regb " \n\t"\
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
98 "psrlq $1, " #regb " \n\t"\
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
99 "psubb " #regb ", " #regr " \n\t"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
100
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
101 // mm6 is supposed to contain 0xfefefefefefefefe
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
102 #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
103 "movq " #rega ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
104 "movq " #regc ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
105 "pand " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
106 "pand " #regd ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
107 "pxor " #rega ", " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
108 "pxor " #regc ", " #regd " \n\t"\
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
109 "pand %%mm6, " #regb " \n\t"\
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
110 "pand %%mm6, " #regd " \n\t"\
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
111 "psrlq $1, " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
112 "psrlq $1, " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
113 "paddb " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
114 "paddb " #regd ", " #regp " \n\t"
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
115
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
116 #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
117 "movq " #rega ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
118 "movq " #regc ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
119 "por " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
120 "por " #regd ", " #regp " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
121 "pxor " #rega ", " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
122 "pxor " #regc ", " #regd " \n\t"\
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
123 "pand %%mm6, " #regb " \n\t"\
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
124 "pand %%mm6, " #regd " \n\t"\
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
125 "psrlq $1, " #regd " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
126 "psrlq $1, " #regb " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
127 "psubb " #regb ", " #regr " \n\t"\
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
128 "psubb " #regd ", " #regp " \n\t"
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
129
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
130 /***********************************/
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
131 /* MMX no rounding */
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
132 #define DEF(x, y) x ## _no_rnd_ ## y ##_mmx
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
133 #define SET_RND MOVQ_WONE
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
134 #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
135 #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
136
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
137 #include "dsputil_mmx_rnd.h"
444
a5edef76dac6 * new mmx code - based upon http://aggregate.org/MAGIC
kabi
parents: 438
diff changeset
138
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
139 #undef DEF
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
140 #undef SET_RND
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
141 #undef PAVGBP
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
142 #undef PAVGB
445
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
143 /***********************************/
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
144 /* MMX rounding */
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
145
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
146 #define DEF(x, y) x ## _ ## y ##_mmx
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
147 #define SET_RND MOVQ_WTWO
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
148 #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
149 #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
150
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
151 #include "dsputil_mmx_rnd.h"
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
152
62c01dbdc1e0 * code with new PAVGB for MMX only CPU splited into separate file
kabi
parents: 444
diff changeset
153 #undef DEF
448
e8c8ca9106aa * removed MANGLE from macros for setting constants
kabi
parents: 446
diff changeset
154 #undef SET_RND
446
efe0c0d40577 * reenabled original xy2 put routine - rounding error is really bad with
kabi
parents: 445
diff changeset
155 #undef PAVGBP
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
156 #undef PAVGB
387
b8f3affeb8e1 shared lib support (req by kabi) ...
michaelni
parents: 386
diff changeset
157
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
158 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
159 /* 3Dnow specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
160
986e461dc072 Initial revision
glantau
parents:
diff changeset
161 #define DEF(x) x ## _3dnow
986e461dc072 Initial revision
glantau
parents:
diff changeset
162 /* for Athlons PAVGUSB is prefered */
986e461dc072 Initial revision
glantau
parents:
diff changeset
163 #define PAVGB "pavgusb"
986e461dc072 Initial revision
glantau
parents:
diff changeset
164
986e461dc072 Initial revision
glantau
parents:
diff changeset
165 #include "dsputil_mmx_avg.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
166
986e461dc072 Initial revision
glantau
parents:
diff changeset
167 #undef DEF
986e461dc072 Initial revision
glantau
parents:
diff changeset
168 #undef PAVGB
986e461dc072 Initial revision
glantau
parents:
diff changeset
169
986e461dc072 Initial revision
glantau
parents:
diff changeset
170 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
171 /* MMX2 specific */
986e461dc072 Initial revision
glantau
parents:
diff changeset
172
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
173 #define DEF(x) x ## _mmx2
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
174
986e461dc072 Initial revision
glantau
parents:
diff changeset
175 /* Introduced only in MMX2 set */
986e461dc072 Initial revision
glantau
parents:
diff changeset
176 #define PAVGB "pavgb"
986e461dc072 Initial revision
glantau
parents:
diff changeset
177
986e461dc072 Initial revision
glantau
parents:
diff changeset
178 #include "dsputil_mmx_avg.h"
986e461dc072 Initial revision
glantau
parents:
diff changeset
179
986e461dc072 Initial revision
glantau
parents:
diff changeset
180 #undef DEF
986e461dc072 Initial revision
glantau
parents:
diff changeset
181 #undef PAVGB
986e461dc072 Initial revision
glantau
parents:
diff changeset
182
986e461dc072 Initial revision
glantau
parents:
diff changeset
183 /***********************************/
986e461dc072 Initial revision
glantau
parents:
diff changeset
184 /* standard MMX */
986e461dc072 Initial revision
glantau
parents:
diff changeset
185
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
186 #ifdef CONFIG_ENCODERS
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
187 static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
188 {
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
189 asm volatile(
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
190 "movl $-128, %%eax \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
191 "pxor %%mm7, %%mm7 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
192 ".balign 16 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
193 "1: \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
194 "movq (%0), %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
195 "movq (%0, %2), %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
196 "movq %%mm0, %%mm1 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
197 "movq %%mm2, %%mm3 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
198 "punpcklbw %%mm7, %%mm0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
199 "punpckhbw %%mm7, %%mm1 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
200 "punpcklbw %%mm7, %%mm2 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
201 "punpckhbw %%mm7, %%mm3 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
202 "movq %%mm0, (%1, %%eax)\n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
203 "movq %%mm1, 8(%1, %%eax)\n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
204 "movq %%mm2, 16(%1, %%eax)\n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
205 "movq %%mm3, 24(%1, %%eax)\n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
206 "addl %3, %0 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
207 "addl $32, %%eax \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
208 "js 1b \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
209 : "+r" (pixels)
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
210 : "r" (block+64), "r" (line_size), "r" (line_size*2)
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
211 : "%eax"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
212 );
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
213 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
214
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
215 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
216 {
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
217 asm volatile(
386
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
218 "pxor %%mm7, %%mm7 \n\t"
f49629bab18d hopefully faster mmx2&3dnow MC
michaelni
parents: 342
diff changeset
219 "movl $-128, %%eax \n\t"
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
220 ".balign 16 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
221 "1: \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
222 "movq (%0), %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
223 "movq (%1), %%mm2 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
224 "movq %%mm0, %%mm1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
225 "movq %%mm2, %%mm3 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
226 "punpcklbw %%mm7, %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
227 "punpckhbw %%mm7, %%mm1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
228 "punpcklbw %%mm7, %%mm2 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
229 "punpckhbw %%mm7, %%mm3 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
230 "psubw %%mm2, %%mm0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
231 "psubw %%mm3, %%mm1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
232 "movq %%mm0, (%2, %%eax)\n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
233 "movq %%mm1, 8(%2, %%eax)\n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
234 "addl %3, %0 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
235 "addl %3, %1 \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
236 "addl $16, %%eax \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
237 "jnz 1b \n\t"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
238 : "+r" (s1), "+r" (s2)
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
239 : "r" (block+64), "r" (stride)
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
240 : "%eax"
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
241 );
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
242 }
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
243 #endif //CONFIG_ENCODERS
324
9c6f056f0e41 fixed mpeg4 time stuff on encoding
michaelni
parents: 296
diff changeset
244
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
245 void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
246 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
247 const DCTELEM *p;
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
248 uint8_t *pix;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
249
986e461dc072 Initial revision
glantau
parents:
diff changeset
250 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
251 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
252 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
253 /* unrolled loop */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
254 __asm __volatile(
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
255 "movq %3, %%mm0\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
256 "movq 8%3, %%mm1\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
257 "movq 16%3, %%mm2\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
258 "movq 24%3, %%mm3\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
259 "movq 32%3, %%mm4\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
260 "movq 40%3, %%mm5\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
261 "movq 48%3, %%mm6\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
262 "movq 56%3, %%mm7\n\t"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
263 "packuswb %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
264 "packuswb %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
265 "packuswb %%mm5, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
266 "packuswb %%mm7, %%mm6\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
267 "movq %%mm0, (%0)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
268 "movq %%mm2, (%0, %1)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
269 "movq %%mm4, (%0, %1, 2)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
270 "movq %%mm6, (%0, %2)\n\t"
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
271 ::"r" (pix), "r" (line_size), "r" (line_size*3), "m"(*p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
272 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
273 pix += line_size*4;
986e461dc072 Initial revision
glantau
parents:
diff changeset
274 p += 32;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
275
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
276 // 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
277 // compiler would generate some very strange code
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
278 // thus using "r"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
279 __asm __volatile(
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
280 "movq (%3), %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
281 "movq 8(%3), %%mm1\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
282 "movq 16(%3), %%mm2\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
283 "movq 24(%3), %%mm3\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
284 "movq 32(%3), %%mm4\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
285 "movq 40(%3), %%mm5\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
286 "movq 48(%3), %%mm6\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
287 "movq 56(%3), %%mm7\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
288 "packuswb %%mm1, %%mm0\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
289 "packuswb %%mm3, %%mm2\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
290 "packuswb %%mm5, %%mm4\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
291 "packuswb %%mm7, %%mm6\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
292 "movq %%mm0, (%0)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
293 "movq %%mm2, (%0, %1)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
294 "movq %%mm4, (%0, %1, 2)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
295 "movq %%mm6, (%0, %2)\n\t"
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
296 ::"r" (pix), "r" (line_size), "r" (line_size*3), "r"(p)
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
297 :"memory");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
298 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
299
1985
b2bc62fdecc0 move the 0x80 vector outside of the function, thus saving the compiler
melanson
parents: 1984
diff changeset
300 static unsigned char __align8 vector128[8] =
b2bc62fdecc0 move the 0x80 vector outside of the function, thus saving the compiler
melanson
parents: 1984
diff changeset
301 { 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
302
1984
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
303 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
304 {
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
305 int i;
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
306
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
307 movq_m2r(*vector128, mm1);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
308 for (i = 0; i < 8; i++) {
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
309 movq_m2r(*(block), mm0);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
310 packsswb_m2r(*(block + 4), mm0);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
311 block += 8;
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
312 paddb_r2r(mm1, mm0);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
313 movq_r2m(mm0, *pixels);
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
314 pixels += line_size;
ef919e9ef73e separate out put_signed_pixels_clamped() into its own function and
melanson
parents: 1977
diff changeset
315 }
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
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
318 void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
319 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
320 const DCTELEM *p;
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
321 uint8_t *pix;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
322 int i;
986e461dc072 Initial revision
glantau
parents:
diff changeset
323
986e461dc072 Initial revision
glantau
parents:
diff changeset
324 /* read the pixels */
986e461dc072 Initial revision
glantau
parents:
diff changeset
325 p = block;
986e461dc072 Initial revision
glantau
parents:
diff changeset
326 pix = pixels;
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
327 MOVQ_ZERO(mm7);
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
328 i = 4;
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
329 do {
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
330 __asm __volatile(
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
331 "movq (%2), %%mm0\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
332 "movq 8(%2), %%mm1\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
333 "movq 16(%2), %%mm2\n\t"
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
334 "movq 24(%2), %%mm3\n\t"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
335 "movq %0, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
336 "movq %1, %%mm6\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
337 "movq %%mm4, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
338 "punpcklbw %%mm7, %%mm4\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
339 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
340 "paddsw %%mm4, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
341 "paddsw %%mm5, %%mm1\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
342 "movq %%mm6, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
343 "punpcklbw %%mm7, %%mm6\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
344 "punpckhbw %%mm7, %%mm5\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
345 "paddsw %%mm6, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
346 "paddsw %%mm5, %%mm3\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
347 "packuswb %%mm1, %%mm0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
348 "packuswb %%mm3, %%mm2\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
349 "movq %%mm0, %0\n\t"
986e461dc072 Initial revision
glantau
parents:
diff changeset
350 "movq %%mm2, %1\n\t"
151
ae0516eadae2 fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents: 42
diff changeset
351 :"+m"(*pix), "+m"(*(pix+line_size))
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
352 :"r"(p)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
353 :"memory");
986e461dc072 Initial revision
glantau
parents:
diff changeset
354 pix += line_size*2;
986e461dc072 Initial revision
glantau
parents:
diff changeset
355 p += 16;
342
8635a7036395 * fixes problem with -funroll-loops and buggy gcc compiler
kabi
parents: 324
diff changeset
356 } while (--i);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
357 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
358
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
359 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
360 {
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
361 __asm __volatile(
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
362 "lea (%3, %3), %%eax \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
363 ".balign 8 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
364 "1: \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
365 "movd (%1), %%mm0 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
366 "movd (%1, %3), %%mm1 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
367 "movd %%mm0, (%2) \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
368 "movd %%mm1, (%2, %3) \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
369 "addl %%eax, %1 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
370 "addl %%eax, %2 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
371 "movd (%1), %%mm0 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
372 "movd (%1, %3), %%mm1 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
373 "movd %%mm0, (%2) \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
374 "movd %%mm1, (%2, %3) \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
375 "addl %%eax, %1 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
376 "addl %%eax, %2 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
377 "subl $4, %0 \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
378 "jnz 1b \n\t"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
379 : "+g"(h), "+r" (pixels), "+r" (block)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
380 : "r"(line_size)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
381 : "%eax", "memory"
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
382 );
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
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
385 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
386 {
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
387 __asm __volatile(
420
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
388 "lea (%3, %3), %%eax \n\t"
422
aa4a1c6209bd * baling 8 seems to have the same speed
kabi
parents: 421
diff changeset
389 ".balign 8 \n\t"
420
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
390 "1: \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
391 "movq (%1), %%mm0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
392 "movq (%1, %3), %%mm1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
393 "movq %%mm0, (%2) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
394 "movq %%mm1, (%2, %3) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
395 "addl %%eax, %1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
396 "addl %%eax, %2 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
397 "movq (%1), %%mm0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
398 "movq (%1, %3), %%mm1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
399 "movq %%mm0, (%2) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
400 "movq %%mm1, (%2, %3) \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
401 "addl %%eax, %1 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
402 "addl %%eax, %2 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
403 "subl $4, %0 \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
404 "jnz 1b \n\t"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
405 : "+g"(h), "+r" (pixels), "+r" (block)
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
406 : "r"(line_size)
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
407 : "%eax", "memory"
bbaf743f353f * cleanup for put_pixels_mmx
kabi
parents: 418
diff changeset
408 );
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
409 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
410
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
411 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
412 {
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
413 __asm __volatile(
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
414 "lea (%3, %3), %%eax \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
415 ".balign 8 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
416 "1: \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
417 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
418 "movq 8(%1), %%mm4 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
419 "movq (%1, %3), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
420 "movq 8(%1, %3), %%mm5 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
421 "movq %%mm0, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
422 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
423 "movq %%mm1, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
424 "movq %%mm5, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
425 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
426 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
427 "movq (%1), %%mm0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
428 "movq 8(%1), %%mm4 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
429 "movq (%1, %3), %%mm1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
430 "movq 8(%1, %3), %%mm5 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
431 "movq %%mm0, (%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
432 "movq %%mm4, 8(%2) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
433 "movq %%mm1, (%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
434 "movq %%mm5, 8(%2, %3) \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
435 "addl %%eax, %1 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
436 "addl %%eax, %2 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
437 "subl $4, %0 \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
438 "jnz 1b \n\t"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
439 : "+g"(h), "+r" (pixels), "+r" (block)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
440 : "r"(line_size)
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
441 : "%eax", "memory"
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
442 );
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
443 }
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
444
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
445 static void clear_blocks_mmx(DCTELEM *blocks)
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
446 {
471
d7f65ea52aaa * reimplemented remaing avg_ pixel functions
kabi
parents: 448
diff changeset
447 __asm __volatile(
296
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
448 "pxor %%mm7, %%mm7 \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
449 "movl $-128*6, %%eax \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
450 "1: \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
451 "movq %%mm7, (%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
452 "movq %%mm7, 8(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
453 "movq %%mm7, 16(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
454 "movq %%mm7, 24(%0, %%eax) \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
455 "addl $32, %%eax \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
456 " js 1b \n\t"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
457 : : "r" (((int)blocks)+128*6)
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
458 : "%eax"
c1a8a1b4a24b sizeof(s->block) isnt 64*6*2 anymore bugfix
michaelni
parents: 294
diff changeset
459 );
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
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
462 #ifdef CONFIG_ENCODERS
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
463 static int pix_sum16_mmx(uint8_t * pix, int line_size){
688
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
464 const int h=16;
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
465 int sum;
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
466 int index= -line_size*h;
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
467
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
468 __asm __volatile(
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
469 "pxor %%mm7, %%mm7 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
470 "pxor %%mm6, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
471 "1: \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
472 "movq (%2, %1), %%mm0 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
473 "movq (%2, %1), %%mm1 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
474 "movq 8(%2, %1), %%mm2 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
475 "movq 8(%2, %1), %%mm3 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
476 "punpcklbw %%mm7, %%mm0 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
477 "punpckhbw %%mm7, %%mm1 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
478 "punpcklbw %%mm7, %%mm2 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
479 "punpckhbw %%mm7, %%mm3 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
480 "paddw %%mm0, %%mm1 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
481 "paddw %%mm2, %%mm3 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
482 "paddw %%mm1, %%mm3 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
483 "paddw %%mm3, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
484 "addl %3, %1 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
485 " js 1b \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
486 "movq %%mm6, %%mm5 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
487 "psrlq $32, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
488 "paddw %%mm5, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
489 "movq %%mm6, %%mm5 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
490 "psrlq $16, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
491 "paddw %%mm5, %%mm6 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
492 "movd %%mm6, %0 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
493 "andl $0xFFFF, %0 \n\t"
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
494 : "=&r" (sum), "+r" (index)
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
495 : "r" (pix - index), "r" (line_size)
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
496 );
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
497
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
498 return sum;
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
499 }
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
500 #endif //CONFIG_ENCODERS
688
894b61908734 pix_sum16_mmx()
michaelni
parents: 651
diff changeset
501
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
502 static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
503 int i=0;
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
504 asm volatile(
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
505 "1: \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
506 "movq (%1, %0), %%mm0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
507 "movq (%2, %0), %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
508 "paddb %%mm0, %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
509 "movq %%mm1, (%2, %0) \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
510 "movq 8(%1, %0), %%mm0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
511 "movq 8(%2, %0), %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
512 "paddb %%mm0, %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
513 "movq %%mm1, 8(%2, %0) \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
514 "addl $16, %0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
515 "cmpl %3, %0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
516 " jb 1b \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
517 : "+r" (i)
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
518 : "r"(src), "r"(dst), "r"(w-15)
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
519 );
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
520 for(; i<w; i++)
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
521 dst[i+0] += src[i+0];
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
522 }
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
523
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
524 #define H263_LOOP_FILTER \
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
525 "pxor %%mm7, %%mm7 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
526 "movq %0, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
527 "movq %0, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
528 "movq %3, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
529 "movq %3, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
530 "punpcklbw %%mm7, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
531 "punpckhbw %%mm7, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
532 "punpcklbw %%mm7, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
533 "punpckhbw %%mm7, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
534 "psubw %%mm2, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
535 "psubw %%mm3, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
536 "movq %1, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
537 "movq %1, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
538 "movq %2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
539 "movq %2, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
540 "punpcklbw %%mm7, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
541 "punpckhbw %%mm7, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
542 "punpcklbw %%mm7, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
543 "punpckhbw %%mm7, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
544 "psubw %%mm2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
545 "psubw %%mm3, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
546 "psllw $2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
547 "psllw $2, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
548 "paddw %%mm0, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
549 "paddw %%mm1, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
550 "pxor %%mm6, %%mm6 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
551 "pcmpgtw %%mm4, %%mm6 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
552 "pcmpgtw %%mm5, %%mm7 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
553 "pxor %%mm6, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
554 "pxor %%mm7, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
555 "psubw %%mm6, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
556 "psubw %%mm7, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
557 "psrlw $3, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
558 "psrlw $3, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
559 "packuswb %%mm5, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
560 "packsswb %%mm7, %%mm6 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
561 "pxor %%mm7, %%mm7 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
562 "movd %4, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
563 "punpcklbw %%mm2, %%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 "psubusb %%mm4, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
567 "movq %%mm2, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
568 "psubusb %%mm4, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
569 "psubb %%mm3, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
570 "movq %1, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
571 "movq %2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
572 "pxor %%mm6, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
573 "pxor %%mm6, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
574 "paddusb %%mm2, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
575 "psubusb %%mm2, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
576 "pxor %%mm6, %%mm3 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
577 "pxor %%mm6, %%mm4 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
578 "paddusb %%mm2, %%mm2 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
579 "packsswb %%mm1, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
580 "pcmpgtb %%mm0, %%mm7 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
581 "pxor %%mm7, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
582 "psubb %%mm7, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
583 "movq %%mm0, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
584 "psubusb %%mm2, %%mm0 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
585 "psubb %%mm0, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
586 "pand %5, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
587 "psrlw $2, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
588 "pxor %%mm7, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
589 "psubb %%mm7, %%mm1 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
590 "movq %0, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
591 "movq %3, %%mm6 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
592 "psubb %%mm1, %%mm5 \n\t"\
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
593 "paddb %%mm1, %%mm6 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
594
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
595 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
596 const int strength= ff_h263_loop_filter_strength[qscale];
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
597
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
598 asm volatile(
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
599
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
600 H263_LOOP_FILTER
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
601
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
602 "movq %%mm3, %1 \n\t"
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
603 "movq %%mm4, %2 \n\t"
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
604 "movq %%mm5, %0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
605 "movq %%mm6, %3 \n\t"
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
606 : "+m" (*(uint64_t*)(src - 2*stride)),
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
607 "+m" (*(uint64_t*)(src - 1*stride)),
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
608 "+m" (*(uint64_t*)(src + 0*stride)),
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
609 "+m" (*(uint64_t*)(src + 1*stride))
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
610 : "g" (2*strength), "m"(ff_pb_FC)
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
611 );
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
612 }
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
613
1648
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
614 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
615 asm volatile( //FIXME could save 1 instruction if done as 8x4 ...
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
616 "movd %4, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
617 "movd %5, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
618 "movd %6, %%mm2 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
619 "movd %7, %%mm3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
620 "punpcklbw %%mm1, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
621 "punpcklbw %%mm3, %%mm2 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
622 "movq %%mm0, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
623 "punpcklwd %%mm2, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
624 "punpckhwd %%mm2, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
625 "movd %%mm0, %0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
626 "punpckhdq %%mm0, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
627 "movd %%mm0, %1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
628 "movd %%mm1, %2 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
629 "punpckhdq %%mm1, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
630 "movd %%mm1, %3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
631
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
632 : "=m" (*(uint32_t*)(dst + 0*dst_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
633 "=m" (*(uint32_t*)(dst + 1*dst_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
634 "=m" (*(uint32_t*)(dst + 2*dst_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
635 "=m" (*(uint32_t*)(dst + 3*dst_stride))
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
636 : "m" (*(uint32_t*)(src + 0*src_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
637 "m" (*(uint32_t*)(src + 1*src_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
638 "m" (*(uint32_t*)(src + 2*src_stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
639 "m" (*(uint32_t*)(src + 3*src_stride))
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
640 );
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 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
644 const int strength= ff_h263_loop_filter_strength[qscale];
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
645 uint64_t temp[4] __attribute__ ((aligned(8)));
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
646 uint8_t *btemp= (uint8_t*)temp;
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
647
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
648 src -= 2;
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
649
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
650 transpose4x4(btemp , src , 8, stride);
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
651 transpose4x4(btemp+4, src + 4*stride, 8, stride);
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
652 asm volatile(
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
653 H263_LOOP_FILTER // 5 3 4 6
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
654
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
655 : "+m" (temp[0]),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
656 "+m" (temp[1]),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
657 "+m" (temp[2]),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
658 "+m" (temp[3])
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
659 : "g" (2*strength), "m"(ff_pb_FC)
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
660 );
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
661
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
662 asm volatile(
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
663 "movq %%mm5, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
664 "movq %%mm4, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
665 "punpcklbw %%mm3, %%mm5 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
666 "punpcklbw %%mm6, %%mm4 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
667 "punpckhbw %%mm3, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
668 "punpckhbw %%mm6, %%mm0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
669 "movq %%mm5, %%mm3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
670 "movq %%mm1, %%mm6 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
671 "punpcklwd %%mm4, %%mm5 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
672 "punpcklwd %%mm0, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
673 "punpckhwd %%mm4, %%mm3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
674 "punpckhwd %%mm0, %%mm6 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
675 "movd %%mm5, %0 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
676 "punpckhdq %%mm5, %%mm5 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
677 "movd %%mm5, %1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
678 "movd %%mm3, %2 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
679 "punpckhdq %%mm3, %%mm3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
680 "movd %%mm3, %3 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
681 "movd %%mm1, %4 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
682 "punpckhdq %%mm1, %%mm1 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
683 "movd %%mm1, %5 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
684 "movd %%mm6, %6 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
685 "punpckhdq %%mm6, %%mm6 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
686 "movd %%mm6, %7 \n\t"
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
687 : "=m" (*(uint32_t*)(src + 0*stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
688 "=m" (*(uint32_t*)(src + 1*stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
689 "=m" (*(uint32_t*)(src + 2*stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
690 "=m" (*(uint32_t*)(src + 3*stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
691 "=m" (*(uint32_t*)(src + 4*stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
692 "=m" (*(uint32_t*)(src + 5*stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
693 "=m" (*(uint32_t*)(src + 6*stride)),
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
694 "=m" (*(uint32_t*)(src + 7*stride))
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
695 );
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
696 }
de28264c3dc3 h263_h_loop_filter_mmx
michael
parents: 1647
diff changeset
697
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
698 #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
699 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
700 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
701 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
702 "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
703 "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
704 "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
705 "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
706 "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
707 "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
708
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
709 "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
710
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
711 "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
712 "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
713
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
714 "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
715 "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
716 "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
717
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
718 "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
719 "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
720
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
721 "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
722 "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
723
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
724 "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
725 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
726 "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
727 "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
728
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
729 "addl %2, %0\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
730 "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
731 "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
732 "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
733
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
734 "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
735 "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
736 "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
737 "movd %%mm1,%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
738 : "+r" (pix), "=r"(tmp) : "r" (line_size) : "%ecx" );
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
739 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
740 }
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
741
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
742 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
743 int tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
744 asm volatile (
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
745 "movl %4,%%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
746 "pxor %%mm0,%%mm0\n" /* mm0 = 0 */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
747 "pxor %%mm7,%%mm7\n" /* mm7 holds the sum */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
748 "1:\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
749 "movq (%0),%%mm1\n" /* mm1 = pix1[0-7] */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
750 "movq (%1),%%mm2\n" /* mm2 = pix2[0-7] */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
751
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
752 "movq %%mm1,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
753 "psubusb %%mm2,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
754 "psubusb %%mm5,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
755
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
756 "por %%mm1,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
757
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
758 "movq %%mm2,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
759
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
760 "punpckhbw %%mm0,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
761 "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
762
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
763 "pmaddwd %%mm2,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
764 "pmaddwd %%mm1,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
765
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
766 "addl %3,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
767 "addl %3,%1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
768
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
769 "paddd %%mm2,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
770 "paddd %%mm1,%%mm7\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
771
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
772 "decl %%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
773 "jnz 1b\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
774
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
775 "movq %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
776 "psrlq $32, %%mm7\n" /* shift hi dword to lo */
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
777 "paddd %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
778 "movd %%mm1,%2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
779 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
780 : "r" (line_size) , "m" (h)
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
781 : "%ecx");
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
782 return tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
783 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
784
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
785 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
786 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
787 asm volatile (
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
788 "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
789 "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
790 "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
791 "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
792 "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
793 "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
794 "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
795 "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
796
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
797 /* 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
798 /* 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
799 /* 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
800 "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
801 "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
802 "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
803 "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
804 "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
805 "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
806
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
807 "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
808 "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
809
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
810 /* 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
811 "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
812 "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
813
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
814 "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
815 "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
816 "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
817 "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
818
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
819 "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
820 "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
821 "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
822 "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
823
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
824 "addl %3,%0\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
825 "addl %3,%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
826
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
827 "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
828 "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
829 "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
830 "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
831
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
832 "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
833 "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
834
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
835 "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
836 "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
837 "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
838 "movd %%mm1,%2\n"
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
839 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
840 : "r" (line_size) , "m" (h)
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
841 : "%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
842 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
843 }
4dfe15ae0078 sse16 & pix_norm1 optimization patch by (Felix von Leitner <felix-ffmpeg at fefe dot de>) (with some modifications)
michaelni
parents: 984
diff changeset
844
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
845 static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) {
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
846 int tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
847 asm volatile (
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
848 "movl %3,%%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
849 "pxor %%mm7,%%mm7\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
850 "pxor %%mm6,%%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
851
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
852 "movq (%0),%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
853 "movq %%mm0, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
854 "psllq $8, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
855 "psrlq $8, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
856 "psrlq $8, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
857 "movq %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
858 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
859 "punpcklbw %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
860 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
861 "punpckhbw %%mm7,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
862 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
863 "psubw %%mm1, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
864 "psubw %%mm3, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
865
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
866 "addl %2,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
867
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
868 "movq (%0),%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
869 "movq %%mm4, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
870 "psllq $8, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
871 "psrlq $8, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
872 "psrlq $8, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
873 "movq %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
874 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
875 "punpcklbw %%mm7,%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
876 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
877 "punpckhbw %%mm7,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
878 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
879 "psubw %%mm1, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
880 "psubw %%mm3, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
881 "psubw %%mm4, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
882 "psubw %%mm5, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
883 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
884 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
885 "pcmpgtw %%mm0, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
886 "pcmpgtw %%mm2, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
887 "pxor %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
888 "pxor %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
889 "psubw %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
890 "psubw %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
891 "paddw %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
892 "paddw %%mm2, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
893
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
894 "addl %2,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
895 "1:\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
896
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
897 "movq (%0),%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
898 "movq %%mm0, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
899 "psllq $8, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
900 "psrlq $8, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
901 "psrlq $8, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
902 "movq %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
903 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
904 "punpcklbw %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
905 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
906 "punpckhbw %%mm7,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
907 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
908 "psubw %%mm1, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
909 "psubw %%mm3, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
910 "psubw %%mm0, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
911 "psubw %%mm2, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
912 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
913 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
914 "pcmpgtw %%mm4, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
915 "pcmpgtw %%mm5, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
916 "pxor %%mm3, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
917 "pxor %%mm1, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
918 "psubw %%mm3, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
919 "psubw %%mm1, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
920 "paddw %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
921 "paddw %%mm5, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
922
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
923 "addl %2,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
924
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
925 "movq (%0),%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
926 "movq %%mm4, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
927 "psllq $8, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
928 "psrlq $8, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
929 "psrlq $8, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
930 "movq %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
931 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
932 "punpcklbw %%mm7,%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
933 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
934 "punpckhbw %%mm7,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
935 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
936 "psubw %%mm1, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
937 "psubw %%mm3, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
938 "psubw %%mm4, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
939 "psubw %%mm5, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
940 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
941 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
942 "pcmpgtw %%mm0, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
943 "pcmpgtw %%mm2, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
944 "pxor %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
945 "pxor %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
946 "psubw %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
947 "psubw %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
948 "paddw %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
949 "paddw %%mm2, %%mm6\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 "addl %2,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
952 "subl $2, %%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
953 " jnz 1b\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 "movq %%mm6, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
956 "punpcklwd %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
957 "punpckhwd %%mm7,%%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
958 "paddd %%mm0, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
959
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
960 "movq %%mm6,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
961 "psrlq $32, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
962 "paddd %%mm6,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
963 "movd %%mm0,%1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
964 : "+r" (pix1), "=r"(tmp)
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
965 : "r" (line_size) , "g" (h-2)
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
966 : "%ecx");
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
967 return tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
968 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
969
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
970 static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) {
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
971 int tmp;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
972 uint8_t * pix= pix1;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
973 asm volatile (
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
974 "movl %3,%%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
975 "pxor %%mm7,%%mm7\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
976 "pxor %%mm6,%%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
977
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
978 "movq (%0),%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
979 "movq 1(%0),%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
980 "movq %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
981 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
982 "punpcklbw %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
983 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
984 "punpckhbw %%mm7,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
985 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
986 "psubw %%mm1, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
987 "psubw %%mm3, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
988
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
989 "addl %2,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
990
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
991 "movq (%0),%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
992 "movq 1(%0),%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
993 "movq %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
994 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
995 "punpcklbw %%mm7,%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
996 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
997 "punpckhbw %%mm7,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
998 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
999 "psubw %%mm1, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1000 "psubw %%mm3, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1001 "psubw %%mm4, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1002 "psubw %%mm5, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1003 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1004 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1005 "pcmpgtw %%mm0, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1006 "pcmpgtw %%mm2, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1007 "pxor %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1008 "pxor %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1009 "psubw %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1010 "psubw %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1011 "paddw %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1012 "paddw %%mm2, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1013
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1014 "addl %2,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1015 "1:\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1016
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1017 "movq (%0),%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1018 "movq 1(%0),%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1019 "movq %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1020 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1021 "punpcklbw %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1022 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1023 "punpckhbw %%mm7,%%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1024 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1025 "psubw %%mm1, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1026 "psubw %%mm3, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1027 "psubw %%mm0, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1028 "psubw %%mm2, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1029 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1030 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1031 "pcmpgtw %%mm4, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1032 "pcmpgtw %%mm5, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1033 "pxor %%mm3, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1034 "pxor %%mm1, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1035 "psubw %%mm3, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1036 "psubw %%mm1, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1037 "paddw %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1038 "paddw %%mm5, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1039
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1040 "addl %2,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1041
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1042 "movq (%0),%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1043 "movq 1(%0),%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1044 "movq %%mm4, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1045 "movq %%mm1, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1046 "punpcklbw %%mm7,%%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1047 "punpcklbw %%mm7,%%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1048 "punpckhbw %%mm7,%%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1049 "punpckhbw %%mm7,%%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1050 "psubw %%mm1, %%mm4\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1051 "psubw %%mm3, %%mm5\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1052 "psubw %%mm4, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1053 "psubw %%mm5, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1054 "pxor %%mm3, %%mm3\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1055 "pxor %%mm1, %%mm1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1056 "pcmpgtw %%mm0, %%mm3\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1057 "pcmpgtw %%mm2, %%mm1\n\t"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1058 "pxor %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1059 "pxor %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1060 "psubw %%mm3, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1061 "psubw %%mm1, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1062 "paddw %%mm0, %%mm2\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1063 "paddw %%mm2, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1064
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1065 "addl %2,%0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1066 "subl $2, %%ecx\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1067 " jnz 1b\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1068
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1069 "movq %%mm6, %%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1070 "punpcklwd %%mm7,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1071 "punpckhwd %%mm7,%%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1072 "paddd %%mm0, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1073
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1074 "movq %%mm6,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1075 "psrlq $32, %%mm6\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1076 "paddd %%mm6,%%mm0\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1077 "movd %%mm0,%1\n"
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1078 : "+r" (pix1), "=r"(tmp)
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1079 : "r" (line_size) , "g" (h-2)
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1080 : "%ecx");
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1081 return tmp + hf_noise8_mmx(pix+8, line_size, h);
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1082 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1083
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1084 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
1085 int score1= sse16_mmx(c, pix1, pix2, line_size, h);
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1086 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
1087
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1088 if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1089 else return score1 + ABS(score2)*8;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1090 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1091
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1092 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
1093 int score1= sse8_mmx(c, pix1, pix2, line_size, h);
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1094 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
1095
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1096 if(c) return score1 + ABS(score2)*c->avctx->nsse_weight;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1097 else return score1 + ABS(score2)*8;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1098 }
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
1099
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1100 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
1101 int tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1102
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1103 assert( (((int)pix) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1104 assert((line_size &7) ==0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1105
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1106 #define SUM(in0, in1, out0, out1) \
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1107 "movq (%0), %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1108 "movq 8(%0), %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1109 "addl %2,%0\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1110 "movq %%mm2, " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1111 "movq %%mm3, " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1112 "psubusb " #in0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1113 "psubusb " #in1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1114 "psubusb " #out0 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1115 "psubusb " #out1 ", " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1116 "por %%mm2, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1117 "por %%mm3, " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1118 "movq " #in0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1119 "movq " #in1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1120 "punpcklbw %%mm7, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1121 "punpcklbw %%mm7, " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1122 "punpckhbw %%mm7, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1123 "punpckhbw %%mm7, %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1124 "paddw " #in1 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1125 "paddw %%mm3, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1126 "paddw %%mm2, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1127 "paddw " #in0 ", %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1128
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1129
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1130 asm volatile (
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1131 "movl %3,%%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1132 "pxor %%mm6,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1133 "pxor %%mm7,%%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1134 "movq (%0),%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1135 "movq 8(%0),%%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1136 "addl %2,%0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1137 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1138 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1139 "1:\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1140
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1141 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1142
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1143 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1144
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1145 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1146 "jnz 1b\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1147
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1148 "movq %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1149 "psrlq $32, %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1150 "paddw %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1151 "movq %%mm0,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1152 "psrlq $16, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1153 "paddw %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1154 "movd %%mm0,%1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1155 : "+r" (pix), "=r"(tmp)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1156 : "r" (line_size) , "m" (h)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1157 : "%ecx");
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1158 return tmp & 0xFFFF;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1159 }
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1160 #undef SUM
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1161
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1162 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
1163 int tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1164
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1165 assert( (((int)pix) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1166 assert((line_size &7) ==0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1167
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1168 #define SUM(in0, in1, out0, out1) \
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1169 "movq (%0), " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1170 "movq 8(%0), " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1171 "addl %2,%0\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1172 "psadbw " #out0 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1173 "psadbw " #out1 ", " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1174 "paddw " #in1 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1175 "paddw " #in0 ", %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1176
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1177 asm volatile (
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1178 "movl %3,%%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1179 "pxor %%mm6,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1180 "pxor %%mm7,%%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1181 "movq (%0),%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1182 "movq 8(%0),%%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1183 "addl %2,%0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1184 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1185 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1186 "1:\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1187
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1188 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1189
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1190 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1191
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1192 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1193 "jnz 1b\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1194
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1195 "movd %%mm6,%1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1196 : "+r" (pix), "=r"(tmp)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1197 : "r" (line_size) , "m" (h)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1198 : "%ecx");
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1199 return tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1200 }
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1201 #undef SUM
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1202
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1203 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
1204 int tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1205
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1206 assert( (((int)pix1) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1207 assert( (((int)pix2) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1208 assert((line_size &7) ==0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1209
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1210 #define SUM(in0, in1, out0, out1) \
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1211 "movq (%0),%%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1212 "movq (%1)," #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1213 "movq 8(%0),%%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1214 "movq 8(%1)," #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1215 "addl %3,%0\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1216 "addl %3,%1\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1217 "psubb " #out0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1218 "psubb " #out1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1219 "pxor %%mm7, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1220 "pxor %%mm7, %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1221 "movq %%mm2, " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1222 "movq %%mm3, " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1223 "psubusb " #in0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1224 "psubusb " #in1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1225 "psubusb " #out0 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1226 "psubusb " #out1 ", " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1227 "por %%mm2, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1228 "por %%mm3, " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1229 "movq " #in0 ", %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1230 "movq " #in1 ", %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1231 "punpcklbw %%mm7, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1232 "punpcklbw %%mm7, " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1233 "punpckhbw %%mm7, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1234 "punpckhbw %%mm7, %%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1235 "paddw " #in1 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1236 "paddw %%mm3, %%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1237 "paddw %%mm2, " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1238 "paddw " #in0 ", %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1239
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1240
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1241 asm volatile (
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1242 "movl %4,%%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1243 "pxor %%mm6,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1244 "pcmpeqw %%mm7,%%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1245 "psllw $15, %%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1246 "packsswb %%mm7, %%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1247 "movq (%0),%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1248 "movq (%1),%%mm2\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1249 "movq 8(%0),%%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1250 "movq 8(%1),%%mm3\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1251 "addl %3,%0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1252 "addl %3,%1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1253 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1254 "psubb %%mm2, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1255 "psubb %%mm3, %%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1256 "pxor %%mm7, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1257 "pxor %%mm7, %%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1258 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1259 "1:\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1260
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1261 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1262
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1263 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1264
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1265 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1266 "jnz 1b\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1267
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1268 "movq %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1269 "psrlq $32, %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1270 "paddw %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1271 "movq %%mm0,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1272 "psrlq $16, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1273 "paddw %%mm6,%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1274 "movd %%mm0,%2\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1275 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1276 : "r" (line_size) , "m" (h)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1277 : "%ecx");
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1278 return tmp & 0x7FFF;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1279 }
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1280 #undef SUM
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1281
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1282 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
1283 int tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1284
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1285 assert( (((int)pix1) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1286 assert( (((int)pix2) & 7) == 0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1287 assert((line_size &7) ==0);
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1288
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1289 #define SUM(in0, in1, out0, out1) \
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1290 "movq (%0)," #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1291 "movq (%1),%%mm2\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1292 "movq 8(%0)," #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1293 "movq 8(%1),%%mm3\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1294 "addl %3,%0\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1295 "addl %3,%1\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1296 "psubb %%mm2, " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1297 "psubb %%mm3, " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1298 "pxor %%mm7, " #out0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1299 "pxor %%mm7, " #out1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1300 "psadbw " #out0 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1301 "psadbw " #out1 ", " #in1 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1302 "paddw " #in1 ", " #in0 "\n"\
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1303 "paddw " #in0 ", %%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1304
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1305 asm volatile (
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1306 "movl %4,%%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1307 "pxor %%mm6,%%mm6\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1308 "pcmpeqw %%mm7,%%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1309 "psllw $15, %%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1310 "packsswb %%mm7, %%mm7\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1311 "movq (%0),%%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1312 "movq (%1),%%mm2\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1313 "movq 8(%0),%%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1314 "movq 8(%1),%%mm3\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1315 "addl %3,%0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1316 "addl %3,%1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1317 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1318 "psubb %%mm2, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1319 "psubb %%mm3, %%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1320 "pxor %%mm7, %%mm0\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1321 "pxor %%mm7, %%mm1\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1322 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1323 "1:\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1324
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1325 SUM(%%mm4, %%mm5, %%mm0, %%mm1)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1326
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1327 SUM(%%mm0, %%mm1, %%mm4, %%mm5)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1328
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1329 "subl $2, %%ecx\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1330 "jnz 1b\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1331
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1332 "movd %%mm6,%2\n"
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1333 : "+r" (pix1), "+r" (pix2), "=r"(tmp)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1334 : "r" (line_size) , "m" (h)
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1335 : "%ecx");
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1336 return tmp;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1337 }
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1338 #undef SUM
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
1339
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1340 static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1341 int i=0;
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1342 asm volatile(
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1343 "1: \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1344 "movq (%2, %0), %%mm0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1345 "movq (%1, %0), %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1346 "psubb %%mm0, %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1347 "movq %%mm1, (%3, %0) \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1348 "movq 8(%2, %0), %%mm0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1349 "movq 8(%1, %0), %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1350 "psubb %%mm0, %%mm1 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1351 "movq %%mm1, 8(%3, %0) \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1352 "addl $16, %0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1353 "cmpl %4, %0 \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1354 " jb 1b \n\t"
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1355 : "+r" (i)
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1356 : "r"(src1), "r"(src2), "r"(dst), "r"(w-15)
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1357 );
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1358 for(; i<w; i++)
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1359 dst[i+0] = src1[i+0]-src2[i+0];
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1360 }
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1361
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1362 static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1363 int i=0;
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1364 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
1365
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1366 asm volatile(
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1367 "1: \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1368 "movq -1(%1, %0), %%mm0 \n\t" // LT
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1369 "movq (%1, %0), %%mm1 \n\t" // T
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1370 "movq -1(%2, %0), %%mm2 \n\t" // L
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1371 "movq (%2, %0), %%mm3 \n\t" // X
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1372 "movq %%mm2, %%mm4 \n\t" // L
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1373 "psubb %%mm0, %%mm2 \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1374 "paddb %%mm1, %%mm2 \n\t" // L + T - LT
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1375 "movq %%mm4, %%mm5 \n\t" // L
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1376 "pmaxub %%mm1, %%mm4 \n\t" // max(T, L)
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1377 "pminub %%mm5, %%mm1 \n\t" // min(T, L)
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1378 "pminub %%mm2, %%mm4 \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1379 "pmaxub %%mm1, %%mm4 \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1380 "psubb %%mm4, %%mm3 \n\t" // dst - pred
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1381 "movq %%mm3, (%3, %0) \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1382 "addl $8, %0 \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1383 "cmpl %4, %0 \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1384 " jb 1b \n\t"
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1385 : "+r" (i)
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1386 : "r"(src1), "r"(src2), "r"(dst), "r"(w)
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1387 );
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1388
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1389 l= *left;
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1390 lt= *left_top;
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1391
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1392 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
1393
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1394 *left_top= src1[w-1];
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1395 *left = src2[w-1];
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1396 }
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
1397
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1398 #define LBUTTERFLY2(a1,b1,a2,b2)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1399 "paddw " #b1 ", " #a1 " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1400 "paddw " #b2 ", " #a2 " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1401 "paddw " #b1 ", " #b1 " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1402 "paddw " #b2 ", " #b2 " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1403 "psubw " #a1 ", " #b1 " \n\t"\
1186
4f0072371bb9 10l (hadamard fix)
michaelni
parents: 1153
diff changeset
1404 "psubw " #a2 ", " #b2 " \n\t"
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1405
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1406 #define HADAMARD48\
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1407 LBUTTERFLY2(%%mm0, %%mm1, %%mm2, %%mm3)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1408 LBUTTERFLY2(%%mm4, %%mm5, %%mm6, %%mm7)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1409 LBUTTERFLY2(%%mm0, %%mm2, %%mm1, %%mm3)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1410 LBUTTERFLY2(%%mm4, %%mm6, %%mm5, %%mm7)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1411 LBUTTERFLY2(%%mm0, %%mm4, %%mm1, %%mm5)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1412 LBUTTERFLY2(%%mm2, %%mm6, %%mm3, %%mm7)\
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1413
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1414 #define MMABS(a,z)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1415 "pxor " #z ", " #z " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1416 "pcmpgtw " #a ", " #z " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1417 "pxor " #z ", " #a " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1418 "psubw " #z ", " #a " \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1419
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1420 #define MMABS_SUM(a,z, sum)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1421 "pxor " #z ", " #z " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1422 "pcmpgtw " #a ", " #z " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1423 "pxor " #z ", " #a " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1424 "psubw " #z ", " #a " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1425 "paddusw " #a ", " #sum " \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1426
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1427 #define MMABS_MMX2(a,z)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1428 "pxor " #z ", " #z " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1429 "psubw " #a ", " #z " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1430 "pmaxsw " #z ", " #a " \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1431
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1432 #define MMABS_SUM_MMX2(a,z, sum)\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1433 "pxor " #z ", " #z " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1434 "psubw " #a ", " #z " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1435 "pmaxsw " #z ", " #a " \n\t"\
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1436 "paddusw " #a ", " #sum " \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1437
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1438 #define SBUTTERFLY(a,b,t,n)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1439 "movq " #a ", " #t " \n\t" /* abcd */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1440 "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1441 "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1442
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1443 #define TRANSPOSE4(a,b,c,d,t)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1444 SBUTTERFLY(a,b,t,wd) /* a=aebf t=cgdh */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1445 SBUTTERFLY(c,d,b,wd) /* c=imjn b=kolp */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1446 SBUTTERFLY(a,c,d,dq) /* a=aeim d=bfjn */\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1447 SBUTTERFLY(t,b,c,dq) /* t=cgko c=dhlp */
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1448
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1449 #define LOAD4(o, a, b, c, d)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1450 "movq "#o"(%1), " #a " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1451 "movq "#o"+16(%1), " #b " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1452 "movq "#o"+32(%1), " #c " \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1453 "movq "#o"+48(%1), " #d " \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1454
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1455 #define STORE4(o, a, b, c, d)\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1456 "movq "#a", "#o"(%1) \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1457 "movq "#b", "#o"+16(%1) \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1458 "movq "#c", "#o"+32(%1) \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1459 "movq "#d", "#o"+48(%1) \n\t"\
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1460
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1461 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
1462 uint64_t temp[16] __align8;
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1463 int sum=0;
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1464
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1465 assert(h==8);
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1466
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1467 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride);
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1468
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1469 asm volatile(
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1470 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1471 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1472
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1473 HADAMARD48
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1474
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1475 "movq %%mm7, 112(%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1476
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1477 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1478 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1479
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1480 "movq 112(%1), %%mm7 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1481 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1482 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1483
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1484 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1485 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1486
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1487 HADAMARD48
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1488
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1489 "movq %%mm7, 120(%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1490
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1491 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1492 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1493
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1494 "movq 120(%1), %%mm7 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1495 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1496 "movq %%mm7, %%mm5 \n\t"//FIXME remove
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1497 "movq %%mm6, %%mm7 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1498 "movq %%mm0, %%mm6 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1499 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1500
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1501 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1502 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1503
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1504 HADAMARD48
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1505 "movq %%mm7, 64(%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1506 MMABS(%%mm0, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1507 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1508 MMABS_SUM(%%mm2, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1509 MMABS_SUM(%%mm3, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1510 MMABS_SUM(%%mm4, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1511 MMABS_SUM(%%mm5, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1512 MMABS_SUM(%%mm6, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1513 "movq 64(%1), %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1514 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1515 "movq %%mm0, 64(%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1516
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1517 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1518 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1519
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1520 HADAMARD48
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1521 "movq %%mm7, (%1) \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1522 MMABS(%%mm0, %%mm7)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1523 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1524 MMABS_SUM(%%mm2, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1525 MMABS_SUM(%%mm3, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1526 MMABS_SUM(%%mm4, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1527 MMABS_SUM(%%mm5, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1528 MMABS_SUM(%%mm6, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1529 "movq (%1), %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1530 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1531 "movq 64(%1), %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1532 MMABS_SUM(%%mm1, %%mm7, %%mm0)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1533
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1534 "movq %%mm0, %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1535 "psrlq $32, %%mm0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1536 "paddusw %%mm1, %%mm0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1537 "movq %%mm0, %%mm1 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1538 "psrlq $16, %%mm0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1539 "paddusw %%mm1, %%mm0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1540 "movd %%mm0, %0 \n\t"
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1541
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1542 : "=r" (sum)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1543 : "r"(temp)
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1544 );
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1545 return sum&0xFFFF;
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1546 }
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
1547
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1548 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
1549 uint64_t temp[16] __align8;
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1550 int sum=0;
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1551
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1552 assert(h==8);
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1553
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1554 diff_pixels_mmx((DCTELEM*)temp, src1, src2, stride);
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1555
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1556 asm volatile(
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1557 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1558 LOAD4(64, %%mm4, %%mm5, %%mm6, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1559
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1560 HADAMARD48
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1561
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1562 "movq %%mm7, 112(%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1563
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1564 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1565 STORE4(0 , %%mm0, %%mm3, %%mm7, %%mm2)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1566
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1567 "movq 112(%1), %%mm7 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1568 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1569 STORE4(64, %%mm4, %%mm7, %%mm0, %%mm6)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1570
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1571 LOAD4(8 , %%mm0, %%mm1, %%mm2, %%mm3)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1572 LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1573
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1574 HADAMARD48
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1575
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1576 "movq %%mm7, 120(%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1577
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1578 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1579 STORE4(8 , %%mm0, %%mm3, %%mm7, %%mm2)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1580
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1581 "movq 120(%1), %%mm7 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1582 TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1583 "movq %%mm7, %%mm5 \n\t"//FIXME remove
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1584 "movq %%mm6, %%mm7 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1585 "movq %%mm0, %%mm6 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1586 // STORE4(72, %%mm4, %%mm7, %%mm0, %%mm6) //FIXME remove
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1587
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1588 LOAD4(64, %%mm0, %%mm1, %%mm2, %%mm3)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1589 // LOAD4(72, %%mm4, %%mm5, %%mm6, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1590
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1591 HADAMARD48
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1592 "movq %%mm7, 64(%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1593 MMABS_MMX2(%%mm0, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1594 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1595 MMABS_SUM_MMX2(%%mm2, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1596 MMABS_SUM_MMX2(%%mm3, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1597 MMABS_SUM_MMX2(%%mm4, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1598 MMABS_SUM_MMX2(%%mm5, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1599 MMABS_SUM_MMX2(%%mm6, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1600 "movq 64(%1), %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1601 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1602 "movq %%mm0, 64(%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1603
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1604 LOAD4(0 , %%mm0, %%mm1, %%mm2, %%mm3)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1605 LOAD4(8 , %%mm4, %%mm5, %%mm6, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1606
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1607 HADAMARD48
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1608 "movq %%mm7, (%1) \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1609 MMABS_MMX2(%%mm0, %%mm7)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1610 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1611 MMABS_SUM_MMX2(%%mm2, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1612 MMABS_SUM_MMX2(%%mm3, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1613 MMABS_SUM_MMX2(%%mm4, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1614 MMABS_SUM_MMX2(%%mm5, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1615 MMABS_SUM_MMX2(%%mm6, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1616 "movq (%1), %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1617 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1618 "movq 64(%1), %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1619 MMABS_SUM_MMX2(%%mm1, %%mm7, %%mm0)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1620
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1621 "movq %%mm0, %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1622 "psrlq $32, %%mm0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1623 "paddusw %%mm1, %%mm0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1624 "movq %%mm0, %%mm1 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1625 "psrlq $16, %%mm0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1626 "paddusw %%mm1, %%mm0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1627 "movd %%mm0, %0 \n\t"
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1628
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1629 : "=r" (sum)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1630 : "r"(temp)
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1631 );
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1632 return sum&0xFFFF;
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1633 }
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1634
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
1635
1708
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1636 WARPER8_16_SQ(hadamard8_diff_mmx, hadamard8_diff16_mmx)
dea5b2946999 interlaced motion estimation
michael
parents: 1686
diff changeset
1637 WARPER8_16_SQ(hadamard8_diff_mmx2, hadamard8_diff16_mmx2)
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
1638 #endif //CONFIG_ENCODERS
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
1639
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1640 #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
1641 #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
1642
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1643 #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
1644 "paddw " #m4 ", " #m3 " \n\t" /* x1 */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1645 "movq "MANGLE(ff_pw_20)", %%mm4 \n\t" /* 20 */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1646 "pmullw " #m3 ", %%mm4 \n\t" /* 20x1 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1647 "movq "#in7", " #m3 " \n\t" /* d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1648 "movq "#in0", %%mm5 \n\t" /* D */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1649 "paddw " #m3 ", %%mm5 \n\t" /* x4 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1650 "psubw %%mm5, %%mm4 \n\t" /* 20x1 - x4 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1651 "movq "#in1", %%mm5 \n\t" /* C */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1652 "movq "#in2", %%mm6 \n\t" /* B */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1653 "paddw " #m6 ", %%mm5 \n\t" /* x3 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1654 "paddw " #m5 ", %%mm6 \n\t" /* x2 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1655 "paddw %%mm6, %%mm6 \n\t" /* 2x2 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1656 "psubw %%mm6, %%mm5 \n\t" /* -2x2 + x3 */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1657 "pmullw "MANGLE(ff_pw_3)", %%mm5 \n\t" /* -6x2 + 3x3 */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1658 "paddw " #rnd ", %%mm4 \n\t" /* x2 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1659 "paddw %%mm4, %%mm5 \n\t" /* 20x1 - 6x2 + 3x3 - x4 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1660 "psraw $5, %%mm5 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1661 "packuswb %%mm5, %%mm5 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1662 OP(%%mm5, out, %%mm7, d)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1663
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1664 #define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 997
diff changeset
1665 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
1666 uint64_t temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1667 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1668 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1669 "pxor %%mm7, %%mm7 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1670 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1671 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1672 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1673 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1674 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1675 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1676 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1677 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1678 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1679 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1680 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1681 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1682 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1683 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1684 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1685 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1686 "paddw %%mm3, %%mm5 \n\t" /* b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1687 "paddw %%mm2, %%mm6 \n\t" /* c */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1688 "paddw %%mm5, %%mm5 \n\t" /* 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1689 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1690 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1691 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1692 "paddw %%mm4, %%mm0 \n\t" /* a */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1693 "paddw %%mm1, %%mm5 \n\t" /* d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1694 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1695 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1696 "paddw %6, %%mm6 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1697 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1698 "psraw $5, %%mm0 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1699 "movq %%mm0, %5 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1700 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1701 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1702 "movq 5(%0), %%mm0 \n\t" /* FGHIJKLM */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1703 "movq %%mm0, %%mm5 \n\t" /* FGHIJKLM */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1704 "movq %%mm0, %%mm6 \n\t" /* FGHIJKLM */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1705 "psrlq $8, %%mm0 \n\t" /* GHIJKLM0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1706 "psrlq $16, %%mm5 \n\t" /* HIJKLM00 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1707 "punpcklbw %%mm7, %%mm0 \n\t" /* 0G0H0I0J */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1708 "punpcklbw %%mm7, %%mm5 \n\t" /* 0H0I0J0K */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1709 "paddw %%mm0, %%mm2 \n\t" /* b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1710 "paddw %%mm5, %%mm3 \n\t" /* c */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1711 "paddw %%mm2, %%mm2 \n\t" /* 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1712 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1713 "movq %%mm6, %%mm2 \n\t" /* FGHIJKLM */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1714 "psrlq $24, %%mm6 \n\t" /* IJKLM000 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1715 "punpcklbw %%mm7, %%mm2 \n\t" /* 0F0G0H0I */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1716 "punpcklbw %%mm7, %%mm6 \n\t" /* 0I0J0K0L */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1717 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1718 "paddw %%mm2, %%mm1 \n\t" /* a */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1719 "paddw %%mm6, %%mm4 \n\t" /* d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1720 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1721 "psubw %%mm4, %%mm3 \n\t" /* - 6b +3c - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1722 "paddw %6, %%mm1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1723 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b +3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1724 "psraw $5, %%mm3 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1725 "movq %5, %%mm1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1726 "packuswb %%mm3, %%mm1 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1727 OP_MMX2(%%mm1, (%1),%%mm4, q)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1728 /* mm0= GHIJ, mm2=FGHI, mm5=HIJK, mm6=IJKL, mm7=0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1729 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1730 "movq 9(%0), %%mm1 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1731 "movq %%mm1, %%mm4 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1732 "movq %%mm1, %%mm3 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1733 "psrlq $8, %%mm1 \n\t" /* KLMNOPQ0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1734 "psrlq $16, %%mm4 \n\t" /* LMNOPQ00 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1735 "punpcklbw %%mm7, %%mm1 \n\t" /* 0K0L0M0N */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1736 "punpcklbw %%mm7, %%mm4 \n\t" /* 0L0M0N0O */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1737 "paddw %%mm1, %%mm5 \n\t" /* b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1738 "paddw %%mm4, %%mm0 \n\t" /* c */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1739 "paddw %%mm5, %%mm5 \n\t" /* 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1740 "psubw %%mm5, %%mm0 \n\t" /* c - 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1741 "movq %%mm3, %%mm5 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1742 "psrlq $24, %%mm3 \n\t" /* MNOPQ000 */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1743 "pmullw "MANGLE(ff_pw_3)", %%mm0 \n\t" /* 3c - 6b */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1744 "punpcklbw %%mm7, %%mm3 \n\t" /* 0M0N0O0P */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1745 "paddw %%mm3, %%mm2 \n\t" /* d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1746 "psubw %%mm2, %%mm0 \n\t" /* -6b + 3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1747 "movq %%mm5, %%mm2 \n\t" /* JKLMNOPQ */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1748 "punpcklbw %%mm7, %%mm2 \n\t" /* 0J0K0L0M */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1749 "punpckhbw %%mm7, %%mm5 \n\t" /* 0N0O0P0Q */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1750 "paddw %%mm2, %%mm6 \n\t" /* a */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1751 "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" /* 20a */\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1752 "paddw %6, %%mm0 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1753 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1754 "psraw $5, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1755 /* mm1=KLMN, mm2=JKLM, mm3=MNOP, mm4=LMNO, mm5=NOPQ mm7=0 */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1756 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1757 "paddw %%mm5, %%mm3 \n\t" /* a */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1758 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0O0P0Q0Q */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1759 "paddw %%mm4, %%mm6 \n\t" /* b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1760 "pshufw $0xBE, %%mm5, %%mm4 \n\t" /* 0P0Q0Q0P */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1761 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0Q0Q0P0O */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1762 "paddw %%mm1, %%mm4 \n\t" /* c */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1763 "paddw %%mm2, %%mm5 \n\t" /* d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1764 "paddw %%mm6, %%mm6 \n\t" /* 2b */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1765 "psubw %%mm6, %%mm4 \n\t" /* c - 2b */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1766 "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" /* 20a */\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1767 "pmullw "MANGLE(ff_pw_3)", %%mm4 \n\t" /* 3c - 6b */\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1768 "psubw %%mm5, %%mm3 \n\t" /* -6b + 3c - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1769 "paddw %6, %%mm4 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1770 "paddw %%mm3, %%mm4 \n\t" /* 20a - 6b + 3c - d */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1771 "psraw $5, %%mm4 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1772 "packuswb %%mm4, %%mm0 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1773 OP_MMX2(%%mm0, 8(%1), %%mm4, q)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1774 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1775 "addl %3, %0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1776 "addl %4, %1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1777 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1778 " jnz 1b \n\t"\
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
1779 : "+a"(src), "+c"(dst), "+m"(h)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
1780 : "d"(srcStride), "S"(dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
1781 : "memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1782 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1783 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1784 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1785 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
1786 int i;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1787 int16_t temp[16];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1788 /* quick HACK, XXX FIXME MUST be optimized */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1789 for(i=0; i<h; i++)\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1790 {\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1791 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
1792 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
1793 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
1794 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
1795 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
1796 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
1797 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
1798 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
1799 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
1800 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
1801 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
1802 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
1803 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
1804 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
1805 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
1806 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
1807 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1808 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1809 "movq 8(%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1810 "paddw %2, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1811 "paddw %2, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1812 "psraw $5, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1813 "psraw $5, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1814 "packuswb %%mm1, %%mm0 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1815 OP_3DNOW(%%mm0, (%1), %%mm1, q)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1816 "movq 16(%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1817 "movq 24(%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1818 "paddw %2, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1819 "paddw %2, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1820 "psraw $5, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1821 "psraw $5, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1822 "packuswb %%mm1, %%mm0 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1823 OP_3DNOW(%%mm0, 8(%1), %%mm1, q)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1824 :: "r"(temp), "r"(dst), "m"(ROUNDER)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
1825 : "memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1826 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1827 dst+=dstStride;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1828 src+=srcStride;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1829 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1830 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1831 \
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 997
diff changeset
1832 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
1833 uint64_t temp;\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1834 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1835 asm volatile(\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1836 "pxor %%mm7, %%mm7 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1837 "1: \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1838 "movq (%0), %%mm0 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1839 "movq %%mm0, %%mm1 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1840 "movq %%mm0, %%mm2 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1841 "punpcklbw %%mm7, %%mm0 \n\t" /* 0A0B0C0D */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1842 "punpckhbw %%mm7, %%mm1 \n\t" /* 0E0F0G0H */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1843 "pshufw $0x90, %%mm0, %%mm5 \n\t" /* 0A0A0B0C */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1844 "pshufw $0x41, %%mm0, %%mm6 \n\t" /* 0B0A0A0B */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1845 "movq %%mm2, %%mm3 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1846 "movq %%mm2, %%mm4 \n\t" /* ABCDEFGH */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1847 "psllq $8, %%mm2 \n\t" /* 0ABCDEFG */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1848 "psllq $16, %%mm3 \n\t" /* 00ABCDEF */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1849 "psllq $24, %%mm4 \n\t" /* 000ABCDE */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1850 "punpckhbw %%mm7, %%mm2 \n\t" /* 0D0E0F0G */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1851 "punpckhbw %%mm7, %%mm3 \n\t" /* 0C0D0E0F */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1852 "punpckhbw %%mm7, %%mm4 \n\t" /* 0B0C0D0E */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1853 "paddw %%mm3, %%mm5 \n\t" /* b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1854 "paddw %%mm2, %%mm6 \n\t" /* c */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1855 "paddw %%mm5, %%mm5 \n\t" /* 2b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1856 "psubw %%mm5, %%mm6 \n\t" /* c - 2b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1857 "pshufw $0x06, %%mm0, %%mm5 \n\t" /* 0C0B0A0A */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1858 "pmullw "MANGLE(ff_pw_3)", %%mm6 \n\t" /* 3c - 6b */\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1859 "paddw %%mm4, %%mm0 \n\t" /* a */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1860 "paddw %%mm1, %%mm5 \n\t" /* d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1861 "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1862 "psubw %%mm5, %%mm0 \n\t" /* 20a - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1863 "paddw %6, %%mm6 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1864 "paddw %%mm6, %%mm0 \n\t" /* 20a - 6b + 3c - d */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1865 "psraw $5, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1866 /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1867 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1868 "movd 5(%0), %%mm5 \n\t" /* FGHI */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1869 "punpcklbw %%mm7, %%mm5 \n\t" /* 0F0G0H0I */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1870 "pshufw $0xF9, %%mm5, %%mm6 \n\t" /* 0G0H0I0I */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1871 "paddw %%mm5, %%mm1 \n\t" /* a */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1872 "paddw %%mm6, %%mm2 \n\t" /* b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1873 "pshufw $0xBE, %%mm5, %%mm6 \n\t" /* 0H0I0I0H */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1874 "pshufw $0x6F, %%mm5, %%mm5 \n\t" /* 0I0I0H0G */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1875 "paddw %%mm6, %%mm3 \n\t" /* c */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1876 "paddw %%mm5, %%mm4 \n\t" /* d */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1877 "paddw %%mm2, %%mm2 \n\t" /* 2b */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1878 "psubw %%mm2, %%mm3 \n\t" /* c - 2b */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1879 "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1880 "pmullw "MANGLE(ff_pw_3)", %%mm3 \n\t" /* 3c - 6b */\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1881 "psubw %%mm4, %%mm3 \n\t" /* -6b + 3c - d */\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1882 "paddw %6, %%mm1 \n\t"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1883 "paddw %%mm1, %%mm3 \n\t" /* 20a - 6b + 3c - d */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1884 "psraw $5, %%mm3 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1885 "packuswb %%mm3, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1886 OP_MMX2(%%mm0, (%1), %%mm4, q)\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1887 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1888 "addl %3, %0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1889 "addl %4, %1 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1890 "decl %2 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1891 " jnz 1b \n\t"\
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
1892 : "+a"(src), "+c"(dst), "+m"(h)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
1893 : "S"(srcStride), "D"(dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
1894 : "memory"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1895 );\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1896 }\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1897 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1898 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
1899 int i;\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1900 int16_t temp[8];\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1901 /* quick HACK, XXX FIXME MUST be optimized */\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1902 for(i=0; i<h; i++)\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1903 {\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1904 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
1905 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
1906 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
1907 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
1908 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
1909 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
1910 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
1911 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
1912 asm volatile(\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1913 "movq (%0), %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1914 "movq 8(%0), %%mm1 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1915 "paddw %2, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1916 "paddw %2, %%mm1 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1917 "psraw $5, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1918 "psraw $5, %%mm1 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1919 "packuswb %%mm1, %%mm0 \n\t"\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1920 OP_3DNOW(%%mm0, (%1), %%mm1, q)\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1921 :: "r"(temp), "r"(dst), "m"(ROUNDER)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
1922 :"memory"\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1923 );\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1924 dst+=dstStride;\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1925 src+=srcStride;\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1926 }\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1927 }
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1928
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1929 #define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX)\
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1930 \
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
1931 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
1932 uint64_t temp[17*4];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1933 uint64_t *temp_ptr= temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1934 int count= 17;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1935 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1936 /*FIXME unroll */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1937 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1938 "pxor %%mm7, %%mm7 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1939 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1940 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1941 "movq (%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1942 "movq 8(%0), %%mm2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1943 "movq 8(%0), %%mm3 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1944 "punpcklbw %%mm7, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1945 "punpckhbw %%mm7, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1946 "punpcklbw %%mm7, %%mm2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1947 "punpckhbw %%mm7, %%mm3 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1948 "movq %%mm0, (%1) \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1949 "movq %%mm1, 17*8(%1) \n\t"\
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
1950 "movq %%mm2, 2*17*8(%1) \n\t"\
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
1951 "movq %%mm3, 3*17*8(%1) \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1952 "addl $8, %1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1953 "addl %3, %0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1954 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1955 " jnz 1b \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1956 : "+r" (src), "+r" (temp_ptr), "+r"(count)\
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
1957 : "r" (srcStride)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
1958 : "memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1959 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1960 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1961 temp_ptr= temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1962 count=4;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1963 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1964 /*FIXME reorder for speed */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1965 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1966 /*"pxor %%mm7, %%mm7 \n\t"*/\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1967 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1968 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1969 "movq 8(%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1970 "movq 16(%0), %%mm2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1971 "movq 24(%0), %%mm3 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1972 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
1973 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1974 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1975 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
1976 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1977 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1978 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1979 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
1980 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1981 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1982 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
1983 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1984 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1985 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
1986 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0),104(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1987 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1988 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
1989 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0),120(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1990 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1991 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
1992 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1993 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0),128(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1994 "addl %4, %1 \n\t" \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1995 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
1996 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
1997 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
1998 "addl $136, %0 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
1999 "addl %6, %1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2000 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2001 " 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
2002 \
967
274b518c4ecb PIC / ebx fix
michaelni
parents: 966
diff changeset
2003 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2004 : "r"(dstStride), "r"(2*dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-14*dstStride)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2005 :"memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2006 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2007 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2008 \
1057
bb5de8a59da8 * static,const,compiler warning cleanup
kabi
parents: 997
diff changeset
2009 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
2010 uint64_t temp[9*2];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2011 uint64_t *temp_ptr= temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2012 int count= 9;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2013 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2014 /*FIXME unroll */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2015 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2016 "pxor %%mm7, %%mm7 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2017 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2018 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2019 "movq (%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2020 "punpcklbw %%mm7, %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2021 "punpckhbw %%mm7, %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2022 "movq %%mm0, (%1) \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2023 "movq %%mm1, 9*8(%1) \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2024 "addl $8, %1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2025 "addl %3, %0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2026 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2027 " jnz 1b \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2028 : "+r" (src), "+r" (temp_ptr), "+r"(count)\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2029 : "r" (srcStride)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2030 : "memory"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2031 );\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2032 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2033 temp_ptr= temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2034 count=2;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2035 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2036 /*FIXME reorder for speed */\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2037 asm volatile(\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2038 /*"pxor %%mm7, %%mm7 \n\t"*/\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2039 "1: \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2040 "movq (%0), %%mm0 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2041 "movq 8(%0), %%mm1 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2042 "movq 16(%0), %%mm2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2043 "movq 24(%0), %%mm3 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2044 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
2045 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 8(%0), (%0), (%0), 40(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2046 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2047 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
2048 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2049 QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, (%0), 8(%0), 16(%0), 56(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2050 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2051 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
2052 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2053 QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP)\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2054 "addl %4, %1 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2055 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
2056 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
2057 \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2058 "addl $72, %0 \n\t"\
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2059 "addl %6, %1 \n\t"\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2060 "decl %2 \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2061 " jnz 1b \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2062 \
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2063 : "+r"(temp_ptr), "+r"(dst), "+g"(count)\
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
2064 : "r"(dstStride), "r"(2*dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-6*dstStride)\
966
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2065 : "memory"\
7ef9226f430e more gcc bug workarounds
michaelni
parents: 961
diff changeset
2066 );\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2067 }\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2068 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2069 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
2070 OPNAME ## pixels8_mmx(dst, src, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2071 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2072 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2073 static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2074 uint64_t temp[8];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2075 uint8_t * const half= (uint8_t*)temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2076 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
2077 OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2078 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2079 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2080 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
2081 OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2082 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2083 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2084 static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2085 uint64_t temp[8];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2086 uint8_t * const half= (uint8_t*)temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2087 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
2088 OPNAME ## pixels8_l2_ ## MMX(dst, src+1, half, stride, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2089 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2090 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2091 static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2092 uint64_t temp[8];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2093 uint8_t * const half= (uint8_t*)temp;\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2094 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
2095 OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2096 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2097 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2098 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
2099 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2100 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2101 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2102 static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2103 uint64_t temp[8];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2104 uint8_t * const half= (uint8_t*)temp;\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2105 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
2106 OPNAME ## pixels8_l2_ ## MMX(dst, src+stride, half, stride, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2107 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2108 static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2109 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2110 uint8_t * const halfH= ((uint8_t*)half) + 64;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2111 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2112 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
2113 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2114 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
2115 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2116 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2117 static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2118 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2119 uint8_t * const halfH= ((uint8_t*)half) + 64;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2120 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2121 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
2122 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2123 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
2124 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2125 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2126 static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2127 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2128 uint8_t * const halfH= ((uint8_t*)half) + 64;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2129 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2130 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
2131 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2132 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
2133 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2134 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2135 static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2136 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2137 uint8_t * const halfH= ((uint8_t*)half) + 64;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2138 uint8_t * const halfHV= ((uint8_t*)half);\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2139 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
2140 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2141 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
2142 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2143 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2144 static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2145 uint64_t half[8 + 9];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2146 uint8_t * const halfH= ((uint8_t*)half) + 64;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2147 uint8_t * const halfHV= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2148 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2149 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
2150 OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2151 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2152 static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2153 uint64_t half[8 + 9];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2154 uint8_t * const halfH= ((uint8_t*)half) + 64;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2155 uint8_t * const halfHV= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2156 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2157 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
2158 OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2159 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2160 static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2161 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2162 uint8_t * const halfH= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2163 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
2164 put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2165 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2166 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2167 static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2168 uint64_t half[8 + 9];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2169 uint8_t * const halfH= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2170 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
2171 put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2172 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2173 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2174 static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2175 uint64_t half[9];\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2176 uint8_t * const halfH= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2177 put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2178 OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2179 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2180 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
2181 OPNAME ## pixels16_mmx(dst, src, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2182 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2183 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2184 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
2185 uint64_t temp[32];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2186 uint8_t * const half= (uint8_t*)temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2187 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
2188 OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2189 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2190 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2191 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
2192 OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2193 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2194 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2195 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
2196 uint64_t temp[32];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2197 uint8_t * const half= (uint8_t*)temp;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2198 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
2199 OPNAME ## pixels16_l2_ ## MMX(dst, src+1, half, stride, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2200 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2201 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2202 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
2203 uint64_t temp[32];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2204 uint8_t * const half= (uint8_t*)temp;\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2205 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
2206 OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2207 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2208 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2209 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
2210 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2211 }\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2212 \
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2213 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
2214 uint64_t temp[32];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2215 uint8_t * const half= (uint8_t*)temp;\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2216 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
2217 OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, stride, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2218 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2219 static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2220 uint64_t half[16*2 + 17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2221 uint8_t * const halfH= ((uint8_t*)half) + 256;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2222 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2223 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
2224 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2225 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
2226 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2227 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2228 static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2229 uint64_t half[16*2 + 17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2230 uint8_t * const halfH= ((uint8_t*)half) + 256;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2231 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2232 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
2233 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2234 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
2235 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2236 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2237 static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2238 uint64_t half[16*2 + 17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2239 uint8_t * const halfH= ((uint8_t*)half) + 256;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2240 uint8_t * const halfHV= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2241 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
2242 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2243 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
2244 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2245 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2246 static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2247 uint64_t half[16*2 + 17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2248 uint8_t * const halfH= ((uint8_t*)half) + 256;\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2249 uint8_t * const halfHV= ((uint8_t*)half);\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2250 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
2251 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2252 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
2253 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2254 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2255 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
2256 uint64_t half[16*2 + 17*2];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2257 uint8_t * const halfH= ((uint8_t*)half) + 256;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2258 uint8_t * const halfHV= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2259 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2260 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
2261 OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2262 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2263 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
2264 uint64_t half[16*2 + 17*2];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2265 uint8_t * const halfH= ((uint8_t*)half) + 256;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2266 uint8_t * const halfHV= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2267 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2268 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
2269 OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2270 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2271 static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2272 uint64_t half[17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2273 uint8_t * const halfH= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2274 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
2275 put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2276 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2277 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2278 static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2279 uint64_t half[17*2];\
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2280 uint8_t * const halfH= ((uint8_t*)half);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2281 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
2282 put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
2283 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2284 }\
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 1057
diff changeset
2285 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
2286 uint64_t half[17*2];\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2287 uint8_t * const halfH= ((uint8_t*)half);\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2288 put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2289 OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2290 }
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2291
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2292 #define QPEL_H264V(A,B,C,D,E,F,OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2293 "movd (%0), "#F" \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2294 "movq "#C", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2295 "paddw "#D", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2296 "psllw $2, %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2297 "psubw "#B", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2298 "psubw "#E", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2299 "pmullw %4, %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2300 "addl %2, %0 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2301 "punpcklbw %%mm7, "#F" \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2302 "paddw %5, "#A" \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2303 "paddw "#F", "#A" \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2304 "paddw "#A", %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2305 "psraw $5, %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2306 "packuswb %%mm6, %%mm6 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2307 OP(%%mm6, (%1), A, d)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2308 "addl %3, %1 \n\t"
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2309
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2310 #define QPEL_H264HV(A,B,C,D,E,F,OF)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2311 "movd (%0), "#F" \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2312 "movq "#C", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2313 "paddw "#D", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2314 "psllw $2, %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2315 "psubw "#B", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2316 "psubw "#E", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2317 "pmullw %3, %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2318 "addl %2, %0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2319 "punpcklbw %%mm7, "#F" \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2320 "paddw "#F", "#A" \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2321 "paddw "#A", %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2322 "movq %%mm6, "#OF"(%1) \n\t"
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2323
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2324 #define QPEL_H264(OPNAME, OP, MMX)\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2325 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
2326 int h=4;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2327 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2328 asm volatile(\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2329 "pxor %%mm7, %%mm7 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2330 "movq %5, %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2331 "movq %6, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2332 "1: \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2333 "movd -1(%0), %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2334 "movd (%0), %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2335 "movd 1(%0), %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2336 "movd 2(%0), %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2337 "punpcklbw %%mm7, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2338 "punpcklbw %%mm7, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2339 "punpcklbw %%mm7, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2340 "punpcklbw %%mm7, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2341 "paddw %%mm0, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2342 "paddw %%mm3, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2343 "movd -2(%0), %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2344 "movd 3(%0), %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2345 "punpcklbw %%mm7, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2346 "punpcklbw %%mm7, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2347 "paddw %%mm3, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2348 "psllw $2, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2349 "psubw %%mm1, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2350 "pmullw %%mm4, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2351 "paddw %%mm5, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2352 "paddw %%mm2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2353 "psraw $5, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2354 "packuswb %%mm0, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2355 OP(%%mm0, (%1),%%mm6, d)\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2356 "addl %3, %0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2357 "addl %4, %1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2358 "decl %2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2359 " jnz 1b \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2360 : "+a"(src), "+c"(dst), "+m"(h)\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2361 : "d"(srcStride), "S"(dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2362 : "memory"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2363 );\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2364 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2365 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
2366 src -= 2*srcStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2367 asm volatile(\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2368 "pxor %%mm7, %%mm7 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2369 "movd (%0), %%mm0 \n\t"\
2212
93091141f75e optimization
michael
parents: 2211
diff changeset
2370 "addl %2, %0 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2371 "movd (%0), %%mm1 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2372 "addl %2, %0 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2373 "movd (%0), %%mm2 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2374 "addl %2, %0 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2375 "movd (%0), %%mm3 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2376 "addl %2, %0 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2377 "movd (%0), %%mm4 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2378 "addl %2, %0 \n\t"\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2379 "punpcklbw %%mm7, %%mm0 \n\t"\
2212
93091141f75e optimization
michael
parents: 2211
diff changeset
2380 "punpcklbw %%mm7, %%mm1 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2381 "punpcklbw %%mm7, %%mm2 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2382 "punpcklbw %%mm7, %%mm3 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2383 "punpcklbw %%mm7, %%mm4 \n\t"\
93091141f75e optimization
michael
parents: 2211
diff changeset
2384 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2385 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2386 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2387 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2388 \
93091141f75e optimization
michael
parents: 2211
diff changeset
2389 : "+a"(src), "+c"(dst)\
93091141f75e optimization
michael
parents: 2211
diff changeset
2390 : "S"(srcStride), "D"(dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2391 : "memory"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2392 );\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2393 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2394 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
2395 int h=4;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2396 int w=3;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2397 src -= 2*srcStride+2;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2398 while(w--){\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2399 asm volatile(\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2400 "pxor %%mm7, %%mm7 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2401 "movd (%0), %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2402 "addl %2, %0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2403 "movd (%0), %%mm1 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2404 "addl %2, %0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2405 "movd (%0), %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2406 "addl %2, %0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2407 "movd (%0), %%mm3 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2408 "addl %2, %0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2409 "movd (%0), %%mm4 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2410 "addl %2, %0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2411 "punpcklbw %%mm7, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2412 "punpcklbw %%mm7, %%mm1 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2413 "punpcklbw %%mm7, %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2414 "punpcklbw %%mm7, %%mm3 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2415 "punpcklbw %%mm7, %%mm4 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2416 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*3)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2417 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*3)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2418 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*3)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2419 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*3)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2420 \
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2421 : "+a"(src)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2422 : "c"(tmp), "S"(srcStride), "m"(ff_pw_5)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2423 : "memory"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2424 );\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2425 tmp += 4;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2426 src += 4 - 9*srcStride;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2427 }\
2216
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2428 tmp -= 3*4;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2429 asm volatile(\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2430 "movq %4, %%mm6 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2431 "1: \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2432 "movq (%0), %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2433 "paddw 10(%0), %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2434 "movq 2(%0), %%mm1 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2435 "paddw 8(%0), %%mm1 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2436 "movq 4(%0), %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2437 "paddw 6(%0), %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2438 "psubw %%mm1, %%mm0 \n\t"/*a-b (abccba)*/\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2439 "psraw $2, %%mm0 \n\t"/*(a-b)/4 */\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2440 "psubw %%mm1, %%mm0 \n\t"/*(a-b)/4-b */\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2441 "paddsw %%mm2, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2442 "psraw $2, %%mm0 \n\t"/*((a-b)/4-b)/4 */\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2443 "paddw %%mm6, %%mm2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2444 "paddw %%mm2, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2445 "psraw $6, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2446 "packuswb %%mm0, %%mm0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2447 OP(%%mm0, (%1),%%mm7, d)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2448 "addl $24, %0 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2449 "addl %3, %1 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2450 "decl %2 \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2451 " jnz 1b \n\t"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2452 : "+a"(tmp), "+c"(dst), "+m"(h)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2453 : "S"(dstStride), "m"(ff_pw_32)\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2454 : "memory"\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2455 );\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2456 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2457 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2458 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
2459 int h=8;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2460 asm volatile(\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2461 "pxor %%mm7, %%mm7 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2462 "movq %5, %%mm6 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2463 "1: \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2464 "movq (%0), %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2465 "movq 1(%0), %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2466 "movq %%mm0, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2467 "movq %%mm2, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2468 "punpcklbw %%mm7, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2469 "punpckhbw %%mm7, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2470 "punpcklbw %%mm7, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2471 "punpckhbw %%mm7, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2472 "paddw %%mm2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2473 "paddw %%mm3, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2474 "psllw $2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2475 "psllw $2, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2476 "movq -1(%0), %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2477 "movq 2(%0), %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2478 "movq %%mm2, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2479 "movq %%mm4, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2480 "punpcklbw %%mm7, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2481 "punpckhbw %%mm7, %%mm3 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2482 "punpcklbw %%mm7, %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2483 "punpckhbw %%mm7, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2484 "paddw %%mm4, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2485 "paddw %%mm3, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2486 "psubw %%mm2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2487 "psubw %%mm5, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2488 "pmullw %%mm6, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2489 "pmullw %%mm6, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2490 "movd -2(%0), %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2491 "movd 7(%0), %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2492 "punpcklbw %%mm7, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2493 "punpcklbw %%mm7, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2494 "paddw %%mm3, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2495 "paddw %%mm5, %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2496 "movq %6, %%mm5 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2497 "paddw %%mm5, %%mm2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2498 "paddw %%mm5, %%mm4 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2499 "paddw %%mm2, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2500 "paddw %%mm4, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2501 "psraw $5, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2502 "psraw $5, %%mm1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2503 "packuswb %%mm1, %%mm0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2504 OP(%%mm0, (%1),%%mm5, q)\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2505 "addl %3, %0 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2506 "addl %4, %1 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2507 "decl %2 \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2508 " jnz 1b \n\t"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2509 : "+a"(src), "+c"(dst), "+m"(h)\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2510 : "d"(srcStride), "S"(dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2511 : "memory"\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2512 );\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2513 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2514 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2515 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
2516 int h= 2;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2517 src -= 2*srcStride;\
2210
e1c60876a0ae optimization
michael
parents: 2209
diff changeset
2518 \
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2519 while(h--){\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2520 asm volatile(\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2521 "pxor %%mm7, %%mm7 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2522 "movd (%0), %%mm0 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2523 "addl %2, %0 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2524 "movd (%0), %%mm1 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2525 "addl %2, %0 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2526 "movd (%0), %%mm2 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2527 "addl %2, %0 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2528 "movd (%0), %%mm3 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2529 "addl %2, %0 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2530 "movd (%0), %%mm4 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2531 "addl %2, %0 \n\t"\
2210
e1c60876a0ae optimization
michael
parents: 2209
diff changeset
2532 "punpcklbw %%mm7, %%mm0 \n\t"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2533 "punpcklbw %%mm7, %%mm1 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2534 "punpcklbw %%mm7, %%mm2 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2535 "punpcklbw %%mm7, %%mm3 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2536 "punpcklbw %%mm7, %%mm4 \n\t"\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2537 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2538 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2539 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2540 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2541 QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2542 QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2543 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2544 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2545 \
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2546 : "+a"(src), "+c"(dst)\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2547 : "S"(srcStride), "D"(dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2548 : "memory"\
2211
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2549 );\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2550 src += 4-13*srcStride;\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2551 dst += 4-8*dstStride;\
ee8e91ec869a optimization
michael
parents: 2210
diff changeset
2552 }\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2553 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2554 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
2555 int h=8;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2556 int w=4;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2557 src -= 2*srcStride+2;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2558 while(w--){\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2559 asm volatile(\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2560 "pxor %%mm7, %%mm7 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2561 "movd (%0), %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2562 "addl %2, %0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2563 "movd (%0), %%mm1 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2564 "addl %2, %0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2565 "movd (%0), %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2566 "addl %2, %0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2567 "movd (%0), %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2568 "addl %2, %0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2569 "movd (%0), %%mm4 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2570 "addl %2, %0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2571 "punpcklbw %%mm7, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2572 "punpcklbw %%mm7, %%mm1 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2573 "punpcklbw %%mm7, %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2574 "punpcklbw %%mm7, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2575 "punpcklbw %%mm7, %%mm4 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2576 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2577 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2578 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2579 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2580 QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2581 QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2582 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2583 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 7*8*4)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2584 \
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2585 : "+a"(src)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2586 : "c"(tmp), "S"(srcStride), "m"(ff_pw_5)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2587 : "memory"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2588 );\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2589 tmp += 4;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2590 src += 4 - 13*srcStride;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2591 }\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2592 tmp -= 4*4;\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2593 asm volatile(\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2594 "movq %4, %%mm6 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2595 "1: \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2596 "movq (%0), %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2597 "movq 8(%0), %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2598 "movq 2(%0), %%mm1 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2599 "movq 10(%0), %%mm4 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2600 "paddw %%mm4, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2601 "paddw %%mm3, %%mm1 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2602 "paddw 18(%0), %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2603 "paddw 16(%0), %%mm4 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2604 "movq 4(%0), %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2605 "movq 12(%0), %%mm5 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2606 "paddw 6(%0), %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2607 "paddw 14(%0), %%mm5 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2608 "psubw %%mm1, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2609 "psubw %%mm4, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2610 "psraw $2, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2611 "psraw $2, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2612 "psubw %%mm1, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2613 "psubw %%mm4, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2614 "paddsw %%mm2, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2615 "paddsw %%mm5, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2616 "psraw $2, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2617 "psraw $2, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2618 "paddw %%mm6, %%mm2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2619 "paddw %%mm6, %%mm5 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2620 "paddw %%mm2, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2621 "paddw %%mm5, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2622 "psraw $6, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2623 "psraw $6, %%mm3 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2624 "packuswb %%mm3, %%mm0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2625 OP(%%mm0, (%1),%%mm7, q)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2626 "addl $32, %0 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2627 "addl %3, %1 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2628 "decl %2 \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2629 " jnz 1b \n\t"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2630 : "+a"(tmp), "+c"(dst), "+m"(h)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2631 : "S"(dstStride), "m"(ff_pw_32)\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2632 : "memory"\
9492be49de46 h264_qpel8_hv_lowpass_mmx2/3dnow
michael
parents: 2216
diff changeset
2633 );\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2634 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2635 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
2636 OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2637 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
2638 src += 8*srcStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2639 dst += 8*dstStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2640 OPNAME ## h264_qpel8_v_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2641 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
2642 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2643 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2644 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
2645 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2646 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
2647 src += 8*srcStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2648 dst += 8*dstStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2649 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2650 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
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_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
2654 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
2655 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
2656 src += 8*srcStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2657 dst += 8*dstStride;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2658 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
2659 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
2660 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2661
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2662 #define H264_MC(OPNAME, SIZE, MMX) \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2663 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
2664 OPNAME ## pixels ## SIZE ## _mmx(dst, src, stride, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2665 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2666 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2667 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
2668 uint64_t temp[SIZE*SIZE/8];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2669 uint8_t * const half= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2670 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(half, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2671 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, half, stride, stride, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2672 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2673 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2674 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
2675 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2676 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2677 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2678 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
2679 uint64_t temp[SIZE*SIZE/8];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2680 uint8_t * const half= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2681 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(half, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2682 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
2683 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2684 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2685 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
2686 uint64_t temp[SIZE*SIZE/8];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2687 uint8_t * const half= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2688 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(half, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2689 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, half, stride, stride, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2690 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2691 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2692 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
2693 OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2694 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2695 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2696 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
2697 uint64_t temp[SIZE*SIZE/8];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2698 uint8_t * const half= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2699 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(half, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2700 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
2701 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2702 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2703 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
2704 uint64_t temp[SIZE*SIZE/4];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2705 uint8_t * const halfH= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2706 uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2707 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2708 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2709 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2710 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2711 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2712 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
2713 uint64_t temp[SIZE*SIZE/4];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2714 uint8_t * const halfH= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2715 uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2716 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2717 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
2718 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2719 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2720 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2721 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
2722 uint64_t temp[SIZE*SIZE/4];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2723 uint8_t * const halfH= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2724 uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2725 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
2726 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2727 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2728 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2729 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2730 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
2731 uint64_t temp[SIZE*SIZE/4];\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2732 uint8_t * const halfH= (uint8_t*)temp;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2733 uint8_t * const halfV= ((uint8_t*)temp) + SIZE*SIZE;\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2734 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
2735 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
2736 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2737 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2738 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2739 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
2740 uint64_t temp[SIZE*(SIZE+8)/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2741 int16_t * const tmp= (int16_t*)temp;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2742 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
2743 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2744 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2745 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
2746 uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2747 uint8_t * const halfH= (uint8_t*)temp;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2748 uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2749 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2750 put_h264_qpel ## SIZE ## _h_lowpass_ ## MMX(halfH, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2751 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
2752 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfHV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2753 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2754 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2755 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
2756 uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2757 uint8_t * const halfH= (uint8_t*)temp;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2758 uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2759 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2760 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
2761 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
2762 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfH, halfHV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2763 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2764 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2765 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
2766 uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2767 uint8_t * const halfV= (uint8_t*)temp;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2768 uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2769 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2770 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2771 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
2772 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfV, halfHV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2773 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2774 \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2775 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
2776 uint64_t temp[SIZE*(SIZE+8)/4 + SIZE*SIZE/4];\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2777 uint8_t * const halfV= (uint8_t*)temp;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2778 uint8_t * const halfHV= ((uint8_t*)temp) + SIZE*SIZE;\
1d6835102c51 h264_qpel4_hv_lowpass_mmx2/3dnow
michael
parents: 2212
diff changeset
2779 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE;\
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2780 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
2781 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
2782 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, halfV, halfHV, stride, SIZE, SIZE);\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2783 }\
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2784
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2785
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2786 #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
2787 #define AVG_3DNOW_OP(a,b,temp, size) \
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2788 "mov" #size " " #b ", " #temp " \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2789 "pavgusb " #temp ", " #a " \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2790 "mov" #size " " #a ", " #b " \n\t"
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2791 #define AVG_MMX2_OP(a,b,temp, size) \
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2792 "mov" #size " " #b ", " #temp " \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2793 "pavgb " #temp ", " #a " \n\t"\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2794 "mov" #size " " #a ", " #b " \n\t"
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2795
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2796 QPEL_BASE(put_ , ff_pw_16, _ , PUT_OP, PUT_OP)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2797 QPEL_BASE(avg_ , ff_pw_16, _ , AVG_MMX2_OP, AVG_3DNOW_OP)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2798 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
2799 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, 3dnow)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2800 QPEL_OP(avg_ , ff_pw_16, _ , AVG_3DNOW_OP, 3dnow)
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2801 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, 3dnow)
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2802 QPEL_OP(put_ , ff_pw_16, _ , PUT_OP, mmx2)
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
2803 QPEL_OP(avg_ , ff_pw_16, _ , AVG_MMX2_OP, mmx2)
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2804 QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2805
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2806 QPEL_H264(put_ , PUT_OP, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2807 QPEL_H264(avg_ , AVG_3DNOW_OP, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2808 QPEL_H264(put_ , PUT_OP, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2809 QPEL_H264(avg_ , AVG_MMX2_OP, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2810
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2811 H264_MC(put_, 4, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2812 H264_MC(put_, 8, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2813 H264_MC(put_, 16,3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2814 H264_MC(avg_, 4, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2815 H264_MC(avg_, 8, 3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2816 H264_MC(avg_, 16,3dnow)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2817 H264_MC(put_, 4, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2818 H264_MC(put_, 8, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2819 H264_MC(put_, 16,mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2820 H264_MC(avg_, 4, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2821 H264_MC(avg_, 8, mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2822 H264_MC(avg_, 16,mmx2)
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
2823
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
2824 #if 0
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
2825 static void just_return() { return; }
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
2826 #endif
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
2827
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2828 #define SET_QPEL_FUNC(postfix1, postfix2) \
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2829 c->put_ ## postfix1 = put_ ## postfix2;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2830 c->put_no_rnd_ ## postfix1 = put_no_rnd_ ## postfix2;\
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2831 c->avg_ ## postfix1 = avg_ ## postfix2;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2832
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2833 static int try_8x8basis_mmx(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2834 int i=0;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2835
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2836 assert(ABS(scale) < 256);
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2837 scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2838
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2839 asm volatile(
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2840 "pcmpeqw %%mm6, %%mm6 \n\t" // -1w
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2841 "psrlw $15, %%mm6 \n\t" // 1w
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2842 "pxor %%mm7, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2843 "movd %4, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2844 "punpcklwd %%mm5, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2845 "punpcklwd %%mm5, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2846 "1: \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2847 "movq (%1, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2848 "movq 8(%1, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2849 "pmulhw %%mm5, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2850 "pmulhw %%mm5, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2851 "paddw %%mm6, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2852 "paddw %%mm6, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2853 "psraw $1, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2854 "psraw $1, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2855 "paddw (%2, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2856 "paddw 8(%2, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2857 "psraw $6, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2858 "psraw $6, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2859 "pmullw (%3, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2860 "pmullw 8(%3, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2861 "pmaddwd %%mm0, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2862 "pmaddwd %%mm1, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2863 "paddd %%mm1, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2864 "psrld $4, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2865 "paddd %%mm0, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2866 "addl $16, %0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2867 "cmpl $128, %0 \n\t" //FIXME optimize & bench
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2868 " jb 1b \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2869 "movq %%mm7, %%mm6 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2870 "psrlq $32, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2871 "paddd %%mm6, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2872 "psrld $2, %%mm7 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2873 "movd %%mm7, %0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2874
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2875 : "+r" (i)
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2876 : "r"(basis), "r"(rem), "r"(weight), "g"(scale)
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2877 );
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2878 return i;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2879 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2880
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2881 static void add_8x8basis_mmx(int16_t rem[64], int16_t basis[64], int scale){
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2882 int i=0;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2883
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2884 if(ABS(scale) < 256){
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2885 scale<<= 16 + 1 - BASIS_SHIFT + RECON_SHIFT;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2886 asm volatile(
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2887 "pcmpeqw %%mm6, %%mm6 \n\t" // -1w
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2888 "psrlw $15, %%mm6 \n\t" // 1w
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2889 "movd %3, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2890 "punpcklwd %%mm5, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2891 "punpcklwd %%mm5, %%mm5 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2892 "1: \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2893 "movq (%1, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2894 "movq 8(%1, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2895 "pmulhw %%mm5, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2896 "pmulhw %%mm5, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2897 "paddw %%mm6, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2898 "paddw %%mm6, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2899 "psraw $1, %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2900 "psraw $1, %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2901 "paddw (%2, %0), %%mm0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2902 "paddw 8(%2, %0), %%mm1 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2903 "movq %%mm0, (%2, %0) \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2904 "movq %%mm1, 8(%2, %0) \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2905 "addl $16, %0 \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2906 "cmpl $128, %0 \n\t" //FIXME optimize & bench
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2907 " jb 1b \n\t"
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2908
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2909 : "+r" (i)
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2910 : "r"(basis), "r"(rem), "g"(scale)
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2911 );
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2912 }else{
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2913 for(i=0; i<8*8; i++){
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2914 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
2915 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2916 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2917 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
2918
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2919 /* external functions, from idct_mmx.c */
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2920 void ff_mmx_idct(DCTELEM *block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2921 void ff_mmxext_idct(DCTELEM *block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2922
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2923 /* XXX: those functions should be suppressed ASAP when all IDCTs are
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2924 converted */
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2925 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
2926 {
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2927 ff_mmx_idct (block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2928 put_pixels_clamped_mmx(block, dest, line_size);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2929 }
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2930 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
2931 {
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2932 ff_mmx_idct (block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2933 add_pixels_clamped_mmx(block, dest, line_size);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2934 }
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2935 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
2936 {
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2937 ff_mmxext_idct (block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2938 put_pixels_clamped_mmx(block, dest, line_size);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2939 }
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2940 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
2941 {
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2942 ff_mmxext_idct (block);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2943 add_pixels_clamped_mmx(block, dest, line_size);
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2944 }
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
2945
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2946 void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
2947 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
2948 mm_flags = mm_support();
1115
74a46d77e061 * support FF_MM_FORCE
kabi
parents: 1092
diff changeset
2949
1122
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
2950 if (avctx->dsp_mask) {
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
2951 if (avctx->dsp_mask & FF_MM_FORCE)
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
2952 mm_flags |= (avctx->dsp_mask & 0xffff);
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
2953 else
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
2954 mm_flags &= ~(avctx->dsp_mask & 0xffff);
ddc3b0140b8f * oooooops - sorry for this one - wrong logic
kabi
parents: 1115
diff changeset
2955 }
1115
74a46d77e061 * support FF_MM_FORCE
kabi
parents: 1092
diff changeset
2956
631
47a8964ba5cd be less verbose patch by (Lennert Buytenhek <buytenh at math dot leidenuniv dot nl>)
michaelni
parents: 629
diff changeset
2957 #if 0
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
2958 av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
2959 if (mm_flags & MM_MMX)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
2960 av_log(avctx, AV_LOG_INFO, " mmx");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
2961 if (mm_flags & MM_MMXEXT)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
2962 av_log(avctx, AV_LOG_INFO, " mmxext");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
2963 if (mm_flags & MM_3DNOW)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
2964 av_log(avctx, AV_LOG_INFO, " 3dnow");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
2965 if (mm_flags & MM_SSE)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
2966 av_log(avctx, AV_LOG_INFO, " sse");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
2967 if (mm_flags & MM_SSE2)
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
2968 av_log(avctx, AV_LOG_INFO, " sse2");
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
2969 av_log(avctx, AV_LOG_INFO, "\n");
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
2970 #endif
986e461dc072 Initial revision
glantau
parents:
diff changeset
2971
986e461dc072 Initial revision
glantau
parents:
diff changeset
2972 if (mm_flags & MM_MMX) {
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2973 const int idct_algo= avctx->idct_algo;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2974
1232
e88d3b1fb2a1 more #ifdef CONFIG_ENCODERS by (Wolfgang Hesseler <qv at multimediaware dot com>)
michaelni
parents: 1186
diff changeset
2975 #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
2976 const int dct_algo = avctx->dct_algo;
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
2977 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
2978 if(mm_flags & MM_SSE2){
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
2979 c->fdct = ff_fdct_sse2;
e31754bc5b65 SSE2 fdct by (Balatoni Denes <pnis at coder dot hu>)
michael
parents: 1739
diff changeset
2980 }else if(mm_flags & MM_MMXEXT){
1565
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
2981 c->fdct = ff_fdct_mmx2;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
2982 }else{
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
2983 c->fdct = ff_fdct_mmx;
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
2984 }
1a9a63f59849 minor mmx2 optimization if the dct
michael
parents: 1530
diff changeset
2985 }
1232
e88d3b1fb2a1 more #ifdef CONFIG_ENCODERS by (Wolfgang Hesseler <qv at multimediaware dot com>)
michaelni
parents: 1186
diff changeset
2986 #endif //CONFIG_ENCODERS
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2987
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2988 if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2989 c->idct_put= ff_simple_idct_put_mmx;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2990 c->idct_add= ff_simple_idct_add_mmx;
1324
7d328fd9d8a5 the return of the idct with 16bit output by ("Ivan Kalvachev" <ivan at cacad dot com>)
michaelni
parents: 1232
diff changeset
2991 c->idct = ff_simple_idct_mmx;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2992 c->idct_permutation_type= FF_SIMPLE_IDCT_PERM;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2993 }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2994 if(mm_flags & MM_MMXEXT){
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2995 c->idct_put= ff_libmpeg2mmx2_idct_put;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2996 c->idct_add= ff_libmpeg2mmx2_idct_add;
1324
7d328fd9d8a5 the return of the idct with 16bit output by ("Ivan Kalvachev" <ivan at cacad dot com>)
michaelni
parents: 1232
diff changeset
2997 c->idct = ff_mmxext_idct;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2998 }else{
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
2999 c->idct_put= ff_libmpeg2mmx_idct_put;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3000 c->idct_add= ff_libmpeg2mmx_idct_add;
1324
7d328fd9d8a5 the return of the idct with 16bit output by ("Ivan Kalvachev" <ivan at cacad dot com>)
michaelni
parents: 1232
diff changeset
3001 c->idct = ff_mmx_idct;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3002 }
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3003 c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3004 }
1868
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3005
771dcc2d4a0c use optimized VP3 functions where appropriate
melanson
parents: 1845
diff changeset
3006 /* VP3 optimized DSP functions */
1972
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3007 if (mm_flags & MM_SSE2) {
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3008 c->vp3_dsp_init = vp3_dsp_init_sse2;
1977
89422281f6f6 reorganize and simplify the VP3 IDCT stuff
melanson
parents: 1972
diff changeset
3009 c->vp3_idct = vp3_idct_sse2;
1972
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3010 } else {
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3011 c->vp3_dsp_init = vp3_dsp_init_mmx;
1977
89422281f6f6 reorganize and simplify the VP3 IDCT stuff
melanson
parents: 1972
diff changeset
3012 c->vp3_idct = vp3_idct_mmx;
1972
8a556283601d hook up support for SSE2-optimized VP3 IDCT
melanson
parents: 1868
diff changeset
3013 }
1977
89422281f6f6 reorganize and simplify the VP3 IDCT stuff
melanson
parents: 1972
diff changeset
3014
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3015 #ifdef CONFIG_ENCODERS
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3016 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
3017 c->diff_pixels = diff_pixels_mmx;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3018 #endif //CONFIG_ENCODERS
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3019 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
3020 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
3021 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
3022 c->clear_blocks = clear_blocks_mmx;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3023 #ifdef CONFIG_ENCODERS
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3024 c->pix_sum = pix_sum16_mmx;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3025 #endif //CONFIG_ENCODERS
415
1c3f42442fba * added simple test main - see comments about how to
kabi
parents: 402
diff changeset
3026
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3027 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
3028 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
3029 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
3030 c->put_pixels_tab[0][3] = put_pixels16_xy2_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3031
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3032 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
3033 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
3034 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
3035 c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_mmx;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3036
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3037 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
3038 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
3039 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
3040 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
3041
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3042 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
3043 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
3044 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
3045 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
3046
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3047 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
3048 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
3049 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
3050 c->put_pixels_tab[1][3] = put_pixels8_xy2_mmx;
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3051
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3052 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
3053 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
3054 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
3055 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_mmx;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3056
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3057 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
3058 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
3059 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
3060 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3061
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3062 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
3063 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
3064 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
3065 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
3066
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
3067 c->add_bytes= add_bytes_mmx;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3068 #ifdef CONFIG_ENCODERS
866
725ef4ea3ecc huffyuv
michaelni
parents: 853
diff changeset
3069 c->diff_bytes= diff_bytes_mmx;
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3070
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3071 c->hadamard8_diff[0]= hadamard8_diff16_mmx;
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3072 c->hadamard8_diff[1]= hadamard8_diff_mmx;
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3073
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
3074 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
3075 c->sse[0] = sse16_mmx;
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
3076 c->sse[1] = sse8_mmx;
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3077 c->vsad[4]= vsad_intra16_mmx;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3078
2067
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
3079 c->nsse[0] = nsse16_mmx;
f37b6ffc81ed sse8 and nsse in mmx
michael
parents: 2024
diff changeset
3080 c->nsse[1] = nsse8_mmx;
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3081 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3082 c->vsad[0] = vsad16_mmx;
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3083 }
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3084
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3085 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3086 c->try_8x8basis= try_8x8basis_mmx;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3087 }
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3088 c->add_8x8basis= add_8x8basis_mmx;
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3089
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3090 #endif //CONFIG_ENCODERS
1647
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
3091
c943c1d2d099 h263_v_loop_filter_mmx
michael
parents: 1566
diff changeset
3092 c->h263_v_loop_filter= h263_v_loop_filter_mmx;
1784
65f7bd09f37b quantizer noise shaping optimization
michael
parents: 1772
diff changeset
3093 c->h263_h_loop_filter= h263_h_loop_filter_mmx;
936
caa77cd960c0 qpel encoding
michaelni
parents: 866
diff changeset
3094
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3095 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
3096 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
3097 c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3098
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3099 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
3100 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
3101 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
3102
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3103 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
3104 c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3105
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3106 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
3107 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
3108 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3109
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3110 #ifdef CONFIG_ENCODERS
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
3111 c->hadamard8_diff[0]= hadamard8_diff16_mmx2;
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
3112 c->hadamard8_diff[1]= hadamard8_diff_mmx2;
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3113 c->vsad[4]= vsad_intra16_mmx2;
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3114 #endif //CONFIG_ENCODERS
1153
2725c8eb3c81 faster hadamard transform
michaelni
parents: 1122
diff changeset
3115
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3116 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3117 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
3118 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
3119 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
3120 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
3121 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3122 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
3123 #ifdef CONFIG_ENCODERS
1729
a4a5e7521339 interlaced dct decision cleanup
michael
parents: 1708
diff changeset
3124 c->vsad[0] = vsad16_mmx2;
1772
8cd5257195c9 vsad16_mmx2 only applies if encoders are turned on
melanson
parents: 1765
diff changeset
3125 #endif //CONFIG_ENCODERS
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3126 }
959
3ec070eef24a qpel in b frames bugfixes
michaelni
parents: 958
diff changeset
3127
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
3128 #if 1
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3129 SET_QPEL_FUNC(qpel_pixels_tab[0][ 0], qpel16_mc00_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3130 SET_QPEL_FUNC(qpel_pixels_tab[0][ 1], qpel16_mc10_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3131 SET_QPEL_FUNC(qpel_pixels_tab[0][ 2], qpel16_mc20_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3132 SET_QPEL_FUNC(qpel_pixels_tab[0][ 3], qpel16_mc30_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3133 SET_QPEL_FUNC(qpel_pixels_tab[0][ 4], qpel16_mc01_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3134 SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3135 SET_QPEL_FUNC(qpel_pixels_tab[0][ 6], qpel16_mc21_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3136 SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3137 SET_QPEL_FUNC(qpel_pixels_tab[0][ 8], qpel16_mc02_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3138 SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3139 SET_QPEL_FUNC(qpel_pixels_tab[0][10], qpel16_mc22_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3140 SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3141 SET_QPEL_FUNC(qpel_pixels_tab[0][12], qpel16_mc03_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3142 SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3143 SET_QPEL_FUNC(qpel_pixels_tab[0][14], qpel16_mc23_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3144 SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3145 SET_QPEL_FUNC(qpel_pixels_tab[1][ 0], qpel8_mc00_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3146 SET_QPEL_FUNC(qpel_pixels_tab[1][ 1], qpel8_mc10_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3147 SET_QPEL_FUNC(qpel_pixels_tab[1][ 2], qpel8_mc20_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3148 SET_QPEL_FUNC(qpel_pixels_tab[1][ 3], qpel8_mc30_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3149 SET_QPEL_FUNC(qpel_pixels_tab[1][ 4], qpel8_mc01_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3150 SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3151 SET_QPEL_FUNC(qpel_pixels_tab[1][ 6], qpel8_mc21_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3152 SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3153 SET_QPEL_FUNC(qpel_pixels_tab[1][ 8], qpel8_mc02_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3154 SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3155 SET_QPEL_FUNC(qpel_pixels_tab[1][10], qpel8_mc22_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3156 SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3157 SET_QPEL_FUNC(qpel_pixels_tab[1][12], qpel8_mc03_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3158 SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3159 SET_QPEL_FUNC(qpel_pixels_tab[1][14], qpel8_mc23_mmx2)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3160 SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_mmx2)
961
f8c5babc7b4e 1000l (push & esp) using mangle now ...
michaelni
parents: 959
diff changeset
3161 #endif
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
3162
2209
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3163 //FIXME 3dnow too
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3164 #define dspfunc(PFX, IDX, NUM) \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3165 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3166 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3167 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3168 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3169 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3170 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3171 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3172 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3173 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3174 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3175 c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3176 c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3177 c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3178 c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3179 c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_mmx2; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3180 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_mmx2
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3181
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3182 dspfunc(put_h264_qpel, 0, 16);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3183 dspfunc(put_h264_qpel, 1, 8);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3184 dspfunc(put_h264_qpel, 2, 4);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3185 dspfunc(avg_h264_qpel, 0, 16);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3186 dspfunc(avg_h264_qpel, 1, 8);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3187 dspfunc(avg_h264_qpel, 2, 4);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3188 #undef dspfunc
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3189
1686
68abbec33289 Here are juste two added #ifdef CONFIG_ENCODERS to allow
michael
parents: 1648
diff changeset
3190 #ifdef CONFIG_ENCODERS
1527
8ffd0c00e6df mmx2 optimization of huffyuv median encoding
michael
parents: 1324
diff changeset
3191 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
3192 #endif //CONFIG_ENCODERS
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3193 } 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
3194 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
3195 c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow;
393
bf164fce2c14 removed debug function
glantau
parents: 387
diff changeset
3196
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3197 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
3198 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
3199 c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow;
651
45e8f39fda50 put/avg_pixels16
michaelni
parents: 631
diff changeset
3200
853
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3201 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
3202 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
3203
eacc2dd8fd9d * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 706
diff changeset
3204 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
3205 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
3206 c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow;
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3207
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3208 if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3209 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
3210 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
3211 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
3212 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
3213 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3214 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow;
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3215 }
984
e162c09efbe7 qpel fix
michaelni
parents: 967
diff changeset
3216
954
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3217 SET_QPEL_FUNC(qpel_pixels_tab[0][ 0], qpel16_mc00_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3218 SET_QPEL_FUNC(qpel_pixels_tab[0][ 1], qpel16_mc10_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3219 SET_QPEL_FUNC(qpel_pixels_tab[0][ 2], qpel16_mc20_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3220 SET_QPEL_FUNC(qpel_pixels_tab[0][ 3], qpel16_mc30_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3221 SET_QPEL_FUNC(qpel_pixels_tab[0][ 4], qpel16_mc01_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3222 SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3223 SET_QPEL_FUNC(qpel_pixels_tab[0][ 6], qpel16_mc21_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3224 SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3225 SET_QPEL_FUNC(qpel_pixels_tab[0][ 8], qpel16_mc02_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3226 SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3227 SET_QPEL_FUNC(qpel_pixels_tab[0][10], qpel16_mc22_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3228 SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3229 SET_QPEL_FUNC(qpel_pixels_tab[0][12], qpel16_mc03_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3230 SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3231 SET_QPEL_FUNC(qpel_pixels_tab[0][14], qpel16_mc23_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3232 SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3233 SET_QPEL_FUNC(qpel_pixels_tab[1][ 0], qpel8_mc00_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3234 SET_QPEL_FUNC(qpel_pixels_tab[1][ 1], qpel8_mc10_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3235 SET_QPEL_FUNC(qpel_pixels_tab[1][ 2], qpel8_mc20_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3236 SET_QPEL_FUNC(qpel_pixels_tab[1][ 3], qpel8_mc30_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3237 SET_QPEL_FUNC(qpel_pixels_tab[1][ 4], qpel8_mc01_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3238 SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3239 SET_QPEL_FUNC(qpel_pixels_tab[1][ 6], qpel8_mc21_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3240 SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3241 SET_QPEL_FUNC(qpel_pixels_tab[1][ 8], qpel8_mc02_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3242 SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3243 SET_QPEL_FUNC(qpel_pixels_tab[1][10], qpel8_mc22_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3244 SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3245 SET_QPEL_FUNC(qpel_pixels_tab[1][12], qpel8_mc03_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3246 SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3247 SET_QPEL_FUNC(qpel_pixels_tab[1][14], qpel8_mc23_3dnow)
13aec7e50c52 qpel in mmx2/3dnow
michaelni
parents: 936
diff changeset
3248 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
3249
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3250 #define dspfunc(PFX, IDX, NUM) \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3251 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3252 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3253 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3254 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3255 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3256 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3257 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3258 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3259 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3260 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3261 c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3262 c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3263 c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3264 c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3265 c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_3dnow; \
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3266 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_3dnow
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3267
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3268 dspfunc(put_h264_qpel, 0, 16);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3269 dspfunc(put_h264_qpel, 1, 8);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3270 dspfunc(put_h264_qpel, 2, 4);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3271 dspfunc(avg_h264_qpel, 0, 16);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3272 dspfunc(avg_h264_qpel, 1, 8);
c4a476971abc h264 luma motion compensation in mmx2/3dnow
michael
parents: 2207
diff changeset
3273 dspfunc(avg_h264_qpel, 2, 4);
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3274 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
3275 }
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3276
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3277 #ifdef CONFIG_ENCODERS
1092
f59c3f66363b MpegEncContext.(i)dct_* -> DspContext.(i)dct_*
michaelni
parents: 1065
diff changeset
3278 dsputil_init_pix_mmx(c, avctx);
1530
3b31998fe22f disable encoders where appropriate (patch courtesy of BERO
melanson
parents: 1527
diff changeset
3279 #endif //CONFIG_ENCODERS
247
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3280 #if 0
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3281 // for speed testing
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3282 get_pixels = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3283 put_pixels_clamped = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3284 add_pixels_clamped = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3285
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3286 pix_abs16x16 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3287 pix_abs16x16_x2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3288 pix_abs16x16_y2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3289 pix_abs16x16_xy2 = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3290
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3291 put_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3292 put_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3293 put_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3294 put_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3295
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3296 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
3297 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
3298 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
3299 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
3300
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3301 avg_pixels_tab[0] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3302 avg_pixels_tab[1] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3303 avg_pixels_tab[2] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3304 avg_pixels_tab[3] = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3305
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3306 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
3307 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
3308 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
3309 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
3310
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3311 //av_fdct = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3312 //ff_idct = just_return;
6f48cacd9ed9 * some modifications to allow gcc to compile same code for -fPIC
kabi
parents: 188
diff changeset
3313 #endif
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
3314 }