annotate i386/h264dsp_mmx.c @ 3176:babf844e1308 libavcodec

Init simplification and 2% faster wma_decode_block on amd64 with tables use instead of pow().
author banan
date Wed, 08 Mar 2006 09:26:57 +0000
parents b65cbae9d940
children 57d31bdbebe8
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 *
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
4 * This library is free software; you can redistribute it and/or
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
5 * 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
6 * License as published by the Free Software Foundation; either
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
7 * version 2 of the License, or (at your option) any later version.
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
8 *
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
9 * This library is distributed in the hope that it will be useful,
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
10 * 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
11 * 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
12 * Lesser General Public License for more details.
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
13 *
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
15 * License along with this library; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 3029
diff changeset
16 * 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
17 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
18
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 /***********************************/
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
21 /* IDCT */
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 /* in/out: mma=mma+mmb, mmb=mmb-mma */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
24 #define SUMSUB_BA( a, b ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
25 "paddw "#b", "#a" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
26 "paddw "#b", "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
27 "psubw "#a", "#b" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
28
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
29 #define SUMSUB_BADC( a, b, c, d ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
30 "paddw "#b", "#a" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
31 "paddw "#d", "#c" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
32 "paddw "#b", "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
33 "paddw "#d", "#d" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
34 "psubw "#a", "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
35 "psubw "#c", "#d" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
36
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
37 #define SUMSUBD2_AB( a, b, t ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
38 "movq "#b", "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
39 "psraw $1 , "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
40 "paddw "#a", "#b" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
41 "psraw $1 , "#a" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
42 "psubw "#t", "#a" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
43
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
44 #define IDCT4_1D( s02, s13, d02, d13, t ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
45 SUMSUB_BA ( s02, d02 )\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
46 SUMSUBD2_AB( s13, d13, t )\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
47 SUMSUB_BADC( d13, s02, s13, d02 )
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
48
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
49 #define SBUTTERFLY(a,b,t,n)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
50 "movq " #a ", " #t " \n\t" /* abcd */\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
51 "punpckl" #n " " #b ", " #a " \n\t" /* aebf */\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
52 "punpckh" #n " " #b ", " #t " \n\t" /* cgdh */\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
53
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
54 #define TRANSPOSE4(a,b,c,d,t)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
55 SBUTTERFLY(a,b,t,wd) /* a=aebf t=cgdh */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
56 SBUTTERFLY(c,d,b,wd) /* c=imjn b=kolp */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
57 SBUTTERFLY(a,c,d,dq) /* a=aeim d=bfjn */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
58 SBUTTERFLY(t,b,c,dq) /* t=cgko c=dhlp */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
59
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
60 #define STORE_DIFF_4P( p, t, z ) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
61 "psraw $6, "#p" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
62 "movd (%0), "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
63 "punpcklbw "#z", "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
64 "paddsw "#t", "#p" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
65 "packuswb "#z", "#p" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
66 "movd "#p", (%0) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
67
3173
9a2cc7b0fbdb h264_idct_add only needs mmx1
lorenm
parents: 3165
diff changeset
68 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
69 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
70 /* Load dct coeffs */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
71 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
72 "movq (%0), %%mm0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
73 "movq 8(%0), %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
74 "movq 16(%0), %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
75 "movq 24(%0), %%mm3 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
76 :: "r"(block) );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
77
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
78 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
79 /* 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
80 IDCT4_1D( %%mm2, %%mm1, %%mm0, %%mm3, %%mm4 )
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
81
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
82 "movq %0, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
83 /* 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
84 TRANSPOSE4( %%mm3, %%mm1, %%mm0, %%mm2, %%mm4 )
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
85
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
86 "paddw %%mm6, %%mm3 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
87
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
88 /* 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
89 IDCT4_1D( %%mm4, %%mm2, %%mm3, %%mm0, %%mm1 )
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 "pxor %%mm7, %%mm7 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
92 :: "m"(ff_pw_32));
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
93
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
94 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
95 STORE_DIFF_4P( %%mm0, %%mm1, %%mm7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
96 "add %1, %0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
97 STORE_DIFF_4P( %%mm2, %%mm1, %%mm7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
98 "add %1, %0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
99 STORE_DIFF_4P( %%mm3, %%mm1, %%mm7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
100 "add %1, %0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
101 STORE_DIFF_4P( %%mm4, %%mm1, %%mm7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
102 : "+r"(dst)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
103 : "r" ((long)stride)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
104 );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
105 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
106
3174
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
107 static inline void h264_idct8_1d(int16_t *block)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
108 {
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
109 asm volatile(
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
110 "movq 112(%0), %%mm7 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
111 "movq 80(%0), %%mm5 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
112 "movq 48(%0), %%mm3 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
113 "movq 16(%0), %%mm1 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
114
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
115 "movq %%mm7, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
116 "movq %%mm3, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
117 "movq %%mm5, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
118 "movq %%mm7, %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
119 "psraw $1, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
120 "psraw $1, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
121 "psubw %%mm7, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
122 "psubw %%mm6, %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
123 "psubw %%mm4, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
124 "psubw %%mm3, %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
125 "psubw %%mm3, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
126 "paddw %%mm1, %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
127
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
128 "movq %%mm5, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
129 "movq %%mm1, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
130 "psraw $1, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
131 "psraw $1, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
132 "paddw %%mm5, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
133 "paddw %%mm1, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
134 "paddw %%mm7, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
135 "paddw %%mm5, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
136 "psubw %%mm1, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
137 "paddw %%mm3, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
138
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
139 "movq %%mm0, %%mm1 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
140 "movq %%mm4, %%mm3 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
141 "movq %%mm2, %%mm5 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
142 "movq %%mm6, %%mm7 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
143 "psraw $2, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
144 "psraw $2, %%mm3 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
145 "psraw $2, %%mm5 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
146 "psraw $2, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
147 "paddw %%mm6, %%mm1 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
148 "paddw %%mm2, %%mm3 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
149 "psubw %%mm4, %%mm5 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
150 "psubw %%mm0, %%mm7 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
151
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
152 "movq 32(%0), %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
153 "movq 96(%0), %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
154 "movq %%mm2, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
155 "movq %%mm6, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
156 "psraw $1, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
157 "psraw $1, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
158 "psubw %%mm0, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
159 "paddw %%mm2, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
160
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
161 "movq (%0), %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
162 "movq 64(%0), %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
163 SUMSUB_BA( %%mm0, %%mm2 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
164 SUMSUB_BA( %%mm6, %%mm0 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
165 SUMSUB_BA( %%mm4, %%mm2 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
166 SUMSUB_BA( %%mm7, %%mm6 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
167 SUMSUB_BA( %%mm5, %%mm4 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
168 SUMSUB_BA( %%mm3, %%mm2 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
169 SUMSUB_BA( %%mm1, %%mm0 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
170 :: "r"(block)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
171 );
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
172 }
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
173
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
174 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
175 {
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
176 int i;
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
177 int16_t __attribute__ ((aligned(8))) b2[64];
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
178
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
179 block[0] += 32;
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
180
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
181 for(i=0; i<2; i++){
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
182 uint64_t tmp;
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
183
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
184 h264_idct8_1d(block+4*i);
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
185
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
186 asm volatile(
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
187 "movq %%mm7, %0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
188 TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
189 "movq %%mm0, 8(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
190 "movq %%mm6, 24(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
191 "movq %%mm7, 40(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
192 "movq %%mm4, 56(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
193 "movq %0, %%mm7 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
194 TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
195 "movq %%mm7, (%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
196 "movq %%mm1, 16(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
197 "movq %%mm0, 32(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
198 "movq %%mm3, 48(%1) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
199 : "=m"(tmp)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
200 : "r"(b2+32*i)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
201 : "memory"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
202 );
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
203 }
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
204
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
205 for(i=0; i<2; i++){
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
206 h264_idct8_1d(b2+4*i);
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
207
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
208 asm volatile(
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
209 "psraw $6, %%mm7 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
210 "psraw $6, %%mm6 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
211 "psraw $6, %%mm5 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
212 "psraw $6, %%mm4 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
213 "psraw $6, %%mm3 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
214 "psraw $6, %%mm2 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
215 "psraw $6, %%mm1 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
216 "psraw $6, %%mm0 \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
217
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
218 "movq %%mm7, (%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
219 "movq %%mm5, 16(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
220 "movq %%mm3, 32(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
221 "movq %%mm1, 48(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
222 "movq %%mm0, 64(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
223 "movq %%mm2, 80(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
224 "movq %%mm4, 96(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
225 "movq %%mm6, 112(%0) \n\t"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
226 :: "r"(b2+4*i)
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
227 : "memory"
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
228 );
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
229 }
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
230
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
231 add_pixels_clamped_mmx(b2, dst, stride);
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
232 }
b65cbae9d940 h264_idct8_add_mmx
lorenm
parents: 3173
diff changeset
233
3173
9a2cc7b0fbdb h264_idct_add only needs mmx1
lorenm
parents: 3165
diff changeset
234 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
235 {
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
236 int dc = (block[0] + 32) >> 6;
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
237 asm volatile(
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
238 "movd %0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
239 "pshufw $0, %%mm0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
240 "pxor %%mm1, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
241 "psubw %%mm0, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
242 "packuswb %%mm0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
243 "packuswb %%mm1, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
244 ::"r"(dc)
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
245 );
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
246 asm volatile(
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
247 "movd %0, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
248 "movd %1, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
249 "movd %2, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
250 "movd %3, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
251 "paddusb %%mm0, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
252 "paddusb %%mm0, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
253 "paddusb %%mm0, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
254 "paddusb %%mm0, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
255 "psubusb %%mm1, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
256 "psubusb %%mm1, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
257 "psubusb %%mm1, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
258 "psubusb %%mm1, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
259 "movd %%mm2, %0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
260 "movd %%mm3, %1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
261 "movd %%mm4, %2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
262 "movd %%mm5, %3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
263 :"+m"(*(uint32_t*)(dst+0*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
264 "+m"(*(uint32_t*)(dst+1*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
265 "+m"(*(uint32_t*)(dst+2*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
266 "+m"(*(uint32_t*)(dst+3*stride))
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
267 );
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
268 }
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
269
3173
9a2cc7b0fbdb h264_idct_add only needs mmx1
lorenm
parents: 3165
diff changeset
270 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
271 {
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
272 int dc = (block[0] + 32) >> 6;
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
273 int y;
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
274 asm volatile(
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
275 "movd %0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
276 "pshufw $0, %%mm0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
277 "pxor %%mm1, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
278 "psubw %%mm0, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
279 "packuswb %%mm0, %%mm0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
280 "packuswb %%mm1, %%mm1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
281 ::"r"(dc)
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
282 );
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
283 for(y=2; y--; dst += 4*stride){
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
284 asm volatile(
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
285 "movq %0, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
286 "movq %1, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
287 "movq %2, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
288 "movq %3, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
289 "paddusb %%mm0, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
290 "paddusb %%mm0, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
291 "paddusb %%mm0, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
292 "paddusb %%mm0, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
293 "psubusb %%mm1, %%mm2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
294 "psubusb %%mm1, %%mm3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
295 "psubusb %%mm1, %%mm4 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
296 "psubusb %%mm1, %%mm5 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
297 "movq %%mm2, %0 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
298 "movq %%mm3, %1 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
299 "movq %%mm4, %2 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
300 "movq %%mm5, %3 \n\t"
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
301 :"+m"(*(uint64_t*)(dst+0*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
302 "+m"(*(uint64_t*)(dst+1*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
303 "+m"(*(uint64_t*)(dst+2*stride)),
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
304 "+m"(*(uint64_t*)(dst+3*stride))
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
305 );
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
306 }
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
307 }
2d35fb3cb940 h264: special case dc-only idct. ~1% faster overall
lorenm
parents: 3102
diff changeset
308
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
309
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
310 /***********************************/
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
311 /* deblocking */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
312
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
313 // out: o = |x-y|>a
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
314 // clobbers: t
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
315 #define DIFF_GT_MMX(x,y,a,o,t)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
316 "movq "#y", "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
317 "movq "#x", "#o" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
318 "psubusb "#x", "#t" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
319 "psubusb "#y", "#o" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
320 "por "#t", "#o" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
321 "psubusb "#a", "#o" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
322
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
323 // in: mm0=p1 mm1=p0 mm2=q0 mm3=q1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
324 // out: mm5=beta-1, mm7=mask
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
325 // clobbers: mm4,mm6
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
326 #define H264_DEBLOCK_MASK(alpha1, beta1) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
327 "pshufw $0, "#alpha1", %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
328 "pshufw $0, "#beta1 ", %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
329 "packuswb %%mm4, %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
330 "packuswb %%mm5, %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
331 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
332 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
333 "por %%mm4, %%mm7 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
334 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
335 "por %%mm4, %%mm7 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
336 "pxor %%mm6, %%mm6 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
337 "pcmpeqb %%mm6, %%mm7 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
338
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
339 // 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
340 // out: mm1=p0' mm2=q0'
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
341 // clobbers: mm0,3-6
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
342 #define H264_DEBLOCK_P0_Q0(pb_01, pb_3f)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
343 /* a = q0^p0^((p1-q1)>>2) */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
344 "movq %%mm0, %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
345 "psubb %%mm3, %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
346 "psrlw $2, %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
347 "pxor %%mm1, %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
348 "pxor %%mm2, %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
349 /* b = p0^(q1>>2) */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
350 "psrlw $2, %%mm3 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
351 "pand "#pb_3f", %%mm3 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
352 "movq %%mm1, %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
353 "pxor %%mm3, %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
354 /* c = q0^(p1>>2) */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
355 "psrlw $2, %%mm0 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
356 "pand "#pb_3f", %%mm0 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
357 "movq %%mm2, %%mm6 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
358 "pxor %%mm0, %%mm6 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
359 /* d = (c^b) & ~(b^a) & 1 */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
360 "pxor %%mm5, %%mm6 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
361 "pxor %%mm4, %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
362 "pandn %%mm6, %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
363 "pand "#pb_01", %%mm5 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
364 /* delta = (avg(q0, p1>>2) + (d&a))
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
365 * - (avg(p0, q1>>2) + (d&~a)) */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
366 "pavgb %%mm2, %%mm0 \n\t"\
2855
da95623de901 simplify (d&a) and (d&~a) calculation, hint by skal
michael
parents: 2754
diff changeset
367 "pand %%mm5, %%mm4 \n\t"\
da95623de901 simplify (d&a) and (d&~a) calculation, hint by skal
michael
parents: 2754
diff changeset
368 "paddusb %%mm4, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
369 "pavgb %%mm1, %%mm3 \n\t"\
2855
da95623de901 simplify (d&a) and (d&~a) calculation, hint by skal
michael
parents: 2754
diff changeset
370 "pxor %%mm5, %%mm4 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
371 "paddusb %%mm4, %%mm3 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
372 /* p0 += clip(delta, -tc0, tc0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
373 * q0 -= clip(delta, -tc0, tc0) */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
374 "movq %%mm0, %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
375 "psubusb %%mm3, %%mm0 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
376 "psubusb %%mm4, %%mm3 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
377 "pminub %%mm7, %%mm0 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
378 "pminub %%mm7, %%mm3 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
379 "paddusb %%mm0, %%mm1 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
380 "paddusb %%mm3, %%mm2 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
381 "psubusb %%mm3, %%mm1 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
382 "psubusb %%mm0, %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
383
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
384 // in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 mm7=(tc&mask) %8=mm_bone
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
385 // out: (q1addr) = clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 )
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
386 // clobbers: q2, tmp, tc0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
387 #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
388 "movq %%mm1, "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
389 "pavgb %%mm2, "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
390 "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
391 "pxor "q2addr", "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
392 "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
393 "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
394 "movq "#p1", "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
395 "psubusb "#tc0", "#tmp" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
396 "paddusb "#p1", "#tc0" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
397 "pmaxub "#tmp", "#q2" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
398 "pminub "#tc0", "#q2" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
399 "movq "#q2", "q1addr" \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
400
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
401 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
402 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
403 uint64_t tmp0;
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
404 uint64_t tc = (uint8_t)tc0[1]*0x01010000 | (uint8_t)tc0[0]*0x0101;
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
405 // with luma, tc0=0 doesn't mean no filtering, so we need a separate input mask
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
406 uint32_t mask[2] = { (tc0[0]>=0)*0xffffffff, (tc0[1]>=0)*0xffffffff };
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
407
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
408 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
409 "movq (%1,%3), %%mm0 \n\t" //p1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
410 "movq (%1,%3,2), %%mm1 \n\t" //p0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
411 "movq (%2), %%mm2 \n\t" //q0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
412 "movq (%2,%3), %%mm3 \n\t" //q1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
413 H264_DEBLOCK_MASK(%6, %7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
414 "pand %5, %%mm7 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
415 "movq %%mm7, %0 \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 /* filter p1 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
418 "movq (%1), %%mm3 \n\t" //p2
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
419 DIFF_GT_MMX(%%mm1, %%mm3, %%mm5, %%mm6, %%mm4) // |p2-p0|>beta-1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
420 "pandn %%mm7, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
421 "pcmpeqb %%mm7, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
422 "pand %%mm7, %%mm6 \n\t" // mask & |p2-p0|<beta
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
423 "pshufw $80, %4, %%mm4 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
424 "pand %%mm7, %%mm4 \n\t" // mask & tc0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
425 "movq %8, %%mm7 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
426 "pand %%mm6, %%mm7 \n\t" // mask & |p2-p0|<beta & 1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
427 "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
428 "paddb %%mm4, %%mm7 \n\t" // tc++
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
429 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
430
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
431 /* filter q1 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
432 "movq (%2,%3,2), %%mm4 \n\t" //q2
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
433 DIFF_GT_MMX(%%mm2, %%mm4, %%mm5, %%mm6, %%mm3) // |q2-q0|>beta-1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
434 "pandn %0, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
435 "pcmpeqb %0, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
436 "pand %0, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
437 "pshufw $80, %4, %%mm5 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
438 "pand %%mm6, %%mm5 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
439 "pand %8, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
440 "paddb %%mm6, %%mm7 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
441 "movq (%2,%3), %%mm3 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
442 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
443
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
444 /* filter p0, q0 */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
445 H264_DEBLOCK_P0_Q0(%8, %9)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
446 "movq %%mm1, (%1,%3,2) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
447 "movq %%mm2, (%2) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
448
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
449 : "=m"(tmp0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
450 : "r"(pix-3*stride), "r"(pix), "r"((long)stride),
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
451 "m"(tc), "m"(*(uint64_t*)mask), "m"(alpha1), "m"(beta1),
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
452 "m"(mm_bone), "m"(ff_pb_3F)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
453 );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
454 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
455
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
456 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
457 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
458 if((tc0[0] & tc0[1]) >= 0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
459 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
460 if((tc0[2] & tc0[3]) >= 0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
461 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
462 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
463 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
464 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
465 //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
466 // also, it only needs to transpose 6x8
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
467 uint8_t trans[8*8];
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
468 int i;
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
469 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
470 if((tc0[0] & tc0[1]) < 0)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
471 continue;
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
472 transpose4x4(trans, pix-4, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
473 transpose4x4(trans +4*8, pix, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
474 transpose4x4(trans+4, pix-4+4*stride, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
475 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
476 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
477 transpose4x4(pix-2, trans +2*8, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
478 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
479 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
480 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
481
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
482 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
483 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
484 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
485 "movq (%0), %%mm0 \n\t" //p1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
486 "movq (%0,%2), %%mm1 \n\t" //p0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
487 "movq (%1), %%mm2 \n\t" //q0
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
488 "movq (%1,%2), %%mm3 \n\t" //q1
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
489 H264_DEBLOCK_MASK(%4, %5)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
490 "movd %3, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
491 "punpcklbw %%mm6, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
492 "pand %%mm6, %%mm7 \n\t" // mm7 = tc&mask
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
493 H264_DEBLOCK_P0_Q0(%6, %7)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
494 "movq %%mm1, (%0,%2) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
495 "movq %%mm2, (%1) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
496
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
497 :: "r"(pix-2*stride), "r"(pix), "r"((long)stride),
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
498 "r"(*(uint32_t*)tc0),
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
499 "m"(alpha1), "m"(beta1), "m"(mm_bone), "m"(ff_pb_3F)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
500 );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
501 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
502
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
503 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
504 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
505 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
506 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
507
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
508 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
509 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
510 //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
511 uint8_t trans[8*4];
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
512 transpose4x4(trans, pix-2, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
513 transpose4x4(trans+4, pix-2+4*stride, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
514 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
515 transpose4x4(pix-2, trans, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
516 transpose4x4(pix-2+4*stride, trans+4, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
517 }
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 // p0 = (p0 + q1 + 2*p1 + 2) >> 2
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
520 #define H264_FILTER_CHROMA4(p0, p1, q1, one) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
521 "movq "#p0", %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
522 "pxor "#q1", %%mm4 \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
523 "pand "#one", %%mm4 \n\t" /* mm4 = (p0^q1)&1 */\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
524 "pavgb "#q1", "#p0" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
525 "psubusb %%mm4, "#p0" \n\t"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
526 "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
527
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
528 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
529 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
530 asm volatile(
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
531 "movq (%0), %%mm0 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
532 "movq (%0,%2), %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
533 "movq (%1), %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
534 "movq (%1,%2), %%mm3 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
535 H264_DEBLOCK_MASK(%3, %4)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
536 "movq %%mm1, %%mm5 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
537 "movq %%mm2, %%mm6 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
538 H264_FILTER_CHROMA4(%%mm1, %%mm0, %%mm3, %5) //p0'
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
539 H264_FILTER_CHROMA4(%%mm2, %%mm3, %%mm0, %5) //q0'
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
540 "psubb %%mm5, %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
541 "psubb %%mm6, %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
542 "pand %%mm7, %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
543 "pand %%mm7, %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
544 "paddb %%mm5, %%mm1 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
545 "paddb %%mm6, %%mm2 \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
546 "movq %%mm1, (%0,%2) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
547 "movq %%mm2, (%1) \n\t"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
548 :: "r"(pix-2*stride), "r"(pix), "r"((long)stride),
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
549 "m"(alpha1), "m"(beta1), "m"(mm_bone)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
550 );
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
551 }
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 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
554 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
555 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
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 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
559 {
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
560 //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
561 uint8_t trans[8*4];
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
562 transpose4x4(trans, pix-2, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
563 transpose4x4(trans+4, pix-2+4*stride, 8, stride);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
564 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
565 transpose4x4(pix-2, trans, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
566 transpose4x4(pix-2+4*stride, trans+4, stride, 8);
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
567 }
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
568
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
569
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
570 /***********************************/
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
571 /* motion compensation */
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
572
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
573 #define QPEL_H264V(A,B,C,D,E,F,OP)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
574 "movd (%0), "#F" \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
575 "movq "#C", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
576 "paddw "#D", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
577 "psllw $2, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
578 "psubw "#B", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
579 "psubw "#E", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
580 "pmullw %4, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
581 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
582 "punpcklbw %%mm7, "#F" \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
583 "paddw %5, "#A" \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
584 "paddw "#F", "#A" \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
585 "paddw "#A", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
586 "psraw $5, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
587 "packuswb %%mm6, %%mm6 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
588 OP(%%mm6, (%1), A, d)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
589 "add %3, %1 \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
590
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
591 #define QPEL_H264HV(A,B,C,D,E,F,OF)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
592 "movd (%0), "#F" \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
593 "movq "#C", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
594 "paddw "#D", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
595 "psllw $2, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
596 "psubw "#B", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
597 "psubw "#E", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
598 "pmullw %3, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
599 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
600 "punpcklbw %%mm7, "#F" \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
601 "paddw "#F", "#A" \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
602 "paddw "#A", %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
603 "movq %%mm6, "#OF"(%1) \n\t"
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2922
diff changeset
604
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
605 #define QPEL_H264(OPNAME, OP, MMX)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
606 static void OPNAME ## h264_qpel4_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
607 int h=4;\
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 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
610 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
611 "movq %5, %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
612 "movq %6, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
613 "1: \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
614 "movd -1(%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
615 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
616 "movd 1(%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
617 "movd 2(%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
618 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
619 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
620 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
621 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
622 "paddw %%mm0, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
623 "paddw %%mm3, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
624 "movd -2(%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
625 "movd 3(%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
626 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
627 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
628 "paddw %%mm3, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
629 "psllw $2, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
630 "psubw %%mm1, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
631 "pmullw %%mm4, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
632 "paddw %%mm5, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
633 "paddw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
634 "psraw $5, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
635 "packuswb %%mm0, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
636 OP(%%mm0, (%1),%%mm6, d)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
637 "add %3, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
638 "add %4, %1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
639 "decl %2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
640 " jnz 1b \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
641 : "+a"(src), "+c"(dst), "+m"(h)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
642 : "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
643 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
644 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
645 }\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
646 static void OPNAME ## h264_qpel4_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
647 int h=4;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
648 asm volatile(\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
649 "pxor %%mm7, %%mm7 \n\t"\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
650 "movq %0, %%mm4 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
651 "movq %1, %%mm5 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
652 :: "m"(ff_pw_5), "m"(ff_pw_16)\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
653 );\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
654 do{\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
655 asm volatile(\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
656 "movd -1(%0), %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
657 "movd (%0), %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
658 "movd 1(%0), %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
659 "movd 2(%0), %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
660 "punpcklbw %%mm7, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
661 "punpcklbw %%mm7, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
662 "punpcklbw %%mm7, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
663 "punpcklbw %%mm7, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
664 "paddw %%mm0, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
665 "paddw %%mm3, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
666 "movd -2(%0), %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
667 "movd 3(%0), %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
668 "punpcklbw %%mm7, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
669 "punpcklbw %%mm7, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
670 "paddw %%mm3, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
671 "psllw $2, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
672 "psubw %%mm1, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
673 "pmullw %%mm4, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
674 "paddw %%mm5, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
675 "paddw %%mm2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
676 "movd (%2), %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
677 "psraw $5, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
678 "packuswb %%mm0, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
679 PAVGB" %%mm3, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
680 OP(%%mm0, (%1),%%mm6, d)\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
681 "add %4, %0 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
682 "add %4, %1 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
683 "add %3, %2 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
684 : "+a"(src), "+c"(dst), "+d"(src2)\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
685 : "D"((long)src2Stride), "S"((long)dstStride)\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
686 : "memory"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
687 );\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
688 }while(--h);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
689 }\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
690 static void OPNAME ## h264_qpel4_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
691 src -= 2*srcStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
692 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
693 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
694 "movd (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
695 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
696 "movd (%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
697 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
698 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
699 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
700 "movd (%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
701 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
702 "movd (%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
703 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
704 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
705 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
706 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
707 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
708 "punpcklbw %%mm7, %%mm4 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
709 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
710 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
711 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
712 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
713 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
714 : "+a"(src), "+c"(dst)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
715 : "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
716 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
717 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
718 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
719 static void OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
720 int h=4;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
721 int w=3;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
722 src -= 2*srcStride+2;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
723 while(w--){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
724 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
725 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
726 "movd (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
727 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
728 "movd (%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
729 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
730 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
731 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
732 "movd (%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
733 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
734 "movd (%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
735 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
736 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
737 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
738 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
739 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
740 "punpcklbw %%mm7, %%mm4 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
741 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
742 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
743 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
744 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
745 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
746 : "+a"(src)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
747 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
748 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
749 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
750 tmp += 4;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
751 src += 4 - 9*srcStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
752 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
753 tmp -= 3*4;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
754 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
755 "movq %4, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
756 "1: \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
757 "movq (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
758 "paddw 10(%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
759 "movq 2(%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
760 "paddw 8(%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
761 "movq 4(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
762 "paddw 6(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
763 "psubw %%mm1, %%mm0 \n\t"/*a-b (abccba)*/\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
764 "psraw $2, %%mm0 \n\t"/*(a-b)/4 */\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
765 "psubw %%mm1, %%mm0 \n\t"/*(a-b)/4-b */\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
766 "paddsw %%mm2, %%mm0 \n\t"\
3001
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
767 "psraw $2, %%mm0 \n\t"/*((a-b)/4-b+c)/4 */\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
768 "paddw %%mm6, %%mm2 \n\t"\
3001
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
769 "paddw %%mm2, %%mm0 \n\t"/*(a-5*b+20*c)/16 +32 */\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
770 "psraw $6, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
771 "packuswb %%mm0, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
772 OP(%%mm0, (%1),%%mm7, d)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
773 "add $24, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
774 "add %3, %1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
775 "decl %2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
776 " jnz 1b \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
777 : "+a"(tmp), "+c"(dst), "+m"(h)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
778 : "S"((long)dstStride), "m"(ff_pw_32)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
779 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
780 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
781 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
782 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
783 static void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
784 int h=8;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
785 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
786 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
787 "movq %5, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
788 "1: \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
789 "movq (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
790 "movq 1(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
791 "movq %%mm0, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
792 "movq %%mm2, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
793 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
794 "punpckhbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
795 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
796 "punpckhbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
797 "paddw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
798 "paddw %%mm3, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
799 "psllw $2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
800 "psllw $2, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
801 "movq -1(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
802 "movq 2(%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
803 "movq %%mm2, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
804 "movq %%mm4, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
805 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
806 "punpckhbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
807 "punpcklbw %%mm7, %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
808 "punpckhbw %%mm7, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
809 "paddw %%mm4, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
810 "paddw %%mm3, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
811 "psubw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
812 "psubw %%mm5, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
813 "pmullw %%mm6, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
814 "pmullw %%mm6, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
815 "movd -2(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
816 "movd 7(%0), %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
817 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
818 "punpcklbw %%mm7, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
819 "paddw %%mm3, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
820 "paddw %%mm5, %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
821 "movq %6, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
822 "paddw %%mm5, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
823 "paddw %%mm5, %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
824 "paddw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
825 "paddw %%mm4, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
826 "psraw $5, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
827 "psraw $5, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
828 "packuswb %%mm1, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
829 OP(%%mm0, (%1),%%mm5, q)\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
830 "add %3, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
831 "add %4, %1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
832 "decl %2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
833 " jnz 1b \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
834 : "+a"(src), "+c"(dst), "+m"(h)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
835 : "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
836 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
837 );\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
838 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
839 \
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
840 static void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
841 int h=8;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
842 asm volatile(\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
843 "pxor %%mm7, %%mm7 \n\t"\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
844 "movq %0, %%mm6 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
845 :: "m"(ff_pw_5)\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
846 );\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
847 do{\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
848 asm volatile(\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
849 "movq (%0), %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
850 "movq 1(%0), %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
851 "movq %%mm0, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
852 "movq %%mm2, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
853 "punpcklbw %%mm7, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
854 "punpckhbw %%mm7, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
855 "punpcklbw %%mm7, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
856 "punpckhbw %%mm7, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
857 "paddw %%mm2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
858 "paddw %%mm3, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
859 "psllw $2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
860 "psllw $2, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
861 "movq -1(%0), %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
862 "movq 2(%0), %%mm4 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
863 "movq %%mm2, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
864 "movq %%mm4, %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
865 "punpcklbw %%mm7, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
866 "punpckhbw %%mm7, %%mm3 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
867 "punpcklbw %%mm7, %%mm4 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
868 "punpckhbw %%mm7, %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
869 "paddw %%mm4, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
870 "paddw %%mm3, %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
871 "psubw %%mm2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
872 "psubw %%mm5, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
873 "pmullw %%mm6, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
874 "pmullw %%mm6, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
875 "movd -2(%0), %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
876 "movd 7(%0), %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
877 "punpcklbw %%mm7, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
878 "punpcklbw %%mm7, %%mm5 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
879 "paddw %%mm3, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
880 "paddw %%mm5, %%mm4 \n\t"\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
881 "movq %5, %%mm5 \n\t"\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
882 "paddw %%mm5, %%mm2 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
883 "paddw %%mm5, %%mm4 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
884 "paddw %%mm2, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
885 "paddw %%mm4, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
886 "psraw $5, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
887 "psraw $5, %%mm1 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
888 "movq (%2), %%mm4 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
889 "packuswb %%mm1, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
890 PAVGB" %%mm4, %%mm0 \n\t"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
891 OP(%%mm0, (%1),%%mm5, q)\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
892 "add %4, %0 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
893 "add %4, %1 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
894 "add %3, %2 \n\t"\
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
895 : "+a"(src), "+c"(dst), "+d"(src2)\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
896 : "D"((long)src2Stride), "S"((long)dstStride),\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
897 "m"(ff_pw_16)\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
898 : "memory"\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
899 );\
3165
8b51e108cba6 gcc2.95 workaround
lorenm
parents: 3163
diff changeset
900 }while(--h);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
901 }\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
902 \
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
903 static inline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
904 int w= 2;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
905 src -= 2*srcStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
906 \
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
907 while(w--){\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
908 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
909 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
910 "movd (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
911 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
912 "movd (%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
913 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
914 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
915 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
916 "movd (%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
917 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
918 "movd (%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
919 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
920 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
921 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
922 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
923 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
924 "punpcklbw %%mm7, %%mm4 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
925 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
926 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
927 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
928 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
929 QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
930 QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
931 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
932 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
933 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
934 : "+a"(src), "+c"(dst)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
935 : "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
936 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
937 );\
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
938 if(h==16){\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
939 asm volatile(\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
940 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
941 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
942 QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
943 QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
944 QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
945 QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
946 QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
947 QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
948 \
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
949 : "+a"(src), "+c"(dst)\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
950 : "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
951 : "memory"\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
952 );\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
953 }\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
954 src += 4-(h+5)*srcStride;\
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
955 dst += 4-h*dstStride;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
956 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
957 }\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
958 static inline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
959 int h = size;\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
960 int w = (size+8)>>2;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
961 src -= 2*srcStride+2;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
962 while(w--){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
963 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
964 "pxor %%mm7, %%mm7 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
965 "movd (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
966 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
967 "movd (%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
968 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
969 "movd (%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
970 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
971 "movd (%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
972 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
973 "movd (%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
974 "add %2, %0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
975 "punpcklbw %%mm7, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
976 "punpcklbw %%mm7, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
977 "punpcklbw %%mm7, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
978 "punpcklbw %%mm7, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
979 "punpcklbw %%mm7, %%mm4 \n\t"\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
980 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
981 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
982 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
983 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
984 QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
985 QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
986 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
987 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
988 : "+a"(src)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
989 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
990 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
991 );\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
992 if(size==16){\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
993 asm volatile(\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
994 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 8*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
995 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 9*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
996 QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 10*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
997 QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 11*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
998 QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 12*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
999 QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 13*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1000 QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 14*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1001 QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 15*48)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1002 : "+a"(src)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1003 : "c"(tmp), "S"((long)srcStride), "m"(ff_pw_5)\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1004 : "memory"\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1005 );\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1006 }\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1007 tmp += 4;\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1008 src += 4 - (size+5)*srcStride;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1009 }\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1010 tmp -= size+8;\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1011 w = size>>4;\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1012 do{\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1013 h = size;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1014 asm volatile(\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1015 "movq %4, %%mm6 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1016 "1: \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1017 "movq (%0), %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1018 "movq 8(%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1019 "movq 2(%0), %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1020 "movq 10(%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1021 "paddw %%mm4, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1022 "paddw %%mm3, %%mm1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1023 "paddw 18(%0), %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1024 "paddw 16(%0), %%mm4 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1025 "movq 4(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1026 "movq 12(%0), %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1027 "paddw 6(%0), %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1028 "paddw 14(%0), %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1029 "psubw %%mm1, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1030 "psubw %%mm4, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1031 "psraw $2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1032 "psraw $2, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1033 "psubw %%mm1, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1034 "psubw %%mm4, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1035 "paddsw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1036 "paddsw %%mm5, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1037 "psraw $2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1038 "psraw $2, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1039 "paddw %%mm6, %%mm2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1040 "paddw %%mm6, %%mm5 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1041 "paddw %%mm2, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1042 "paddw %%mm5, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1043 "psraw $6, %%mm0 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1044 "psraw $6, %%mm3 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1045 "packuswb %%mm3, %%mm0 \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1046 OP(%%mm0, (%1),%%mm7, q)\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1047 "add $48, %0 \n\t"\
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1048 "add %3, %1 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1049 "decl %2 \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1050 " jnz 1b \n\t"\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1051 : "+a"(tmp), "+c"(dst), "+m"(h)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1052 : "S"((long)dstStride), "m"(ff_pw_32)\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1053 : "memory"\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1054 );\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1055 tmp += 8 - size*24;\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1056 dst += 8 - size*dstStride;\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1057 }while(w--);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1058 }\
3094
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1059 \
385fa360f618 11% faster put_h264_qpel16_v_lowpass_mmx2
lorenm
parents: 3093
diff changeset
1060 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
1061 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
1062 }\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1063 static 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
1064 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
1065 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
1066 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1067 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1068 static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1069 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
1070 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
1071 src += 8*srcStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1072 dst += 8*dstStride;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1073 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
1074 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
1075 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1076 \
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1077 static void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1078 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1079 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
1080 src += 8*dstStride;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1081 dst += 8*dstStride;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1082 src2 += 8*src2Stride;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1083 OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst , src , src2 , dstStride, src2Stride);\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1084 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
1085 }\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1086 \
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1087 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
1088 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
1089 }\
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1090 \
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1091 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
1092 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
1093 }\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1094 \
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1095 static void OPNAME ## pixels4_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
1096 {\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1097 asm volatile(\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1098 "movq %5, %%mm6 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1099 "movq (%1), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1100 "movq 24(%1), %%mm1 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1101 "paddw %%mm6, %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1102 "paddw %%mm6, %%mm1 \n\t"\
3102
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1103 "psraw $5, %%mm0 \n\t"\
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1104 "psraw $5, %%mm1 \n\t"\
3163
b67ef5ea4d99 remove some useless instructions
lorenm
parents: 3156
diff changeset
1105 "packuswb %%mm0, %%mm0 \n\t"\
b67ef5ea4d99 remove some useless instructions
lorenm
parents: 3156
diff changeset
1106 "packuswb %%mm1, %%mm1 \n\t"\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1107 PAVGB" (%0), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1108 PAVGB" (%0,%3), %%mm1 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1109 OP(%%mm0, (%2), %%mm4, d)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1110 OP(%%mm1, (%2,%4), %%mm5, d)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1111 "lea (%0,%3,2), %0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1112 "lea (%2,%4,2), %2 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1113 "movq 48(%1), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1114 "movq 72(%1), %%mm1 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1115 "paddw %%mm6, %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1116 "paddw %%mm6, %%mm1 \n\t"\
3102
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1117 "psraw $5, %%mm0 \n\t"\
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1118 "psraw $5, %%mm1 \n\t"\
3163
b67ef5ea4d99 remove some useless instructions
lorenm
parents: 3156
diff changeset
1119 "packuswb %%mm0, %%mm0 \n\t"\
b67ef5ea4d99 remove some useless instructions
lorenm
parents: 3156
diff changeset
1120 "packuswb %%mm1, %%mm1 \n\t"\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1121 PAVGB" (%0), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1122 PAVGB" (%0,%3), %%mm1 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1123 OP(%%mm0, (%2), %%mm4, d)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1124 OP(%%mm1, (%2,%4), %%mm5, d)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1125 :"+a"(src8), "+c"(src16), "+d"(dst)\
3096
966b3f321af0 10l (x86_64)
lorenm
parents: 3095
diff changeset
1126 :"S"((long)src8Stride), "D"((long)dstStride), "m"(ff_pw_16)\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1127 :"memory");\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1128 }\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1129 static void OPNAME ## pixels8_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
1130 {\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1131 asm volatile(\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1132 "movq %0, %%mm6 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1133 ::"m"(ff_pw_16)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1134 );\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1135 while(h--){\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1136 asm volatile(\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1137 "movq (%1), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1138 "movq 8(%1), %%mm1 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1139 "paddw %%mm6, %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1140 "paddw %%mm6, %%mm1 \n\t"\
3102
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1141 "psraw $5, %%mm0 \n\t"\
fcc2892eeab3 10l in 1.12
lorenm
parents: 3096
diff changeset
1142 "psraw $5, %%mm1 \n\t"\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1143 "packuswb %%mm1, %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1144 PAVGB" (%0), %%mm0 \n\t"\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1145 OP(%%mm0, (%2), %%mm5, q)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1146 ::"a"(src8), "c"(src16), "d"(dst)\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1147 :"memory");\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1148 src8 += src8Stride;\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1149 src16 += 24;\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1150 dst += dstStride;\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1151 }\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1152 }\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1153 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
1154 {\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1155 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
1156 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
1157 }\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1158
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1159
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1160 #define H264_MC(OPNAME, SIZE, MMX) \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1161 static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1162 OPNAME ## pixels ## SIZE ## _mmx(dst, src, stride, SIZE);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1163 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1164 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1165 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
1166 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
1167 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1168 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1169 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
1170 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
1171 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1172 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1173 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
1174 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
1175 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1176 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1177 static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1178 uint64_t temp[SIZE*SIZE/8];\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1179 uint8_t * const half= (uint8_t*)temp;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1180 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(half, src, SIZE, stride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1181 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, half, stride, stride, SIZE);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1182 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1183 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1184 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
1185 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
1186 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1187 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1188 static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1189 uint64_t temp[SIZE*SIZE/8];\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1190 uint8_t * const half= (uint8_t*)temp;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1191 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(half, src, SIZE, stride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1192 OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, half, stride, stride, SIZE);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1193 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1194 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1195 static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1196 uint64_t temp[SIZE*SIZE/8];\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1197 uint8_t * const halfV= (uint8_t*)temp;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1198 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1199 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfV, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1200 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1201 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1202 static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1203 uint64_t temp[SIZE*SIZE/8];\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1204 uint8_t * const halfV= (uint8_t*)temp;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1205 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src+1, SIZE, stride);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1206 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfV, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1207 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1208 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1209 static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1210 uint64_t temp[SIZE*SIZE/8];\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1211 uint8_t * const halfV= (uint8_t*)temp;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1212 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src, SIZE, stride);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1213 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfV, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1214 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1215 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1216 static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1217 uint64_t temp[SIZE*SIZE/8];\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1218 uint8_t * const halfV= (uint8_t*)temp;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1219 put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(halfV, src+1, SIZE, stride);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1220 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfV, stride, SIZE);\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1221 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1222 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1223 static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3093
19f3dd63af7d 15% faster put_h264_qpel16_hv_lowpass_mmx2
lorenm
parents: 3036
diff changeset
1224 uint64_t temp[SIZE*(SIZE<8?12:24)/4];\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1225 int16_t * const tmp= (int16_t*)temp;\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1226 OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, tmp, src, stride, SIZE, stride);\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1227 }\
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 static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1230 uint64_t temp[SIZE*(SIZE<8?12:24)/4 + SIZE*SIZE/8];\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1231 uint8_t * const halfHV= (uint8_t*)temp;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1232 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE/2;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1233 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1234 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
1235 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1236 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1237 static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1238 uint64_t temp[SIZE*(SIZE<8?12:24)/4 + SIZE*SIZE/8];\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1239 uint8_t * const halfHV= (uint8_t*)temp;\
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1240 int16_t * const tmp= ((int16_t*)temp) + SIZE*SIZE/2;\
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1241 put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, tmp, src, SIZE, SIZE, stride);\
3156
5b6d0dd37ca7 4% faster h264_qpel_mc
lorenm
parents: 3105
diff changeset
1242 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
1243 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1244 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1245 static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1246 uint64_t temp[SIZE*(SIZE<8?12:24)/4 + SIZE*SIZE/8];\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1247 int16_t * const halfV= ((int16_t*)temp) + SIZE*SIZE/2;\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1248 uint8_t * const halfHV= ((uint8_t*)temp);\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1249 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
1250 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
1251 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1252 \
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1253 static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1254 uint64_t temp[SIZE*(SIZE<8?12:24)/4 + SIZE*SIZE/8];\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1255 int16_t * const halfV= ((int16_t*)temp) + SIZE*SIZE/2;\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1256 uint8_t * const halfHV= ((uint8_t*)temp);\
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1257 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
1258 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
1259 }\
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1260
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1261
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1262 #define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1263 #define AVG_3DNOW_OP(a,b,temp, size) \
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1264 "mov" #size " " #b ", " #temp " \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1265 "pavgusb " #temp ", " #a " \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1266 "mov" #size " " #a ", " #b " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1267 #define AVG_MMX2_OP(a,b,temp, size) \
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1268 "mov" #size " " #b ", " #temp " \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1269 "pavgb " #temp ", " #a " \n\t"\
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
1270 "mov" #size " " #a ", " #b " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1271
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1272 #define PAVGB "pavgusb"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1273 QPEL_H264(put_, PUT_OP, 3dnow)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1274 QPEL_H264(avg_, AVG_3DNOW_OP, 3dnow)
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1275 #undef PAVGB
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1276 #define PAVGB "pavgb"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1277 QPEL_H264(put_, PUT_OP, mmx2)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1278 QPEL_H264(avg_, AVG_MMX2_OP, mmx2)
3095
66987f98caae 18% faster put_h264_qpel16_mc[13]2_mmx2
lorenm
parents: 3094
diff changeset
1279 #undef PAVGB
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1280
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1281 H264_MC(put_, 4, 3dnow)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1282 H264_MC(put_, 8, 3dnow)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1283 H264_MC(put_, 16,3dnow)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1284 H264_MC(avg_, 4, 3dnow)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1285 H264_MC(avg_, 8, 3dnow)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1286 H264_MC(avg_, 16,3dnow)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1287 H264_MC(put_, 4, mmx2)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1288 H264_MC(put_, 8, mmx2)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1289 H264_MC(put_, 16,mmx2)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1290 H264_MC(avg_, 4, mmx2)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1291 H264_MC(avg_, 8, mmx2)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1292 H264_MC(avg_, 16,mmx2)
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1293
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1294
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1295 #define H264_CHROMA_OP(S,D)
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1296 #define H264_CHROMA_OP4(S,D,T)
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1297 #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
1298 #define H264_CHROMA_MC4_TMPL put_h264_chroma_mc4_mmx
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1299 #define H264_CHROMA_MC8_MV0 put_pixels8_mmx
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1300 #include "dsputil_h264_template_mmx.c"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1301 #undef H264_CHROMA_OP
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1302 #undef H264_CHROMA_OP4
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1303 #undef H264_CHROMA_MC8_TMPL
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1304 #undef H264_CHROMA_MC4_TMPL
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1305 #undef H264_CHROMA_MC8_MV0
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1306
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1307 #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
1308 #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
1309 "pavgb " #T ", " #D " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1310 #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
1311 #define H264_CHROMA_MC4_TMPL avg_h264_chroma_mc4_mmx2
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1312 #define H264_CHROMA_MC8_MV0 avg_pixels8_mmx2
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1313 #include "dsputil_h264_template_mmx.c"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1314 #undef H264_CHROMA_OP
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1315 #undef H264_CHROMA_OP4
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1316 #undef H264_CHROMA_MC8_TMPL
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1317 #undef H264_CHROMA_MC4_TMPL
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1318 #undef H264_CHROMA_MC8_MV0
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1319
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1320 #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
1321 #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
1322 "pavgusb " #T ", " #D " \n\t"
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1323 #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
1324 #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
1325 #define H264_CHROMA_MC8_MV0 avg_pixels8_3dnow
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1326 #include "dsputil_h264_template_mmx.c"
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1327 #undef H264_CHROMA_OP
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1328 #undef H264_CHROMA_OP4
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1329 #undef H264_CHROMA_MC8_TMPL
2922
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1330 #undef H264_CHROMA_MC4_TMPL
d772011258ec faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents: 2902
diff changeset
1331 #undef H264_CHROMA_MC8_MV0
2754
a49f140179e9 sort H.264 mmx dsp functions into their own file
lorenm
parents:
diff changeset
1332
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1333 /***********************************/
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1334 /* weighted prediction */
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1335
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1336 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
1337 {
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1338 int x, y;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1339 offset <<= log2_denom;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1340 offset += (1 << log2_denom) >> 1;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1341 asm volatile(
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1342 "movd %0, %%mm4 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1343 "movd %1, %%mm5 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1344 "movd %2, %%mm6 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1345 "pshufw $0, %%mm4, %%mm4 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1346 "pshufw $0, %%mm5, %%mm5 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1347 "pxor %%mm7, %%mm7 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1348 :: "g"(weight), "g"(offset), "g"(log2_denom)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1349 );
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1350 for(y=0; y<h; y+=2){
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1351 for(x=0; x<w; x+=4){
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1352 asm volatile(
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1353 "movd %0, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1354 "movd %1, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1355 "punpcklbw %%mm7, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1356 "punpcklbw %%mm7, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1357 "pmullw %%mm4, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1358 "pmullw %%mm4, %%mm1 \n\t"
3001
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
1359 "paddsw %%mm5, %%mm0 \n\t"
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
1360 "paddsw %%mm5, %%mm1 \n\t"
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1361 "psraw %%mm6, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1362 "psraw %%mm6, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1363 "packuswb %%mm7, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1364 "packuswb %%mm7, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1365 "movd %%mm0, %0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1366 "movd %%mm1, %1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1367 : "+m"(*(uint32_t*)(dst+x)),
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1368 "+m"(*(uint32_t*)(dst+x+stride))
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1369 );
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1370 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1371 dst += 2*stride;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1372 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1373 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1374
3029
7a92269a3ccd tweak h264_biweight
lorenm
parents: 3001
diff changeset
1375 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
1376 {
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1377 int x, y;
3029
7a92269a3ccd tweak h264_biweight
lorenm
parents: 3001
diff changeset
1378 offset = ((offset + 1) | 1) << log2_denom;
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1379 asm volatile(
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1380 "movd %0, %%mm3 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1381 "movd %1, %%mm4 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1382 "movd %2, %%mm5 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1383 "movd %3, %%mm6 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1384 "pshufw $0, %%mm3, %%mm3 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1385 "pshufw $0, %%mm4, %%mm4 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1386 "pshufw $0, %%mm5, %%mm5 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1387 "pxor %%mm7, %%mm7 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1388 :: "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
1389 );
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1390 for(y=0; y<h; y++){
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1391 for(x=0; x<w; x+=4){
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1392 asm volatile(
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1393 "movd %0, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1394 "movd %1, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1395 "punpcklbw %%mm7, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1396 "punpcklbw %%mm7, %%mm1 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1397 "pmullw %%mm3, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1398 "pmullw %%mm4, %%mm1 \n\t"
3001
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
1399 "paddsw %%mm1, %%mm0 \n\t"
b52d8ee430f6 fix some potential arithmetic overflows in pred_direct_motion() and
lorenm
parents: 2979
diff changeset
1400 "paddsw %%mm5, %%mm0 \n\t"
2902
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1401 "psraw %%mm6, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1402 "packuswb %%mm0, %%mm0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1403 "movd %%mm0, %0 \n\t"
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1404 : "+m"(*(uint32_t*)(dst+x))
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1405 : "m"(*(uint32_t*)(src+x))
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1406 );
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1407 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1408 src += stride;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1409 dst += stride;
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1410 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1411 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1412
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1413 #define H264_WEIGHT(W,H) \
3029
7a92269a3ccd tweak h264_biweight
lorenm
parents: 3001
diff changeset
1414 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
1415 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
1416 } \
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1417 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
1418 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
1419 }
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1420
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1421 H264_WEIGHT(16,16)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1422 H264_WEIGHT(16, 8)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1423 H264_WEIGHT( 8,16)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1424 H264_WEIGHT( 8, 8)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1425 H264_WEIGHT( 8, 4)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1426 H264_WEIGHT( 4, 8)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1427 H264_WEIGHT( 4, 4)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1428 H264_WEIGHT( 4, 2)
3c79bc9f3aa9 h264 mmx weighted prediction. up to 3% overall speedup.
lorenm
parents: 2855
diff changeset
1429