annotate i386/h264dsp_mmx.c @ 5952:aa06b0387069 libavcodec

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