annotate i386/h264dsp_mmx.c @ 6716:aa09311685b2 libavcodec

Transform codec names into single words. patch by Stefano Sabatini, stefano.sabatini-lala poste it
author diego
date Tue, 29 Apr 2008 07:11:59 +0000
parents e1208c4f8898
children 33896780c612
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1 /*
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
2 * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
3 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3645
diff changeset
4 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3645
diff changeset
5 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3645
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3645
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
10 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3645
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
14 * Lesser General Public License for more details.
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
15 *
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3645
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 3029
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
19 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
20
5946
55251379b5b1 make ff_p* vars extern so that they can be used in various *_mmx.c files
aurel
parents: 5809
diff changeset
21 #include "dsputil_mmx.h"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
22
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
23 /***********************************/
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
24 /* IDCT */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
25
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
26 #define SUMSUB_BADC( a, b, c, d ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
27 "paddw "#b", "#a" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
28 "paddw "#d", "#c" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
29 "paddw "#b", "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
30 "paddw "#d", "#d" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
31 "psubw "#a", "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
32 "psubw "#c", "#d" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
33
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
34 #define SUMSUBD2_AB( a, b, t ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
35 "movq "#b", "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
36 "psraw $1 , "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
37 "paddw "#a", "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
38 "psraw $1 , "#a" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
39 "psubw "#t", "#a" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
40
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
41 #define IDCT4_1D( s02, s13, d02, d13, t ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
42 SUMSUB_BA ( s02, d02 )\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
43 SUMSUBD2_AB( s13, d13, t )\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
44 SUMSUB_BADC( d13, s02, s13, d02 )
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
45
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
46 #define STORE_DIFF_4P( p, t, z ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
47 "psraw $6, "#p" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
48 "movd (%0), "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
49 "punpcklbw "#z", "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
50 "paddsw "#t", "#p" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
51 "packuswb "#z", "#p" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
52 "movd "#p", (%0) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
53
3173
9a2cc7b0fbdb h264_idct_add only needs mmx1
lorenm
parents: 3165
diff changeset
54 static void ff_h264_idct_add_mmx(uint8_t *dst, int16_t *block, int stride)
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
55 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
56 /* Load dct coeffs */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
57 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
58 "movq (%0), %%mm0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
59 "movq 8(%0), %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
60 "movq 16(%0), %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
61 "movq 24(%0), %%mm3 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
62 :: "r"(block) );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
63
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
64 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
65 /* mm1=s02+s13 mm2=s02-s13 mm4=d02+d13 mm0=d02-d13 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
66 IDCT4_1D( %%mm2, %%mm1, %%mm0, %%mm3, %%mm4 )
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
67
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
68 "movq %0, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
69 /* in: 1,4,0,2 out: 1,2,3,0 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
70 TRANSPOSE4( %%mm3, %%mm1, %%mm0, %%mm2, %%mm4 )
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
71
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
72 "paddw %%mm6, %%mm3 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
73
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
74 /* mm2=s02+s13 mm3=s02-s13 mm4=d02+d13 mm1=d02-d13 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
75 IDCT4_1D( %%mm4, %%mm2, %%mm3, %%mm0, %%mm1 )
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
76
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
77 "pxor %%mm7, %%mm7 \n\t"
6329
5969caa9190d clean up an ugliness introduced in r11826. this syntax will require fewer changes when adding future sse2 code.
lorenm
parents: 6321
diff changeset
78 :: "m"(ff_pw_32));
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
79
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
80 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
81 STORE_DIFF_4P( %%mm0, %%mm1, %%mm7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
82 "add %1, %0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
83 STORE_DIFF_4P( %%mm2, %%mm1, %%mm7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
84 "add %1, %0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
85 STORE_DIFF_4P( %%mm3, %%mm1, %%mm7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
86 "add %1, %0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
87 STORE_DIFF_4P( %%mm4, %%mm1, %%mm7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
88 : "+r"(dst)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
89 : "r" ((long)stride)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
90 );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
91 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
92
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
93 static inline void h264_idct8_1d(int16_t *block)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
94 {
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
95 asm volatile(
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
96 "movq 112(%0), %%mm7 \n\t"
6319
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
97 "movq 80(%0), %%mm0 \n\t"
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
98 "movq 48(%0), %%mm3 \n\t"
6319
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
99 "movq 16(%0), %%mm5 \n\t"
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
100
6319
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
101 "movq %%mm0, %%mm4 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
102 "movq %%mm5, %%mm1 \n\t"
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
103 "psraw $1, %%mm4 \n\t"
6319
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
104 "psraw $1, %%mm1 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
105 "paddw %%mm0, %%mm4 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
106 "paddw %%mm5, %%mm1 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
107 "paddw %%mm7, %%mm4 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
108 "paddw %%mm0, %%mm1 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
109 "psubw %%mm5, %%mm4 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
110 "paddw %%mm3, %%mm1 \n\t"
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
111
6319
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
112 "psubw %%mm3, %%mm5 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
113 "psubw %%mm3, %%mm0 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
114 "paddw %%mm7, %%mm5 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
115 "psubw %%mm7, %%mm0 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
116 "psraw $1, %%mm3 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
117 "psraw $1, %%mm7 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
118 "psubw %%mm3, %%mm5 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
119 "psubw %%mm7, %%mm0 \n\t"
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
120
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
121 "movq %%mm4, %%mm3 \n\t"
6319
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
122 "movq %%mm1, %%mm7 \n\t"
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
123 "psraw $2, %%mm1 \n\t"
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
124 "psraw $2, %%mm3 \n\t"
6319
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
125 "paddw %%mm5, %%mm3 \n\t"
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
126 "psraw $2, %%mm5 \n\t"
6319
4089a1ae6558 remove some movq in ff_h264_idct8_add_mmx. 225->217 cycles on core2.
lorenm
parents: 6135
diff changeset
127 "paddw %%mm0, %%mm1 \n\t"
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
128 "psraw $2, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
129 "psubw %%mm4, %%mm5 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
130 "psubw %%mm0, %%mm7 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
131
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
132 "movq 32(%0), %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
133 "movq 96(%0), %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
134 "movq %%mm2, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
135 "movq %%mm6, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
136 "psraw $1, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
137 "psraw $1, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
138 "psubw %%mm0, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
139 "paddw %%mm2, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
140
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
141 "movq (%0), %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
142 "movq 64(%0), %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
143 SUMSUB_BA( %%mm0, %%mm2 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
144 SUMSUB_BA( %%mm6, %%mm0 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
145 SUMSUB_BA( %%mm4, %%mm2 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
146 SUMSUB_BA( %%mm7, %%mm6 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
147 SUMSUB_BA( %%mm5, %%mm4 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
148 SUMSUB_BA( %%mm3, %%mm2 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
149 SUMSUB_BA( %%mm1, %%mm0 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
150 :: "r"(block)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
151 );
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
152 }
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
153
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
154 static void ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
155 {
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
156 int i;
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
157 int16_t __attribute__ ((aligned(8))) b2[64];
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
158
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
159 block[0] += 32;
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
160
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
161 for(i=0; i<2; i++){
4137
6e5dcbdbfeba ensure alignment (no speed change)
michael
parents: 4136
diff changeset
162 DECLARE_ALIGNED_8(uint64_t, tmp);
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
163
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
164 h264_idct8_1d(block+4*i);
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
165
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
166 asm volatile(
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
167 "movq %%mm7, %0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
168 TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
169 "movq %%mm0, 8(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
170 "movq %%mm6, 24(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
171 "movq %%mm7, 40(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
172 "movq %%mm4, 56(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
173 "movq %0, %%mm7 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
174 TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
175 "movq %%mm7, (%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
176 "movq %%mm1, 16(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
177 "movq %%mm0, 32(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
178 "movq %%mm3, 48(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
179 : "=m"(tmp)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
180 : "r"(b2+32*i)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
181 : "memory"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
182 );
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
183 }
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
184
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
185 for(i=0; i<2; i++){
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
186 h264_idct8_1d(b2+4*i);
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
187
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
188 asm volatile(
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
189 "psraw $6, %%mm7 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
190 "psraw $6, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
191 "psraw $6, %%mm5 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
192 "psraw $6, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
193 "psraw $6, %%mm3 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
194 "psraw $6, %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
195 "psraw $6, %%mm1 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
196 "psraw $6, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
197
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
198 "movq %%mm7, (%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
199 "movq %%mm5, 16(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
200 "movq %%mm3, 32(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
201 "movq %%mm1, 48(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
202 "movq %%mm0, 64(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
203 "movq %%mm2, 80(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
204 "movq %%mm4, 96(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
205 "movq %%mm6, 112(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
206 :: "r"(b2+4*i)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
207 : "memory"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
208 );
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
209 }
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
210
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
211 add_pixels_clamped_mmx(b2, dst, stride);
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
212 }
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
213
6320
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
214 #define STORE_DIFF_8P( p, d, t, z )\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
215 "movq "#d", "#t" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
216 "psraw $6, "#p" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
217 "punpcklbw "#z", "#t" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
218 "paddsw "#t", "#p" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
219 "packuswb "#p", "#p" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
220 "movq "#p", "#d" \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
221
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
222 #define H264_IDCT8_1D_SSE2(a,b,c,d,e,f,g,h)\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
223 "movdqa "#c", "#a" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
224 "movdqa "#g", "#e" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
225 "psraw $1, "#c" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
226 "psraw $1, "#g" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
227 "psubw "#e", "#c" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
228 "paddw "#a", "#g" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
229 "movdqa "#b", "#e" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
230 "psraw $1, "#e" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
231 "paddw "#b", "#e" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
232 "paddw "#d", "#e" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
233 "paddw "#f", "#e" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
234 "movdqa "#f", "#a" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
235 "psraw $1, "#a" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
236 "paddw "#f", "#a" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
237 "paddw "#h", "#a" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
238 "psubw "#b", "#a" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
239 "psubw "#d", "#b" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
240 "psubw "#d", "#f" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
241 "paddw "#h", "#b" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
242 "psubw "#h", "#f" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
243 "psraw $1, "#d" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
244 "psraw $1, "#h" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
245 "psubw "#d", "#b" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
246 "psubw "#h", "#f" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
247 "movdqa "#e", "#d" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
248 "movdqa "#a", "#h" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
249 "psraw $2, "#d" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
250 "psraw $2, "#h" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
251 "paddw "#f", "#d" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
252 "paddw "#b", "#h" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
253 "psraw $2, "#f" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
254 "psraw $2, "#b" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
255 "psubw "#f", "#e" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
256 "psubw "#a", "#b" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
257 "movdqa 0x00(%1), "#a" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
258 "movdqa 0x40(%1), "#f" \n"\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
259 SUMSUB_BA(f, a)\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
260 SUMSUB_BA(g, f)\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
261 SUMSUB_BA(c, a)\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
262 SUMSUB_BA(e, g)\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
263 SUMSUB_BA(b, c)\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
264 SUMSUB_BA(h, a)\
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
265 SUMSUB_BA(d, f)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
266
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
267 static void ff_h264_idct8_add_sse2(uint8_t *dst, int16_t *block, int stride)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
268 {
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
269 asm volatile(
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
270 "movdqa 0x10(%1), %%xmm1 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
271 "movdqa 0x20(%1), %%xmm2 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
272 "movdqa 0x30(%1), %%xmm3 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
273 "movdqa 0x50(%1), %%xmm5 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
274 "movdqa 0x60(%1), %%xmm6 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
275 "movdqa 0x70(%1), %%xmm7 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
276 H264_IDCT8_1D_SSE2(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
277 TRANSPOSE8(%%xmm4, %%xmm1, %%xmm7, %%xmm3, %%xmm5, %%xmm0, %%xmm2, %%xmm6, (%1))
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
278 "paddw %4, %%xmm4 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
279 "movdqa %%xmm4, 0x00(%1) \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
280 "movdqa %%xmm2, 0x40(%1) \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
281 H264_IDCT8_1D_SSE2(%%xmm4, %%xmm0, %%xmm6, %%xmm3, %%xmm2, %%xmm5, %%xmm7, %%xmm1)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
282 "movdqa %%xmm6, 0x60(%1) \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
283 "movdqa %%xmm7, 0x70(%1) \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
284 "pxor %%xmm7, %%xmm7 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
285 STORE_DIFF_8P(%%xmm2, (%0), %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
286 STORE_DIFF_8P(%%xmm0, (%0,%2), %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
287 STORE_DIFF_8P(%%xmm1, (%0,%2,2), %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
288 STORE_DIFF_8P(%%xmm3, (%0,%3), %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
289 "lea (%0,%2,4), %0 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
290 STORE_DIFF_8P(%%xmm5, (%0), %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
291 STORE_DIFF_8P(%%xmm4, (%0,%2), %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
292 "movdqa 0x60(%1), %%xmm0 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
293 "movdqa 0x70(%1), %%xmm1 \n"
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
294 STORE_DIFF_8P(%%xmm0, (%0,%2,2), %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
295 STORE_DIFF_8P(%%xmm1, (%0,%3), %%xmm6, %%xmm7)
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
296 :"+r"(dst)
6329
5969caa9190d clean up an ugliness introduced in r11826. this syntax will require fewer changes when adding future sse2 code.
lorenm
parents: 6321
diff changeset
297 :"r"(block), "r"((long)stride), "r"(3L*stride), "m"(ff_pw_32)
6320
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
298 );
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
299 }
ffb2a7b80d6d ff_h264_idct8_add_sse2.
lorenm
parents: 6319
diff changeset
300
3173
9a2cc7b0fbdb h264_idct_add only needs mmx1
lorenm
parents: 3165
diff changeset
301 static void ff_h264_idct_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
3105
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
302 {
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
303 int dc = (block[0] + 32) >> 6;
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
304 asm volatile(
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
305 "movd %0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
306 "pshufw $0, %%mm0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
307 "pxor %%mm1, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
308 "psubw %%mm0, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
309 "packuswb %%mm0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
310 "packuswb %%mm1, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
311 ::"r"(dc)
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
312 );
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
313 asm volatile(
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
314 "movd %0, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
315 "movd %1, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
316 "movd %2, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
317 "movd %3, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
318 "paddusb %%mm0, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
319 "paddusb %%mm0, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
320 "paddusb %%mm0, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
321 "paddusb %%mm0, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
322 "psubusb %%mm1, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
323 "psubusb %%mm1, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
324 "psubusb %%mm1, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
325 "psubusb %%mm1, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
326 "movd %%mm2, %0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
327 "movd %%mm3, %1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
328 "movd %%mm4, %2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
329 "movd %%mm5, %3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
330 :"+m"(*(uint32_t*)(dst+0*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
331 "+m"(*(uint32_t*)(dst+1*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
332 "+m"(*(uint32_t*)(dst+2*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
333 "+m"(*(uint32_t*)(dst+3*stride))
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
334 );
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
335 }
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
336
3173
9a2cc7b0fbdb h264_idct_add only needs mmx1
lorenm
parents: 3165
diff changeset
337 static void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
3105
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
338 {
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
339 int dc = (block[0] + 32) >> 6;
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
340 int y;
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
341 asm volatile(
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
342 "movd %0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
343 "pshufw $0, %%mm0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
344 "pxor %%mm1, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
345 "psubw %%mm0, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
346 "packuswb %%mm0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
347 "packuswb %%mm1, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
348 ::"r"(dc)
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
349 );
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
350 for(y=2; y--; dst += 4*stride){
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
351 asm volatile(
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
352 "movq %0, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
353 "movq %1, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
354 "movq %2, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
355 "movq %3, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
356 "paddusb %%mm0, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
357 "paddusb %%mm0, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
358 "paddusb %%mm0, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
359 "paddusb %%mm0, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
360 "psubusb %%mm1, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
361 "psubusb %%mm1, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
362 "psubusb %%mm1, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
363 "psubusb %%mm1, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
364 "movq %%mm2, %0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
365 "movq %%mm3, %1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
366 "movq %%mm4, %2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
367 "movq %%mm5, %3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
368 :"+m"(*(uint64_t*)(dst+0*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
369 "+m"(*(uint64_t*)(dst+1*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
370 "+m"(*(uint64_t*)(dst+2*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
371 "+m"(*(uint64_t*)(dst+3*stride))
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
372 );
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
373 }
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
374 }
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
375
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
376
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
377 /***********************************/
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
378 /* deblocking */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
379
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
380 // out: o = |x-y|>a
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
381 // clobbers: t
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
382 #define DIFF_GT_MMX(x,y,a,o,t)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
383 "movq "#y", "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
384 "movq "#x", "#o" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
385 "psubusb "#x", "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
386 "psubusb "#y", "#o" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
387 "por "#t", "#o" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
388 "psubusb "#a", "#o" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
389
4135
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
390 // out: o = |x-y|>a
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
391 // clobbers: t
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
392 #define DIFF_GT2_MMX(x,y,a,o,t)\
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
393 "movq "#y", "#t" \n\t"\
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
394 "movq "#x", "#o" \n\t"\
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
395 "psubusb "#x", "#t" \n\t"\
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
396 "psubusb "#y", "#o" \n\t"\
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
397 "psubusb "#a", "#t" \n\t"\
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
398 "psubusb "#a", "#o" \n\t"\
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
399 "pcmpeqb "#t", "#o" \n\t"\
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
400
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
401 // in: mm0=p1 mm1=p0 mm2=q0 mm3=q1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
402 // out: mm5=beta-1, mm7=mask
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
403 // clobbers: mm4,mm6
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
404 #define H264_DEBLOCK_MASK(alpha1, beta1) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
405 "pshufw $0, "#alpha1", %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
406 "pshufw $0, "#beta1 ", %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
407 "packuswb %%mm4, %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
408 "packuswb %%mm5, %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
409 DIFF_GT_MMX(%%mm1, %%mm2, %%mm4, %%mm7, %%mm6) /* |p0-q0| > alpha-1 */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
410 DIFF_GT_MMX(%%mm0, %%mm1, %%mm5, %%mm4, %%mm6) /* |p1-p0| > beta-1 */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
411 "por %%mm4, %%mm7 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
412 DIFF_GT_MMX(%%mm3, %%mm2, %%mm5, %%mm4, %%mm6) /* |q1-q0| > beta-1 */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
413 "por %%mm4, %%mm7 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
414 "pxor %%mm6, %%mm6 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
415 "pcmpeqb %%mm6, %%mm7 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
416
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
417 // in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 mm7=(tc&mask)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
418 // out: mm1=p0' mm2=q0'
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
419 // clobbers: mm0,3-6
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
420 #define H264_DEBLOCK_P0_Q0(pb_01, pb_3f)\
4127
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
421 "movq %%mm1 , %%mm5 \n\t"\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
422 "pxor %%mm2 , %%mm5 \n\t" /* p0^q0*/\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
423 "pand "#pb_01" , %%mm5 \n\t" /* (p0^q0)&1*/\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
424 "pcmpeqb %%mm4 , %%mm4 \n\t"\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
425 "pxor %%mm4 , %%mm3 \n\t"\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
426 "pavgb %%mm0 , %%mm3 \n\t" /* (p1 - q1 + 256)>>1*/\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
427 "pavgb "MANGLE(ff_pb_3)" , %%mm3 \n\t" /*(((p1 - q1 + 256)>>1)+4)>>1 = 64+2+(p1-q1)>>2*/\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
428 "pxor %%mm1 , %%mm4 \n\t"\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
429 "pavgb %%mm2 , %%mm4 \n\t" /* (q0 - p0 + 256)>>1*/\
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
430 "pavgb %%mm5 , %%mm3 \n\t"\
4130
226f53a6fcc2 preempt possible overflow
michael
parents: 4129
diff changeset
431 "paddusb %%mm4 , %%mm3 \n\t" /* d+128+33*/\
4129
c5117bef5175 1 instruction less
michael
parents: 4127
diff changeset
432 "movq "MANGLE(ff_pb_A1)" , %%mm6 \n\t"\
c5117bef5175 1 instruction less
michael
parents: 4127
diff changeset
433 "psubusb %%mm3 , %%mm6 \n\t"\
4127
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
434 "psubusb "MANGLE(ff_pb_A1)" , %%mm3 \n\t"\
4129
c5117bef5175 1 instruction less
michael
parents: 4127
diff changeset
435 "pminub %%mm7 , %%mm6 \n\t"\
4127
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
436 "pminub %%mm7 , %%mm3 \n\t"\
4129
c5117bef5175 1 instruction less
michael
parents: 4127
diff changeset
437 "psubusb %%mm6 , %%mm1 \n\t"\
c5117bef5175 1 instruction less
michael
parents: 4127
diff changeset
438 "psubusb %%mm3 , %%mm2 \n\t"\
4127
d011a097bb85 optimize H264_DEBLOCK_P0_Q0
michael
parents: 3947
diff changeset
439 "paddusb %%mm3 , %%mm1 \n\t"\
4129
c5117bef5175 1 instruction less
michael
parents: 4127
diff changeset
440 "paddusb %%mm6 , %%mm2 \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
441
5947
37a03989871b use ff_ prefix for extern vars
aurel
parents: 5946
diff changeset
442 // in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 mm7=(tc&mask) %8=ff_bone
4866
6c66ddbb054f Fix parts missed in clip -> av_clip rename
reimar
parents: 4528
diff changeset
443 // out: (q1addr) = av_clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 )
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
444 // clobbers: q2, tmp, tc0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
445 #define H264_DEBLOCK_Q1(p1, q2, q2addr, q1addr, tc0, tmp)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
446 "movq %%mm1, "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
447 "pavgb %%mm2, "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
448 "pavgb "#tmp", "#q2" \n\t" /* avg(p2,avg(p0,q0)) */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
449 "pxor "q2addr", "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
450 "pand %8, "#tmp" \n\t" /* (p2^avg(p0,q0))&1 */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
451 "psubusb "#tmp", "#q2" \n\t" /* (p2+((p0+q0+1)>>1))>>1 */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
452 "movq "#p1", "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
453 "psubusb "#tc0", "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
454 "paddusb "#p1", "#tc0" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
455 "pmaxub "#tmp", "#q2" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
456 "pminub "#tc0", "#q2" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
457 "movq "#q2", "q1addr" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
458
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
459 static inline void h264_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha1, int beta1, int8_t *tc0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
460 {
4137
6e5dcbdbfeba ensure alignment (no speed change)
michael
parents: 4136
diff changeset
461 DECLARE_ALIGNED_8(uint64_t, tmp0[2]);
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
462
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
463 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
464 "movq (%1,%3), %%mm0 \n\t" //p1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
465 "movq (%1,%3,2), %%mm1 \n\t" //p0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
466 "movq (%2), %%mm2 \n\t" //q0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
467 "movq (%2,%3), %%mm3 \n\t" //q1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
468 H264_DEBLOCK_MASK(%6, %7)
4133
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
469
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
470 "movd %5, %%mm4 \n\t"
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
471 "punpcklbw %%mm4, %%mm4 \n\t"
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
472 "punpcklwd %%mm4, %%mm4 \n\t"
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
473 "pcmpeqb %%mm3, %%mm3 \n\t"
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
474 "movq %%mm4, %%mm6 \n\t"
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
475 "pcmpgtb %%mm3, %%mm4 \n\t"
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
476 "movq %%mm6, 8+%0 \n\t"
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
477 "pand %%mm4, %%mm7 \n\t"
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
478 "movq %%mm7, %0 \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
479
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
480 /* filter p1 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
481 "movq (%1), %%mm3 \n\t" //p2
4135
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
482 DIFF_GT2_MMX(%%mm1, %%mm3, %%mm5, %%mm6, %%mm4) // |p2-p0|>beta-1
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
483 "pand %%mm7, %%mm6 \n\t" // mask & |p2-p0|<beta
4136
05ffda007f80 merging mov & and (no speedchange)
michael
parents: 4135
diff changeset
484 "pand 8+%0, %%mm7 \n\t" // mask & tc0
05ffda007f80 merging mov & and (no speedchange)
michael
parents: 4135
diff changeset
485 "movq %%mm7, %%mm4 \n\t"
4131
1a8e384d0463 2 instructions less in h264_loop_filter_luma_mmx2()
michael
parents: 4130
diff changeset
486 "psubb %%mm6, %%mm7 \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
487 "pand %%mm4, %%mm6 \n\t" // mask & |p2-p0|<beta & tc0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
488 H264_DEBLOCK_Q1(%%mm0, %%mm3, "(%1)", "(%1,%3)", %%mm6, %%mm4)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
489
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
490 /* filter q1 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
491 "movq (%2,%3,2), %%mm4 \n\t" //q2
4135
bbf0caa655f0 2 instructions less (same speed)
michael
parents: 4134
diff changeset
492 DIFF_GT2_MMX(%%mm2, %%mm4, %%mm5, %%mm6, %%mm3) // |q2-q0|>beta-1
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
493 "pand %0, %%mm6 \n\t"
4134
3d2887b288f4 comment about failed optimization
michael
parents: 4133
diff changeset
494 "movq 8+%0, %%mm5 \n\t" // can be merged with the and below but is slower then
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
495 "pand %%mm6, %%mm5 \n\t"
4131
1a8e384d0463 2 instructions less in h264_loop_filter_luma_mmx2()
michael
parents: 4130
diff changeset
496 "psubb %%mm6, %%mm7 \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
497 "movq (%2,%3), %%mm3 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
498 H264_DEBLOCK_Q1(%%mm3, %%mm4, "(%2,%3,2)", "(%2,%3)", %%mm5, %%mm6)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
499
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
500 /* filter p0, q0 */
4133
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
501 H264_DEBLOCK_P0_Q0(%8, unused)
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
502 "movq %%mm1, (%1,%3,2) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
503 "movq %%mm2, (%2) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
504
4133
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
505 : "=m"(*tmp0)
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
506 : "r"(pix-3*stride), "r"(pix), "r"((long)stride),
4133
560ea2d5524e move luma tc0 related init into asm
michael
parents: 4131
diff changeset
507 "m"(*tmp0/*unused*/), "m"(*(uint32_t*)tc0), "m"(alpha1), "m"(beta1),
5947
37a03989871b use ff_ prefix for extern vars
aurel
parents: 5946
diff changeset
508 "m"(ff_bone)
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
509 );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
510 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
511
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
512 static void h264_v_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
513 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
514 if((tc0[0] & tc0[1]) >= 0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
515 h264_loop_filter_luma_mmx2(pix, stride, alpha-1, beta-1, tc0);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
516 if((tc0[2] & tc0[3]) >= 0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
517 h264_loop_filter_luma_mmx2(pix+8, stride, alpha-1, beta-1, tc0+2);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
518 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
519 static void h264_h_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
520 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
521 //FIXME: could cut some load/stores by merging transpose with filter
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
522 // also, it only needs to transpose 6x8
4137
6e5dcbdbfeba ensure alignment (no speed change)
michael
parents: 4136
diff changeset
523 DECLARE_ALIGNED_8(uint8_t, trans[8*8]);
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
524 int i;
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
525 for(i=0; i<2; i++, pix+=8*stride, tc0+=2) {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
526 if((tc0[0] & tc0[1]) < 0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
527 continue;
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
528 transpose4x4(trans, pix-4, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
529 transpose4x4(trans +4*8, pix, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
530 transpose4x4(trans+4, pix-4+4*stride, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
531 transpose4x4(trans+4+4*8, pix +4*stride, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
532 h264_loop_filter_luma_mmx2(trans+4*8, 8, alpha-1, beta-1, tc0);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
533 transpose4x4(pix-2, trans +2*8, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
534 transpose4x4(pix-2+4*stride, trans+4+2*8, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
535 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
536 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
537
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
538 static inline void h264_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha1, int beta1, int8_t *tc0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
539 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
540 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
541 "movq (%0), %%mm0 \n\t" //p1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
542 "movq (%0,%2), %%mm1 \n\t" //p0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
543 "movq (%1), %%mm2 \n\t" //q0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
544 "movq (%1,%2), %%mm3 \n\t" //q1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
545 H264_DEBLOCK_MASK(%4, %5)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
546 "movd %3, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
547 "punpcklbw %%mm6, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
548 "pand %%mm6, %%mm7 \n\t" // mm7 = tc&mask
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
549 H264_DEBLOCK_P0_Q0(%6, %7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
550 "movq %%mm1, (%0,%2) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
551 "movq %%mm2, (%1) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
552
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
553 :: "r"(pix-2*stride), "r"(pix), "r"((long)stride),
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
554 "r"(*(uint32_t*)tc0),
5947
37a03989871b use ff_ prefix for extern vars
aurel
parents: 5946
diff changeset
555 "m"(alpha1), "m"(beta1), "m"(ff_bone), "m"(ff_pb_3F)
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
556 );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
557 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
558
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
559 static void h264_v_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
560 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
561 h264_loop_filter_chroma_mmx2(pix, stride, alpha-1, beta-1, tc0);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
562 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
563
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
564 static void h264_h_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
565 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
566 //FIXME: could cut some load/stores by merging transpose with filter
4137
6e5dcbdbfeba ensure alignment (no speed change)
michael
parents: 4136
diff changeset
567 DECLARE_ALIGNED_8(uint8_t, trans[8*4]);
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
568 transpose4x4(trans, pix-2, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
569 transpose4x4(trans+4, pix-2+4*stride, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
570 h264_loop_filter_chroma_mmx2(trans+2*8, 8, alpha-1, beta-1, tc0);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
571 transpose4x4(pix-2, trans, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
572 transpose4x4(pix-2+4*stride, trans+4, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
573 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
574
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
575 // p0 = (p0 + q1 + 2*p1 + 2) >> 2
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
576 #define H264_FILTER_CHROMA4(p0, p1, q1, one) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
577 "movq "#p0", %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
578 "pxor "#q1", %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
579 "pand "#one", %%mm4 \n\t" /* mm4 = (p0^q1)&1 */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
580 "pavgb "#q1", "#p0" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
581 "psubusb %%mm4, "#p0" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
582 "pavgb "#p1", "#p0" \n\t" /* dst = avg(p1, avg(p0,q1) - ((p0^q1)&1)) */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
583
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
584 static inline void h264_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha1, int beta1)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
585 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
586 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
587 "movq (%0), %%mm0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
588 "movq (%0,%2), %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
589 "movq (%1), %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
590 "movq (%1,%2), %%mm3 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
591 H264_DEBLOCK_MASK(%3, %4)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
592 "movq %%mm1, %%mm5 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
593 "movq %%mm2, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
594 H264_FILTER_CHROMA4(%%mm1, %%mm0, %%mm3, %5) //p0'
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
595 H264_FILTER_CHROMA4(%%mm2, %%mm3, %%mm0, %5) //q0'
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
596 "psubb %%mm5, %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
597 "psubb %%mm6, %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
598 "pand %%mm7, %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
599 "pand %%mm7, %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
600 "paddb %%mm5, %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
601 "paddb %%mm6, %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
602 "movq %%mm1, (%0,%2) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
603 "movq %%mm2, (%1) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
604 :: "r"(pix-2*stride), "r"(pix), "r"((long)stride),
5947
37a03989871b use ff_ prefix for extern vars
aurel
parents: 5946
diff changeset
605 "m"(alpha1), "m"(beta1), "m"(ff_bone)
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
606 );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
607 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
608
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
609 static void h264_v_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
610 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
611 h264_loop_filter_chroma_intra_mmx2(pix, stride, alpha-1, beta-1);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
612 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
613
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
614 static void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
615 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
616 //FIXME: could cut some load/stores by merging transpose with filter
4137
6e5dcbdbfeba ensure alignment (no speed change)
michael
parents: 4136
diff changeset
617 DECLARE_ALIGNED_8(uint8_t, trans[8*4]);
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
618 transpose4x4(trans, pix-2, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
619 transpose4x4(trans+4, pix-2+4*stride, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
620 h264_loop_filter_chroma_intra_mmx2(trans+2*8, 8, alpha-1, beta-1);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
621 transpose4x4(pix-2, trans, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
622 transpose4x4(pix-2+4*stride, trans+4, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
623 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
624
3645
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
625 static void h264_loop_filter_strength_mmx2( int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2],
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
626 int bidir, int edges, int step, int mask_mv0, int mask_mv1 ) {
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
627 int dir;
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
628 asm volatile(
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
629 "pxor %%mm7, %%mm7 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
630 "movq %0, %%mm6 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
631 "movq %1, %%mm5 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
632 "movq %2, %%mm4 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
633 ::"m"(ff_pb_1), "m"(ff_pb_3), "m"(ff_pb_7)
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
634 );
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
635 // could do a special case for dir==0 && edges==1, but it only reduces the
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
636 // average filter time by 1.2%
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
637 for( dir=1; dir>=0; dir-- ) {
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
638 const int d_idx = dir ? -8 : -1;
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
639 const int mask_mv = dir ? mask_mv1 : mask_mv0;
4137
6e5dcbdbfeba ensure alignment (no speed change)
michael
parents: 4136
diff changeset
640 DECLARE_ALIGNED_8(const uint64_t, mask_dir) = dir ? 0 : 0xffffffffffffffffULL;
3645
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
641 int b_idx, edge, l;
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
642 for( b_idx=12, edge=0; edge<edges; edge+=step, b_idx+=8*step ) {
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
643 asm volatile(
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
644 "pand %0, %%mm0 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
645 ::"m"(mask_dir)
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
646 );
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
647 if(!(mask_mv & edge)) {
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
648 asm volatile("pxor %%mm0, %%mm0 \n\t":);
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
649 for( l = bidir; l >= 0; l-- ) {
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
650 asm volatile(
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
651 "movd %0, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
652 "punpckldq %1, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
653 "movq %%mm1, %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
654 "psrlw $7, %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
655 "pand %%mm6, %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
656 "por %%mm2, %%mm1 \n\t" // ref_cache with -2 mapped to -1
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
657 "punpckldq %%mm1, %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
658 "pcmpeqb %%mm2, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
659 "paddb %%mm6, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
660 "punpckhbw %%mm7, %%mm1 \n\t" // ref[b] != ref[bn]
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
661 "por %%mm1, %%mm0 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
662
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
663 "movq %2, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
664 "movq %3, %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
665 "psubw %4, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
666 "psubw %5, %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
667 "packsswb %%mm2, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
668 "paddb %%mm5, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
669 "pminub %%mm4, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
670 "pcmpeqb %%mm4, %%mm1 \n\t" // abs(mv[b] - mv[bn]) >= limit
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
671 "por %%mm1, %%mm0 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
672 ::"m"(ref[l][b_idx]),
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
673 "m"(ref[l][b_idx+d_idx]),
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
674 "m"(mv[l][b_idx][0]),
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
675 "m"(mv[l][b_idx+2][0]),
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
676 "m"(mv[l][b_idx+d_idx][0]),
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
677 "m"(mv[l][b_idx+d_idx+2][0])
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
678 );
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
679 }
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
680 }
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
681 asm volatile(
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
682 "movd %0, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
683 "por %1, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
684 "punpcklbw %%mm7, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
685 "pcmpgtw %%mm7, %%mm1 \n\t" // nnz[b] || nnz[bn]
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
686 ::"m"(nnz[b_idx]),
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
687 "m"(nnz[b_idx+d_idx])
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
688 );
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
689 asm volatile(
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
690 "pcmpeqw %%mm7, %%mm0 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
691 "pcmpeqw %%mm7, %%mm0 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
692 "psrlw $15, %%mm0 \n\t" // nonzero -> 1
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
693 "psrlw $14, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
694 "movq %%mm0, %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
695 "por %%mm1, %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
696 "psrlw $1, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
697 "pandn %%mm2, %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
698 "movq %%mm1, %0 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
699 :"=m"(*bS[dir][edge])
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
700 ::"memory"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
701 );
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
702 }
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
703 edges = 4;
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
704 step = 1;
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
705 }
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
706 asm volatile(
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
707 "movq (%0), %%mm0 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
708 "movq 8(%0), %%mm1 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
709 "movq 16(%0), %%mm2 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
710 "movq 24(%0), %%mm3 \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
711 TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4)
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
712 "movq %%mm0, (%0) \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
713 "movq %%mm3, 8(%0) \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
714 "movq %%mm4, 16(%0) \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
715 "movq %%mm2, 24(%0) \n\t"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
716 ::"r"(bS[0])
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
717 :"memory"
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
718 );
47821be55b6c mmx implementation of deblocking strength decision.
lorenm
parents: 3394
diff changeset
719 }
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
720
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
721 /***********************************/
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
722 /* motion compensation */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
723
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
724 #define QPEL_H264V_MM(A,B,C,D,E,F,OP,T,Z,d,q)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
725 "mov"#q" "#C", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
726 "mov"#d" (%0), "#F" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
727 "paddw "#D", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
728 "psllw $2, "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
729 "psubw "#B", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
730 "psubw "#E", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
731 "punpcklbw "#Z", "#F" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
732 "pmullw %4, "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
733 "paddw %5, "#A" \n\t"\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
734 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
735 "paddw "#F", "#A" \n\t"\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
736 "paddw "#A", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
737 "psraw $5, "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
738 "packuswb "#T", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
739 OP(T, (%1), A, d)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
740 "add %3, %1 \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
741
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
742 #define QPEL_H264HV_MM(A,B,C,D,E,F,OF,T,Z,d,q)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
743 "mov"#q" "#C", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
744 "mov"#d" (%0), "#F" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
745 "paddw "#D", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
746 "psllw $2, "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
747 "paddw %4, "#A" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
748 "psubw "#B", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
749 "psubw "#E", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
750 "punpcklbw "#Z", "#F" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
751 "pmullw %3, "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
752 "paddw "#F", "#A" \n\t"\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
753 "add %2, %0 \n\t"\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
754 "paddw "#A", "#T" \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
755 "mov"#q" "#T", "#OF"(%1) \n\t"
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
756
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
757 #define QPEL_H264V(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%mm6,%%mm7,d,q)
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
758 #define QPEL_H264HV(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%mm6,%%mm7,d,q)
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
759 #define QPEL_H264V_XMM(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%xmm6,%%xmm7,q,dqa)
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
760 #define QPEL_H264HV_XMM(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%xmm6,%%xmm7,q,dqa)
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
761
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2922
diff changeset
762
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
763 #define QPEL_H264(OPNAME, OP, MMX)\
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
764 static av_noinline void OPNAME ## h264_qpel4_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
765 int h=4;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
766 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
767 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
768 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
769 "movq %5, %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
770 "movq %6, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
771 "1: \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
772 "movd -1(%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
773 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
774 "movd 1(%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
775 "movd 2(%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
776 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
777 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
778 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
779 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
780 "paddw %%mm0, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
781 "paddw %%mm3, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
782 "movd -2(%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
783 "movd 3(%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
784 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
785 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
786 "paddw %%mm3, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
787 "psllw $2, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
788 "psubw %%mm1, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
789 "pmullw %%mm4, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
790 "paddw %%mm5, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
791 "paddw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
792 "psraw $5, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
793 "packuswb %%mm0, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
794 OP(%%mm0, (%1),%%mm6, d)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
795 "add %3, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
796 "add %4, %1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
797 "decl %2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
798 " jnz 1b \n\t"\
6335
950811a14eb3 put loop counter in a register if possible. makes some of the qpel functions 3% faster.
lorenm
parents: 6334
diff changeset
799 : "+a"(src), "+c"(dst), "+g"(h)\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
800 : "d"((long)srcStride), "S"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
801 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
802 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
803 }\
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
804 static av_noinline void OPNAME ## h264_qpel4_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
805 int h=4;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
806 asm volatile(\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
807 "pxor %%mm7, %%mm7 \n\t"\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
808 "movq %0, %%mm4 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
809 "movq %1, %%mm5 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
810 :: "m"(ff_pw_5), "m"(ff_pw_16)\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
811 );\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
812 do{\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
813 asm volatile(\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
814 "movd -1(%0), %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
815 "movd (%0), %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
816 "movd 1(%0), %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
817 "movd 2(%0), %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
818 "punpcklbw %%mm7, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
819 "punpcklbw %%mm7, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
820 "punpcklbw %%mm7, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
821 "punpcklbw %%mm7, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
822 "paddw %%mm0, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
823 "paddw %%mm3, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
824 "movd -2(%0), %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
825 "movd 3(%0), %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
826 "punpcklbw %%mm7, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
827 "punpcklbw %%mm7, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
828 "paddw %%mm3, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
829 "psllw $2, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
830 "psubw %%mm1, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
831 "pmullw %%mm4, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
832 "paddw %%mm5, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
833 "paddw %%mm2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
834 "movd (%2), %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
835 "psraw $5, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
836 "packuswb %%mm0, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
837 PAVGB" %%mm3, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
838 OP(%%mm0, (%1),%%mm6, d)\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
839 "add %4, %0 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
840 "add %4, %1 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
841 "add %3, %2 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
842 : "+a"(src), "+c"(dst), "+d"(src2)\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
843 : "D"((long)src2Stride), "S"((long)dstStride)\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
844 : "memory"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
845 );\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
846 }while(--h);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
847 }\
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
848 static av_noinline void OPNAME ## h264_qpel4_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
849 src -= 2*srcStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
850 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
851 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
852 "movd (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
853 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
854 "movd (%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
855 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
856 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
857 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
858 "movd (%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
859 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
860 "movd (%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
861 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
862 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
863 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
864 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
865 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
866 "punpcklbw %%mm7, %%mm4 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
867 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
868 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
869 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
870 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
871 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
872 : "+a"(src), "+c"(dst)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
873 : "S"((long)srcStride), "D"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
874 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
875 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
876 }\
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
877 static av_noinline void OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
878 int h=4;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
879 int w=3;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
880 src -= 2*srcStride+2;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
881 while(w--){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
882 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
883 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
884 "movd (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
885 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
886 "movd (%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
887 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
888 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
889 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
890 "movd (%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
891 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
892 "movd (%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
893 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
894 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
895 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
896 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
897 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
898 "punpcklbw %%mm7, %%mm4 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
899 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*3)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
900 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*3)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
901 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*3)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
902 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*3)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
903 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
904 : "+a"(src)\
6330
5070b3157fcf add qpel rounder once during hv rather than twice during hv and whatever it's averaged with
lorenm
parents: 6329
diff changeset
905 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
906 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
907 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
908 tmp += 4;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
909 src += 4 - 9*srcStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
910 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
911 tmp -= 3*4;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
912 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
913 "1: \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
914 "movq (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
915 "paddw 10(%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
916 "movq 2(%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
917 "paddw 8(%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
918 "movq 4(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
919 "paddw 6(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
920 "psubw %%mm1, %%mm0 \n\t"/*a-b (abccba)*/\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
921 "psraw $2, %%mm0 \n\t"/*(a-b)/4 */\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
922 "psubw %%mm1, %%mm0 \n\t"/*(a-b)/4-b */\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
923 "paddsw %%mm2, %%mm0 \n\t"\
3001
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
924 "psraw $2, %%mm0 \n\t"/*((a-b)/4-b+c)/4 */\
6330
5070b3157fcf add qpel rounder once during hv rather than twice during hv and whatever it's averaged with
lorenm
parents: 6329
diff changeset
925 "paddw %%mm2, %%mm0 \n\t"/*(a-5*b+20*c)/16 */\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
926 "psraw $6, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
927 "packuswb %%mm0, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
928 OP(%%mm0, (%1),%%mm7, d)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
929 "add $24, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
930 "add %3, %1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
931 "decl %2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
932 " jnz 1b \n\t"\
6335
950811a14eb3 put loop counter in a register if possible. makes some of the qpel functions 3% faster.
lorenm
parents: 6334
diff changeset
933 : "+a"(tmp), "+c"(dst), "+g"(h)\
6330
5070b3157fcf add qpel rounder once during hv rather than twice during hv and whatever it's averaged with
lorenm
parents: 6329
diff changeset
934 : "S"((long)dstStride)\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
935 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
936 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
937 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
938 \
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
939 static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
940 int h=8;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
941 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
942 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
943 "movq %5, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
944 "1: \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
945 "movq (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
946 "movq 1(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
947 "movq %%mm0, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
948 "movq %%mm2, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
949 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
950 "punpckhbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
951 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
952 "punpckhbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
953 "paddw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
954 "paddw %%mm3, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
955 "psllw $2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
956 "psllw $2, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
957 "movq -1(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
958 "movq 2(%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
959 "movq %%mm2, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
960 "movq %%mm4, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
961 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
962 "punpckhbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
963 "punpcklbw %%mm7, %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
964 "punpckhbw %%mm7, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
965 "paddw %%mm4, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
966 "paddw %%mm3, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
967 "psubw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
968 "psubw %%mm5, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
969 "pmullw %%mm6, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
970 "pmullw %%mm6, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
971 "movd -2(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
972 "movd 7(%0), %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
973 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
974 "punpcklbw %%mm7, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
975 "paddw %%mm3, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
976 "paddw %%mm5, %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
977 "movq %6, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
978 "paddw %%mm5, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
979 "paddw %%mm5, %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
980 "paddw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
981 "paddw %%mm4, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
982 "psraw $5, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
983 "psraw $5, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
984 "packuswb %%mm1, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
985 OP(%%mm0, (%1),%%mm5, q)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
986 "add %3, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
987 "add %4, %1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
988 "decl %2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
989 " jnz 1b \n\t"\
6335
950811a14eb3 put loop counter in a register if possible. makes some of the qpel functions 3% faster.
lorenm
parents: 6334
diff changeset
990 : "+a"(src), "+c"(dst), "+g"(h)\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
991 : "d"((long)srcStride), "S"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
992 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
993 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
994 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
995 \
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
996 static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
997 int h=8;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
998 asm volatile(\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
999 "pxor %%mm7, %%mm7 \n\t"\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1000 "movq %0, %%mm6 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1001 :: "m"(ff_pw_5)\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1002 );\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1003 do{\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1004 asm volatile(\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1005 "movq (%0), %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1006 "movq 1(%0), %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1007 "movq %%mm0, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1008 "movq %%mm2, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1009 "punpcklbw %%mm7, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1010 "punpckhbw %%mm7, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1011 "punpcklbw %%mm7, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1012 "punpckhbw %%mm7, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1013 "paddw %%mm2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1014 "paddw %%mm3, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1015 "psllw $2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1016 "psllw $2, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1017 "movq -1(%0), %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1018 "movq 2(%0), %%mm4 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1019 "movq %%mm2, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1020 "movq %%mm4, %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1021 "punpcklbw %%mm7, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1022 "punpckhbw %%mm7, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1023 "punpcklbw %%mm7, %%mm4 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1024 "punpckhbw %%mm7, %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1025 "paddw %%mm4, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1026 "paddw %%mm3, %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1027 "psubw %%mm2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1028 "psubw %%mm5, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1029 "pmullw %%mm6, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1030 "pmullw %%mm6, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1031 "movd -2(%0), %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1032 "movd 7(%0), %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1033 "punpcklbw %%mm7, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1034 "punpcklbw %%mm7, %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1035 "paddw %%mm3, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1036 "paddw %%mm5, %%mm4 \n\t"\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1037 "movq %5, %%mm5 \n\t"\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1038 "paddw %%mm5, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1039 "paddw %%mm5, %%mm4 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1040 "paddw %%mm2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1041 "paddw %%mm4, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1042 "psraw $5, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1043 "psraw $5, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1044 "movq (%2), %%mm4 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1045 "packuswb %%mm1, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1046 PAVGB" %%mm4, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1047 OP(%%mm0, (%1),%%mm5, q)\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1048 "add %4, %0 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1049 "add %4, %1 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1050 "add %3, %2 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1051 : "+a"(src), "+c"(dst), "+d"(src2)\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1052 : "D"((long)src2Stride), "S"((long)dstStride),\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1053 "m"(ff_pw_16)\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1054 : "memory"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1055 );\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
1056 }while(--h);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1057 }\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1058 \
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
1059 static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1060 int w= 2;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1061 src -= 2*srcStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1062 \
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1063 while(w--){\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1064 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1065 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1066 "movd (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1067 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1068 "movd (%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1069 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1070 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1071 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1072 "movd (%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1073 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1074 "movd (%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1075 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1076 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1077 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1078 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1079 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1080 "punpcklbw %%mm7, %%mm4 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1081 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1082 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1083 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1084 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1085 QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1086 QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1087 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1088 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1089 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1090 : "+a"(src), "+c"(dst)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1091 : "S"((long)srcStride), "D"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1092 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1093 );\
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1094 if(h==16){\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1095 asm volatile(\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1096 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1097 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1098 QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1099 QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1100 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1101 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1102 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1103 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1104 \
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1105 : "+a"(src), "+c"(dst)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1106 : "S"((long)srcStride), "D"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1107 : "memory"\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1108 );\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1109 }\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1110 src += 4-(h+5)*srcStride;\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1111 dst += 4-h*dstStride;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1112 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1113 }\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1114 static av_always_inline void OPNAME ## h264_qpel8or16_hv1_lowpass_ ## MMX(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1115 int w = (size+8)>>2;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1116 src -= 2*srcStride+2;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1117 while(w--){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1118 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1119 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1120 "movd (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1121 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1122 "movd (%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1123 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1124 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1125 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1126 "movd (%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1127 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1128 "movd (%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1129 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1130 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1131 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1132 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1133 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1134 "punpcklbw %%mm7, %%mm4 \n\t"\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1135 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1136 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1137 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1138 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1139 QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1140 QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1141 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1142 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 7*48)\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1143 : "+a"(src)\
6330
5070b3157fcf add qpel rounder once during hv rather than twice during hv and whatever it's averaged with
lorenm
parents: 6329
diff changeset
1144 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1145 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1146 );\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1147 if(size==16){\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1148 asm volatile(\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1149 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 8*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1150 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 9*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1151 QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 10*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1152 QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 11*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1153 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 12*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1154 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 13*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1155 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 14*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1156 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 15*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1157 : "+a"(src)\
6330
5070b3157fcf add qpel rounder once during hv rather than twice during hv and whatever it's averaged with
lorenm
parents: 6329
diff changeset
1158 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1159 : "memory"\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1160 );\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1161 }\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1162 tmp += 4;\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1163 src += 4 - (size+5)*srcStride;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1164 }\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1165 }\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1166 static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1167 int w = size>>4;\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1168 do{\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1169 int h = size;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1170 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1171 "1: \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1172 "movq (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1173 "movq 8(%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1174 "movq 2(%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1175 "movq 10(%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1176 "paddw %%mm4, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1177 "paddw %%mm3, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1178 "paddw 18(%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1179 "paddw 16(%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1180 "movq 4(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1181 "movq 12(%0), %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1182 "paddw 6(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1183 "paddw 14(%0), %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1184 "psubw %%mm1, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1185 "psubw %%mm4, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1186 "psraw $2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1187 "psraw $2, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1188 "psubw %%mm1, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1189 "psubw %%mm4, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1190 "paddsw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1191 "paddsw %%mm5, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1192 "psraw $2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1193 "psraw $2, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1194 "paddw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1195 "paddw %%mm5, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1196 "psraw $6, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1197 "psraw $6, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1198 "packuswb %%mm3, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1199 OP(%%mm0, (%1),%%mm7, q)\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1200 "add $48, %0 \n\t"\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1201 "add %3, %1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1202 "decl %2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1203 " jnz 1b \n\t"\
6335
950811a14eb3 put loop counter in a register if possible. makes some of the qpel functions 3% faster.
lorenm
parents: 6334
diff changeset
1204 : "+a"(tmp), "+c"(dst), "+g"(h)\
6330
5070b3157fcf add qpel rounder once during hv rather than twice during hv and whatever it's averaged with
lorenm
parents: 6329
diff changeset
1205 : "S"((long)dstStride)\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1206 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1207 );\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1208 tmp += 8 - size*24;\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1209 dst += 8 - size*dstStride;\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1210 }while(w--);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1211 }\
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1212 \
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1213 static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1214 OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1215 }\
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
1216 static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1217 OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1218 OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1219 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1220 \
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1221 static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1222 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1223 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1224 src += 8*srcStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1225 dst += 8*dstStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1226 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1227 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1228 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1229 \
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
1230 static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1231 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1232 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1233 src += 8*dstStride;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1234 dst += 8*dstStride;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1235 src2 += 8*src2Stride;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1236 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1237 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1238 }\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1239 \
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1240 static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1241 put_h264_qpel8or16_hv1_lowpass_ ## MMX(tmp, src, tmpStride, srcStride, size);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1242 OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1243 }\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1244 static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1245 OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 8);\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1246 }\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1247 \
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1248 static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1249 OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst , tmp , src , dstStride, tmpStride, srcStride, 16);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1250 }\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1251 \
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
1252 static av_noinline void OPNAME ## pixels4_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1253 {\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1254 asm volatile(\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1255 "movq (%1), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1256 "movq 24(%1), %%mm1 \n\t"\
3102
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1257 "psraw $5, %%mm0 \n\t"\
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1258 "psraw $5, %%mm1 \n\t"\
3163
b67ef5ea4d99 remove some useless instructions
lorenm
parents: 3156
diff changeset
1259 "packuswb %%mm0, %%mm0 \n\t"\
b67ef5ea4d99 remove some useless instructions
lorenm
parents: 3156
diff changeset
1260 "packuswb %%mm1, %%mm1 \n\t"\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1261 PAVGB" (%0), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1262 PAVGB" (%0,%3), %%mm1 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1263 OP(%%mm0, (%2), %%mm4, d)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1264 OP(%%mm1, (%2,%4), %%mm5, d)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1265 "lea (%0,%3,2), %0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1266 "lea (%2,%4,2), %2 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1267 "movq 48(%1), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1268 "movq 72(%1), %%mm1 \n\t"\
3102
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1269 "psraw $5, %%mm0 \n\t"\
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1270 "psraw $5, %%mm1 \n\t"\
3163
b67ef5ea4d99 remove some useless instructions
lorenm
parents: 3156
diff changeset
1271 "packuswb %%mm0, %%mm0 \n\t"\
b67ef5ea4d99 remove some useless instructions
lorenm
parents: 3156
diff changeset
1272 "packuswb %%mm1, %%mm1 \n\t"\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1273 PAVGB" (%0), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1274 PAVGB" (%0,%3), %%mm1 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1275 OP(%%mm0, (%2), %%mm4, d)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1276 OP(%%mm1, (%2,%4), %%mm5, d)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1277 :"+a"(src8), "+c"(src16), "+d"(dst)\
6330
5070b3157fcf add qpel rounder once during hv rather than twice during hv and whatever it's averaged with
lorenm
parents: 6329
diff changeset
1278 :"S"((long)src8Stride), "D"((long)dstStride)\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1279 :"memory");\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1280 }\
4527
481763d70193 prevent h.264 MC related functions from being inlined (yes this is much faster the code just doesnt fit in the code cache otherwise)
michael
parents: 4137
diff changeset
1281 static av_noinline void OPNAME ## pixels8_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1282 {\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1283 do{\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1284 asm volatile(\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1285 "movq (%1), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1286 "movq 8(%1), %%mm1 \n\t"\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1287 "movq 48(%1), %%mm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1288 "movq 8+48(%1), %%mm3 \n\t"\
3102
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1289 "psraw $5, %%mm0 \n\t"\
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1290 "psraw $5, %%mm1 \n\t"\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1291 "psraw $5, %%mm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1292 "psraw $5, %%mm3 \n\t"\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1293 "packuswb %%mm1, %%mm0 \n\t"\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1294 "packuswb %%mm3, %%mm2 \n\t"\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1295 PAVGB" (%0), %%mm0 \n\t"\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1296 PAVGB" (%0,%3), %%mm2 \n\t"\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1297 OP(%%mm0, (%2), %%mm5, q)\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1298 OP(%%mm2, (%2,%4), %%mm5, q)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1299 ::"a"(src8), "c"(src16), "d"(dst),\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1300 "r"((long)src8Stride), "r"((long)dstStride)\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1301 :"memory");\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1302 src8 += 2L*src8Stride;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1303 src16 += 48;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1304 dst += 2L*dstStride;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1305 }while(h-=2);\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1306 }\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1307 static void OPNAME ## pixels16_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1308 {\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1309 OPNAME ## pixels8_l2_shift5_ ## MMX(dst , src16 , src8 , dstStride, src8Stride, h);\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1310 OPNAME ## pixels8_l2_shift5_ ## MMX(dst+8, src16+8, src8+8, dstStride, src8Stride, h);\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1311 }\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1312
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1313
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1314 #ifdef ARCH_X86_64
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1315 #define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1316 static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1317 int h=16;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1318 asm volatile(\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1319 "pxor %%xmm15, %%xmm15 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1320 "movdqa %6, %%xmm14 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1321 "movdqa %7, %%xmm13 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1322 "1: \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1323 "lddqu 3(%0), %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1324 "lddqu -5(%0), %%xmm7 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1325 "movdqa %%xmm1, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1326 "punpckhbw %%xmm15, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1327 "punpcklbw %%xmm15, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1328 "punpcklbw %%xmm15, %%xmm7 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1329 "movdqa %%xmm1, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1330 "movdqa %%xmm0, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1331 "movdqa %%xmm1, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1332 "movdqa %%xmm0, %%xmm8 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1333 "movdqa %%xmm1, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1334 "movdqa %%xmm0, %%xmm9 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1335 "movdqa %%xmm1, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1336 "movdqa %%xmm0, %%xmm10 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1337 "palignr $6, %%xmm0, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1338 "palignr $6, %%xmm7, %%xmm10\n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1339 "palignr $8, %%xmm0, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1340 "palignr $8, %%xmm7, %%xmm9 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1341 "palignr $10,%%xmm0, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1342 "palignr $10,%%xmm7, %%xmm8 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1343 "paddw %%xmm1, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1344 "paddw %%xmm0, %%xmm10 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1345 "palignr $12,%%xmm0, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1346 "palignr $12,%%xmm7, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1347 "palignr $14,%%xmm0, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1348 "palignr $14,%%xmm7, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1349 "paddw %%xmm3, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1350 "paddw %%xmm8, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1351 "paddw %%xmm4, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1352 "paddw %%xmm9, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1353 "psllw $2, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1354 "psllw $2, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1355 "psubw %%xmm1, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1356 "psubw %%xmm0, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1357 "paddw %%xmm13,%%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1358 "paddw %%xmm13,%%xmm10 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1359 "pmullw %%xmm14,%%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1360 "pmullw %%xmm14,%%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1361 "lddqu (%2), %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1362 "paddw %%xmm5, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1363 "paddw %%xmm10,%%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1364 "psraw $5, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1365 "psraw $5, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1366 "packuswb %%xmm2,%%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1367 "pavgb %%xmm3, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1368 OP(%%xmm6, (%1), %%xmm4, dqa)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1369 "add %5, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1370 "add %5, %1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1371 "add %4, %2 \n\t"\
6345
0b7fbd57c489 asm argument that might be in memory needs a size
lorenm
parents: 6336
diff changeset
1372 "decl %3 \n\t"\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1373 "jg 1b \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1374 : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1375 : "D"((long)src2Stride), "S"((long)dstStride),\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1376 "m"(ff_pw_5), "m"(ff_pw_16)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1377 : "memory"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1378 );\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1379 }
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1380 #else // ARCH_X86_64
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1381 #define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1382 static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1383 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1384 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1385 src += 8*dstStride;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1386 dst += 8*dstStride;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1387 src2 += 8*src2Stride;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1388 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1389 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1390 }
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1391 #endif // ARCH_X86_64
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1392
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1393 #define QPEL_H264_H_XMM(OPNAME, OP, MMX)\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1394 static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1395 int h=8;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1396 asm volatile(\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1397 "pxor %%xmm7, %%xmm7 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1398 "movdqa %0, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1399 :: "m"(ff_pw_5)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1400 );\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1401 do{\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1402 asm volatile(\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1403 "lddqu -5(%0), %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1404 "movdqa %%xmm1, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1405 "punpckhbw %%xmm7, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1406 "punpcklbw %%xmm7, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1407 "movdqa %%xmm1, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1408 "movdqa %%xmm1, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1409 "movdqa %%xmm1, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1410 "movdqa %%xmm1, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1411 "palignr $6, %%xmm0, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1412 "palignr $8, %%xmm0, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1413 "palignr $10,%%xmm0, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1414 "paddw %%xmm1, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1415 "palignr $12,%%xmm0, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1416 "palignr $14,%%xmm0, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1417 "paddw %%xmm3, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1418 "paddw %%xmm4, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1419 "psllw $2, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1420 "movq (%2), %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1421 "psubw %%xmm1, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1422 "paddw %5, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1423 "pmullw %%xmm6, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1424 "paddw %%xmm5, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1425 "psraw $5, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1426 "packuswb %%xmm2, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1427 "pavgb %%xmm3, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1428 OP(%%xmm2, (%1), %%xmm4, q)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1429 "add %4, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1430 "add %4, %1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1431 "add %3, %2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1432 : "+a"(src), "+c"(dst), "+d"(src2)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1433 : "D"((long)src2Stride), "S"((long)dstStride),\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1434 "m"(ff_pw_16)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1435 : "memory"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1436 );\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1437 }while(--h);\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1438 }\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1439 QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1440 \
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1441 static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1442 int h=8;\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1443 asm volatile(\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1444 "pxor %%xmm7, %%xmm7 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1445 "movdqa %5, %%xmm6 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1446 "1: \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1447 "lddqu -5(%0), %%xmm1 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1448 "movdqa %%xmm1, %%xmm0 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1449 "punpckhbw %%xmm7, %%xmm1 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1450 "punpcklbw %%xmm7, %%xmm0 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1451 "movdqa %%xmm1, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1452 "movdqa %%xmm1, %%xmm3 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1453 "movdqa %%xmm1, %%xmm4 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1454 "movdqa %%xmm1, %%xmm5 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1455 "palignr $6, %%xmm0, %%xmm5 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1456 "palignr $8, %%xmm0, %%xmm4 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1457 "palignr $10,%%xmm0, %%xmm3 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1458 "paddw %%xmm1, %%xmm5 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1459 "palignr $12,%%xmm0, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1460 "palignr $14,%%xmm0, %%xmm1 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1461 "paddw %%xmm3, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1462 "paddw %%xmm4, %%xmm1 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1463 "psllw $2, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1464 "psubw %%xmm1, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1465 "paddw %6, %%xmm5 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1466 "pmullw %%xmm6, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1467 "paddw %%xmm5, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1468 "psraw $5, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1469 "packuswb %%xmm2, %%xmm2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1470 OP(%%xmm2, (%1), %%xmm4, q)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1471 "add %3, %0 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1472 "add %4, %1 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1473 "decl %2 \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1474 " jnz 1b \n\t"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1475 : "+a"(src), "+c"(dst), "+g"(h)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1476 : "D"((long)srcStride), "S"((long)dstStride),\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1477 "m"(ff_pw_5), "m"(ff_pw_16)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1478 : "memory"\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1479 );\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1480 }\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1481 static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1482 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1483 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1484 src += 8*srcStride;\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1485 dst += 8*dstStride;\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1486 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst , src , dstStride, srcStride);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1487 OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1488 }\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1489
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1490 #define QPEL_H264_V_XMM(OPNAME, OP, MMX)\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1491 static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1492 src -= 2*srcStride;\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1493 \
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1494 asm volatile(\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1495 "pxor %%xmm7, %%xmm7 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1496 "movq (%0), %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1497 "add %2, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1498 "movq (%0), %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1499 "add %2, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1500 "movq (%0), %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1501 "add %2, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1502 "movq (%0), %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1503 "add %2, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1504 "movq (%0), %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1505 "add %2, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1506 "punpcklbw %%xmm7, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1507 "punpcklbw %%xmm7, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1508 "punpcklbw %%xmm7, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1509 "punpcklbw %%xmm7, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1510 "punpcklbw %%xmm7, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1511 QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1512 QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1513 QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1514 QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1515 QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1516 QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1517 QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1518 QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1519 \
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1520 : "+a"(src), "+c"(dst)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1521 : "S"((long)srcStride), "D"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1522 : "memory"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1523 );\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1524 if(h==16){\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1525 asm volatile(\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1526 QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1527 QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1528 QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1529 QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1530 QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1531 QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1532 QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1533 QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1534 \
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1535 : "+a"(src), "+c"(dst)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1536 : "S"((long)srcStride), "D"((long)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1537 : "memory"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1538 );\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1539 }\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1540 }\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1541 static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1542 OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 8);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1543 }\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1544 static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1545 OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst , src , dstStride, srcStride, 16);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1546 OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1547 }
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1548
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1549 static av_always_inline void put_h264_qpel8or16_hv1_lowpass_sse2(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1550 int w = (size+8)>>3;
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1551 src -= 2*srcStride+2;
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1552 while(w--){
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1553 asm volatile(
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1554 "pxor %%xmm7, %%xmm7 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1555 "movq (%0), %%xmm0 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1556 "add %2, %0 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1557 "movq (%0), %%xmm1 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1558 "add %2, %0 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1559 "movq (%0), %%xmm2 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1560 "add %2, %0 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1561 "movq (%0), %%xmm3 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1562 "add %2, %0 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1563 "movq (%0), %%xmm4 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1564 "add %2, %0 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1565 "punpcklbw %%xmm7, %%xmm0 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1566 "punpcklbw %%xmm7, %%xmm1 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1567 "punpcklbw %%xmm7, %%xmm2 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1568 "punpcklbw %%xmm7, %%xmm3 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1569 "punpcklbw %%xmm7, %%xmm4 \n\t"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1570 QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 0*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1571 QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 1*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1572 QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 2*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1573 QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 3*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1574 QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 4*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1575 QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 5*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1576 QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 6*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1577 QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 7*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1578 : "+a"(src)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1579 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1580 : "memory"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1581 );
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1582 if(size==16){
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1583 asm volatile(
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1584 QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 8*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1585 QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 9*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1586 QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 10*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1587 QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 11*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1588 QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 12*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1589 QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 13*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1590 QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 14*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1591 QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 15*48)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1592 : "+a"(src)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1593 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1594 : "memory"
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1595 );
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1596 }
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1597 tmp += 8;
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1598 src += 8 - (size+5)*srcStride;
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1599 }
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1600 }
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1601
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1602 #define QPEL_H264_HV2_XMM(OPNAME, OP, MMX)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1603 static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1604 int h = size;\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1605 if(size == 16){\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1606 asm volatile(\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1607 "1: \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1608 "movdqa 32(%0), %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1609 "movdqa 16(%0), %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1610 "movdqa (%0), %%xmm7 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1611 "movdqa %%xmm4, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1612 "movdqa %%xmm4, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1613 "movdqa %%xmm4, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1614 "movdqa %%xmm4, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1615 "palignr $10, %%xmm5, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1616 "palignr $8, %%xmm5, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1617 "palignr $6, %%xmm5, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1618 "palignr $4, %%xmm5, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1619 "palignr $2, %%xmm5, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1620 "paddw %%xmm5, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1621 "paddw %%xmm4, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1622 "paddw %%xmm3, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1623 "movdqa %%xmm5, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1624 "movdqa %%xmm5, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1625 "movdqa %%xmm5, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1626 "palignr $8, %%xmm7, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1627 "palignr $2, %%xmm7, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1628 "palignr $10, %%xmm7, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1629 "paddw %%xmm6, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1630 "movdqa %%xmm5, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1631 "palignr $6, %%xmm7, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1632 "palignr $4, %%xmm7, %%xmm6 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1633 "paddw %%xmm7, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1634 "paddw %%xmm6, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1635 \
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1636 "psubw %%xmm1, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1637 "psubw %%xmm4, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1638 "psraw $2, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1639 "psraw $2, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1640 "psubw %%xmm1, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1641 "psubw %%xmm4, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1642 "paddw %%xmm2, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1643 "paddw %%xmm5, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1644 "psraw $2, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1645 "psraw $2, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1646 "paddw %%xmm2, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1647 "paddw %%xmm5, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1648 "psraw $6, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1649 "psraw $6, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1650 "packuswb %%xmm0, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1651 OP(%%xmm3, (%1), %%xmm7, dqa)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1652 "add $48, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1653 "add %3, %1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1654 "decl %2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1655 " jnz 1b \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1656 : "+a"(tmp), "+c"(dst), "+g"(h)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1657 : "S"((long)dstStride)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1658 : "memory"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1659 );\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1660 }else{\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1661 asm volatile(\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1662 "1: \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1663 "movdqa 16(%0), %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1664 "movdqa (%0), %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1665 "movdqa %%xmm1, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1666 "movdqa %%xmm1, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1667 "movdqa %%xmm1, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1668 "movdqa %%xmm1, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1669 "palignr $10, %%xmm0, %%xmm5 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1670 "palignr $8, %%xmm0, %%xmm4 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1671 "palignr $6, %%xmm0, %%xmm3 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1672 "palignr $4, %%xmm0, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1673 "palignr $2, %%xmm0, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1674 "paddw %%xmm5, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1675 "paddw %%xmm4, %%xmm1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1676 "paddw %%xmm3, %%xmm2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1677 "psubw %%xmm1, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1678 "psraw $2, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1679 "psubw %%xmm1, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1680 "paddw %%xmm2, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1681 "psraw $2, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1682 "paddw %%xmm2, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1683 "psraw $6, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1684 "packuswb %%xmm0, %%xmm0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1685 OP(%%xmm0, (%1), %%xmm7, q)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1686 "add $48, %0 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1687 "add %3, %1 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1688 "decl %2 \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1689 " jnz 1b \n\t"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1690 : "+a"(tmp), "+c"(dst), "+g"(h)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1691 : "S"((long)dstStride)\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1692 : "memory"\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1693 );\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1694 }\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1695 }
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1696
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1697 #define QPEL_H264_HV_XMM(OPNAME, OP, MMX)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1698 static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1699 put_h264_qpel8or16_hv1_lowpass_sse2(tmp, src, tmpStride, srcStride, size);\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1700 OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1701 }\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1702 static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1703 OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 8);\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1704 }\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1705 static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1706 OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 16);\
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1707 }\
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1708
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1709 #define put_pixels8_l2_sse2 put_pixels8_l2_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1710 #define avg_pixels8_l2_sse2 avg_pixels8_l2_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1711 #define put_pixels16_l2_sse2 put_pixels16_l2_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1712 #define avg_pixels16_l2_sse2 avg_pixels16_l2_mmx2
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1713 #define put_pixels8_l2_ssse3 put_pixels8_l2_mmx2
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1714 #define avg_pixels8_l2_ssse3 avg_pixels8_l2_mmx2
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1715 #define put_pixels16_l2_ssse3 put_pixels16_l2_mmx2
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1716 #define avg_pixels16_l2_ssse3 avg_pixels16_l2_mmx2
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1717
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1718 #define put_pixels8_l2_shift5_sse2 put_pixels8_l2_shift5_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1719 #define avg_pixels8_l2_shift5_sse2 avg_pixels8_l2_shift5_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1720 #define put_pixels16_l2_shift5_sse2 put_pixels16_l2_shift5_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1721 #define avg_pixels16_l2_shift5_sse2 avg_pixels16_l2_shift5_mmx2
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1722 #define put_pixels8_l2_shift5_ssse3 put_pixels8_l2_shift5_mmx2
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1723 #define avg_pixels8_l2_shift5_ssse3 avg_pixels8_l2_shift5_mmx2
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1724 #define put_pixels16_l2_shift5_ssse3 put_pixels16_l2_shift5_mmx2
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1725 #define avg_pixels16_l2_shift5_ssse3 avg_pixels16_l2_shift5_mmx2
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1726
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1727 #define put_h264_qpel8_h_lowpass_l2_sse2 put_h264_qpel8_h_lowpass_l2_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1728 #define avg_h264_qpel8_h_lowpass_l2_sse2 avg_h264_qpel8_h_lowpass_l2_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1729 #define put_h264_qpel16_h_lowpass_l2_sse2 put_h264_qpel16_h_lowpass_l2_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1730 #define avg_h264_qpel16_h_lowpass_l2_sse2 avg_h264_qpel16_h_lowpass_l2_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1731
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1732 #define put_h264_qpel8_v_lowpass_ssse3 put_h264_qpel8_v_lowpass_sse2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1733 #define avg_h264_qpel8_v_lowpass_ssse3 avg_h264_qpel8_v_lowpass_sse2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1734 #define put_h264_qpel16_v_lowpass_ssse3 put_h264_qpel16_v_lowpass_sse2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1735 #define avg_h264_qpel16_v_lowpass_ssse3 avg_h264_qpel16_v_lowpass_sse2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1736
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1737 #define put_h264_qpel8or16_hv2_lowpass_sse2 put_h264_qpel8or16_hv2_lowpass_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1738 #define avg_h264_qpel8or16_hv2_lowpass_sse2 avg_h264_qpel8or16_hv2_lowpass_mmx2
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1739
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1740 #define H264_MC(OPNAME, SIZE, MMX, ALIGN) \
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1741 H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1742 H264_MC_V(OPNAME, SIZE, MMX, ALIGN)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1743 H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1744 H264_MC_HV(OPNAME, SIZE, MMX, ALIGN)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1745
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1746 static void put_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1747 put_pixels16_sse2(dst, src, stride, 16);
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1748 }
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1749 static void avg_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1750 avg_pixels16_sse2(dst, src, stride, 16);
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1751 }
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1752 #define put_h264_qpel8_mc00_sse2 put_h264_qpel8_mc00_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1753 #define avg_h264_qpel8_mc00_sse2 avg_h264_qpel8_mc00_mmx2
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1754
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1755 #define H264_MC_C(OPNAME, SIZE, MMX, ALIGN) \
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1756 static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
6321
57bd93f81a14 use mmx2/3dnow avg functions in avg_qpel*_mc00
lorenm
parents: 6320
diff changeset
1757 OPNAME ## pixels ## SIZE ## _ ## MMX(dst, src, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1758 }\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1759
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1760 #define H264_MC_H(OPNAME, SIZE, MMX, ALIGN) \
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1761 static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1762 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src, stride, stride);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1763 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1764 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1765 static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1766 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1767 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1768 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1769 static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1770 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src+1, stride, stride);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1771 }\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1772
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1773 #define H264_MC_V(OPNAME, SIZE, MMX, ALIGN) \
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1774 static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1775 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1776 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1777 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1778 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1779 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1780 static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1781 OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1782 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1783 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1784 static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1785 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1786 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1787 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1788 }\
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1789
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1790 #define H264_MC_HV(OPNAME, SIZE, MMX, ALIGN) \
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1791 static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1792 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1793 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1794 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1795 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1796 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1797 static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1798 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1799 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1800 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1801 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1802 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1803 static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1804 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1805 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1806 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1807 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1808 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1809 static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1810 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1811 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1812 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1813 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1814 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1815 static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1816 DECLARE_ALIGNED(ALIGN, uint16_t, temp[SIZE*(SIZE<8?12:24)]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1817 OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, temp, src, stride, SIZE, stride);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1818 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1819 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1820 static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1821 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1822 uint8_t * const halfHV= temp;\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1823 int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
5809
7301ea0ae221 Fix intended order of operations for 4 assert() checks.
cehoyos
parents: 4939
diff changeset
1824 assert(((int)temp & 7) == 0);\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1825 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1826 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfHV, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1827 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1828 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1829 static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1830 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1831 uint8_t * const halfHV= temp;\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1832 int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
5809
7301ea0ae221 Fix intended order of operations for 4 assert() checks.
cehoyos
parents: 4939
diff changeset
1833 assert(((int)temp & 7) == 0);\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1834 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1835 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfHV, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1836 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1837 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1838 static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1839 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1840 uint8_t * const halfHV= temp;\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1841 int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
5809
7301ea0ae221 Fix intended order of operations for 4 assert() checks.
cehoyos
parents: 4939
diff changeset
1842 assert(((int)temp & 7) == 0);\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1843 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1844 OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+2, halfHV, stride, SIZE, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1845 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1846 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1847 static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
6334
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1848 DECLARE_ALIGNED(ALIGN, uint8_t, temp[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE]);\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1849 uint8_t * const halfHV= temp;\
bf8c9e82c7ad fix aliasing warnings. simpler too.
lorenm
parents: 6331
diff changeset
1850 int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
5809
7301ea0ae221 Fix intended order of operations for 4 assert() checks.
cehoyos
parents: 4939
diff changeset
1851 assert(((int)temp & 7) == 0);\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1852 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1853 OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+3, halfHV, stride, SIZE, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1854 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1855
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1856 #define H264_MC_4816(MMX)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1857 H264_MC(put_, 4, MMX, 8)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1858 H264_MC(put_, 8, MMX, 8)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1859 H264_MC(put_, 16,MMX, 8)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1860 H264_MC(avg_, 4, MMX, 8)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1861 H264_MC(avg_, 8, MMX, 8)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1862 H264_MC(avg_, 16,MMX, 8)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1863
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1864 #define H264_MC_816(QPEL, XMM)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1865 QPEL(put_, 8, XMM, 16)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1866 QPEL(put_, 16,XMM, 16)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1867 QPEL(avg_, 8, XMM, 16)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1868 QPEL(avg_, 16,XMM, 16)\
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1869
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1870
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1871 #define AVG_3DNOW_OP(a,b,temp, size) \
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1872 "mov" #size " " #b ", " #temp " \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1873 "pavgusb " #temp ", " #a " \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1874 "mov" #size " " #a ", " #b " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1875 #define AVG_MMX2_OP(a,b,temp, size) \
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1876 "mov" #size " " #b ", " #temp " \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1877 "pavgb " #temp ", " #a " \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1878 "mov" #size " " #a ", " #b " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1879
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1880 #define PAVGB "pavgusb"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1881 QPEL_H264(put_, PUT_OP, 3dnow)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1882 QPEL_H264(avg_, AVG_3DNOW_OP, 3dnow)
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1883 #undef PAVGB
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1884 #define PAVGB "pavgb"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1885 QPEL_H264(put_, PUT_OP, mmx2)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1886 QPEL_H264(avg_, AVG_MMX2_OP, mmx2)
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1887 QPEL_H264_V_XMM(put_, PUT_OP, sse2)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1888 QPEL_H264_V_XMM(avg_, AVG_MMX2_OP, sse2)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1889 QPEL_H264_HV_XMM(put_, PUT_OP, sse2)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1890 QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, sse2)
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1891 #ifdef HAVE_SSSE3
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1892 QPEL_H264_H_XMM(put_, PUT_OP, ssse3)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1893 QPEL_H264_H_XMM(avg_, AVG_MMX2_OP, ssse3)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1894 QPEL_H264_HV2_XMM(put_, PUT_OP, ssse3)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1895 QPEL_H264_HV2_XMM(avg_, AVG_MMX2_OP, ssse3)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1896 QPEL_H264_HV_XMM(put_, PUT_OP, ssse3)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1897 QPEL_H264_HV_XMM(avg_, AVG_MMX2_OP, ssse3)
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1898 #endif
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1899 #undef PAVGB
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1900
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1901 H264_MC_4816(3dnow)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1902 H264_MC_4816(mmx2)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1903 H264_MC_816(H264_MC_V, sse2)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1904 H264_MC_816(H264_MC_HV, sse2)
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1905 #ifdef HAVE_SSSE3
6336
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1906 H264_MC_816(H264_MC_H, ssse3)
ef3fb5a7e275 sse2 h264 motion compensation. not new code, just separate out the cases that didn't need ssse3.
lorenm
parents: 6335
diff changeset
1907 H264_MC_816(H264_MC_HV, ssse3)
6331
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1908 #endif
c57670e07668 ssse3 h264 motion compensation.
lorenm
parents: 6330
diff changeset
1909
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1910
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1911 #define H264_CHROMA_OP(S,D)
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1912 #define H264_CHROMA_OP4(S,D,T)
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1913 #define H264_CHROMA_MC8_TMPL put_h264_chroma_mc8_mmx
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1914 #define H264_CHROMA_MC4_TMPL put_h264_chroma_mc4_mmx
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3174
diff changeset
1915 #define H264_CHROMA_MC2_TMPL put_h264_chroma_mc2_mmx2
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1916 #define H264_CHROMA_MC8_MV0 put_pixels8_mmx
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1917 #include "dsputil_h264_template_mmx.c"
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1918
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1919 static void put_h264_chroma_mc8_mmx_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1920 {
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1921 put_h264_chroma_mc8_mmx(dst, src, stride, h, x, y, 1);
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1922 }
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1923 static void put_h264_chroma_mc8_mmx_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1924 {
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1925 put_h264_chroma_mc8_mmx(dst, src, stride, h, x, y, 0);
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1926 }
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1927
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1928 #undef H264_CHROMA_OP
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1929 #undef H264_CHROMA_OP4
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1930 #undef H264_CHROMA_MC8_TMPL
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1931 #undef H264_CHROMA_MC4_TMPL
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3174
diff changeset
1932 #undef H264_CHROMA_MC2_TMPL
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1933 #undef H264_CHROMA_MC8_MV0
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1934
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1935 #define H264_CHROMA_OP(S,D) "pavgb " #S ", " #D " \n\t"
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1936 #define H264_CHROMA_OP4(S,D,T) "movd " #S ", " #T " \n\t"\
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1937 "pavgb " #T ", " #D " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1938 #define H264_CHROMA_MC8_TMPL avg_h264_chroma_mc8_mmx2
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1939 #define H264_CHROMA_MC4_TMPL avg_h264_chroma_mc4_mmx2
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3174
diff changeset
1940 #define H264_CHROMA_MC2_TMPL avg_h264_chroma_mc2_mmx2
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1941 #define H264_CHROMA_MC8_MV0 avg_pixels8_mmx2
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1942 #include "dsputil_h264_template_mmx.c"
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1943 static void avg_h264_chroma_mc8_mmx2_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1944 {
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1945 avg_h264_chroma_mc8_mmx2(dst, src, stride, h, x, y, 1);
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1946 }
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1947 #undef H264_CHROMA_OP
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1948 #undef H264_CHROMA_OP4
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1949 #undef H264_CHROMA_MC8_TMPL
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1950 #undef H264_CHROMA_MC4_TMPL
3213
57d31bdbebe8 added mmx implementation of h264_chroma_mc2
lorenm
parents: 3174
diff changeset
1951 #undef H264_CHROMA_MC2_TMPL
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1952 #undef H264_CHROMA_MC8_MV0
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1953
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1954 #define H264_CHROMA_OP(S,D) "pavgusb " #S ", " #D " \n\t"
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1955 #define H264_CHROMA_OP4(S,D,T) "movd " #S ", " #T " \n\t"\
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1956 "pavgusb " #T ", " #D " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1957 #define H264_CHROMA_MC8_TMPL avg_h264_chroma_mc8_3dnow
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1958 #define H264_CHROMA_MC4_TMPL avg_h264_chroma_mc4_3dnow
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1959 #define H264_CHROMA_MC8_MV0 avg_pixels8_3dnow
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1960 #include "dsputil_h264_template_mmx.c"
6057
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1961 static void avg_h264_chroma_mc8_3dnow_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1962 {
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1963 avg_h264_chroma_mc8_3dnow(dst, src, stride, h, x, y, 1);
03febc8f506f add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
gpoirier
parents: 5947
diff changeset
1964 }
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1965 #undef H264_CHROMA_OP
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1966 #undef H264_CHROMA_OP4
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1967 #undef H264_CHROMA_MC8_TMPL
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1968 #undef H264_CHROMA_MC4_TMPL
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1969 #undef H264_CHROMA_MC8_MV0
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1970
6557
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1971 #ifdef HAVE_SSSE3
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1972 #define AVG_OP(X)
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1973 #undef H264_CHROMA_MC8_TMPL
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1974 #undef H264_CHROMA_MC4_TMPL
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1975 #define H264_CHROMA_MC8_TMPL put_h264_chroma_mc8_ssse3
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1976 #define H264_CHROMA_MC4_TMPL put_h264_chroma_mc4_ssse3
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1977 #define H264_CHROMA_MC8_MV0 put_pixels8_mmx
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1978 #include "dsputil_h264_template_ssse3.c"
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1979 static void put_h264_chroma_mc8_ssse3_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1980 {
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1981 put_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 1);
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1982 }
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1983 static void put_h264_chroma_mc8_ssse3_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1984 {
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1985 put_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 0);
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1986 }
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1987
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1988 #undef AVG_OP
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1989 #undef H264_CHROMA_MC8_TMPL
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1990 #undef H264_CHROMA_MC4_TMPL
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1991 #undef H264_CHROMA_MC8_MV0
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1992 #define AVG_OP(X) X
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1993 #define H264_CHROMA_MC8_TMPL avg_h264_chroma_mc8_ssse3
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1994 #define H264_CHROMA_MC4_TMPL avg_h264_chroma_mc4_ssse3
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1995 #define H264_CHROMA_MC8_MV0 avg_pixels8_mmx2
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1996 #include "dsputil_h264_template_ssse3.c"
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1997 static void avg_h264_chroma_mc8_ssse3_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1998 {
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
1999 avg_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 1);
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
2000 }
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
2001 #undef AVG_OP
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
2002 #undef H264_CHROMA_MC8_TMPL
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
2003 #undef H264_CHROMA_MC4_TMPL
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
2004 #undef H264_CHROMA_MC8_MV0
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
2005 #endif
e1208c4f8898 h264 chroma mc ssse3
lorenm
parents: 6345
diff changeset
2006
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2007 /***********************************/
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2008 /* weighted prediction */
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2009
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2010 static inline void ff_h264_weight_WxH_mmx2(uint8_t *dst, int stride, int log2_denom, int weight, int offset, int w, int h)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2011 {
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2012 int x, y;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2013 offset <<= log2_denom;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2014 offset += (1 << log2_denom) >> 1;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2015 asm volatile(
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2016 "movd %0, %%mm4 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2017 "movd %1, %%mm5 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2018 "movd %2, %%mm6 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2019 "pshufw $0, %%mm4, %%mm4 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2020 "pshufw $0, %%mm5, %%mm5 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2021 "pxor %%mm7, %%mm7 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2022 :: "g"(weight), "g"(offset), "g"(log2_denom)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2023 );
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2024 for(y=0; y<h; y+=2){
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2025 for(x=0; x<w; x+=4){
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2026 asm volatile(
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2027 "movd %0, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2028 "movd %1, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2029 "punpcklbw %%mm7, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2030 "punpcklbw %%mm7, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2031 "pmullw %%mm4, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2032 "pmullw %%mm4, %%mm1 \n\t"
3001
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
2033 "paddsw %%mm5, %%mm0 \n\t"
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
2034 "paddsw %%mm5, %%mm1 \n\t"
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2035 "psraw %%mm6, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2036 "psraw %%mm6, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2037 "packuswb %%mm7, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2038 "packuswb %%mm7, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2039 "movd %%mm0, %0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2040 "movd %%mm1, %1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2041 : "+m"(*(uint32_t*)(dst+x)),
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2042 "+m"(*(uint32_t*)(dst+x+stride))
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2043 );
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2044 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2045 dst += 2*stride;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2046 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2047 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2048
3029
7a92269a3ccd tweak h264_biweight
lorenm
parents: 3001
diff changeset
2049 static inline void ff_h264_biweight_WxH_mmx2(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset, int w, int h)
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2050 {
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2051 int x, y;
3029
7a92269a3ccd tweak h264_biweight
lorenm
parents: 3001
diff changeset
2052 offset = ((offset + 1) | 1) << log2_denom;
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2053 asm volatile(
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2054 "movd %0, %%mm3 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2055 "movd %1, %%mm4 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2056 "movd %2, %%mm5 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2057 "movd %3, %%mm6 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2058 "pshufw $0, %%mm3, %%mm3 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2059 "pshufw $0, %%mm4, %%mm4 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2060 "pshufw $0, %%mm5, %%mm5 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2061 "pxor %%mm7, %%mm7 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2062 :: "g"(weightd), "g"(weights), "g"(offset), "g"(log2_denom+1)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2063 );
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2064 for(y=0; y<h; y++){
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2065 for(x=0; x<w; x+=4){
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2066 asm volatile(
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2067 "movd %0, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2068 "movd %1, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2069 "punpcklbw %%mm7, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2070 "punpcklbw %%mm7, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2071 "pmullw %%mm3, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2072 "pmullw %%mm4, %%mm1 \n\t"
3001
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
2073 "paddsw %%mm1, %%mm0 \n\t"
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
2074 "paddsw %%mm5, %%mm0 \n\t"
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2075 "psraw %%mm6, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2076 "packuswb %%mm0, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2077 "movd %%mm0, %0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2078 : "+m"(*(uint32_t*)(dst+x))
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2079 : "m"(*(uint32_t*)(src+x))
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2080 );
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2081 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2082 src += stride;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2083 dst += stride;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2084 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2085 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2086
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2087 #define H264_WEIGHT(W,H) \
3029
7a92269a3ccd tweak h264_biweight
lorenm
parents: 3001
diff changeset
2088 static void ff_h264_biweight_ ## W ## x ## H ## _mmx2(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset){ \
7a92269a3ccd tweak h264_biweight
lorenm
parents: 3001
diff changeset
2089 ff_h264_biweight_WxH_mmx2(dst, src, stride, log2_denom, weightd, weights, offset, W, H); \
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2090 } \
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2091 static void ff_h264_weight_ ## W ## x ## H ## _mmx2(uint8_t *dst, int stride, int log2_denom, int weight, int offset){ \
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2092 ff_h264_weight_WxH_mmx2(dst, stride, log2_denom, weight, offset, W, H); \
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2093 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2094
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2095 H264_WEIGHT(16,16)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2096 H264_WEIGHT(16, 8)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2097 H264_WEIGHT( 8,16)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2098 H264_WEIGHT( 8, 8)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2099 H264_WEIGHT( 8, 4)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2100 H264_WEIGHT( 4, 8)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2101 H264_WEIGHT( 4, 4)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2102 H264_WEIGHT( 4, 2)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
2103