Mercurial > libavcodec.hg
annotate i386/dsputil_h264_template_mmx.c @ 4380:6f34a614f5d9 libavcodec
remove useless #ifdef CONFIG_ZLIB
author | mru |
---|---|
date | Sun, 21 Jan 2007 21:58:32 +0000 |
parents | c8c591fe26f8 |
children | 6287a2ff4d08 |
rev | line source |
---|---|
2732 | 1 /* |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
2 * Copyright (c) 2005 Zoltan Hidvegi <hzoli -a- hzoli -d- com>, |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
3 * Loren Merritt |
2732 | 4 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3218
diff
changeset
|
5 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3218
diff
changeset
|
6 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3218
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
2732 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * 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:
3218
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
2732 | 11 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3218
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
2732 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * 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:
3218
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2922
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
2732 | 20 */ |
21 | |
22 /** | |
23 * MMX optimized version of (put|avg)_h264_chroma_mc8. | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
24 * H264_CHROMA_MC8_TMPL must be defined to the desired function name |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
25 * H264_CHROMA_OP must be defined to empty for put and pavgb/pavgusb for avg |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
26 * H264_CHROMA_MC8_MV0 must be defined to a (put|avg)_pixels8 function |
2732 | 27 */ |
28 static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) | |
29 { | |
3089 | 30 DECLARE_ALIGNED_8(uint64_t, AA); |
31 DECLARE_ALIGNED_8(uint64_t, DD); | |
2732 | 32 int i; |
33 | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
34 if(y==0 && x==0) { |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
35 /* no filter needed */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
36 H264_CHROMA_MC8_MV0(dst, src, stride, h); |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
37 return; |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
38 } |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
39 |
2732 | 40 assert(x<8 && y<8 && x>=0 && y>=0); |
41 | |
3218 | 42 if(y==0 || x==0) |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
43 { |
3218 | 44 /* 1 dimensional filter only */ |
45 const int dxy = x ? 1 : stride; | |
46 | |
47 asm volatile( | |
48 "movd %0, %%mm5\n\t" | |
49 "movq %1, %%mm4\n\t" | |
50 "punpcklwd %%mm5, %%mm5\n\t" | |
51 "punpckldq %%mm5, %%mm5\n\t" /* mm5 = B = x */ | |
52 "movq %%mm4, %%mm6\n\t" | |
53 "pxor %%mm7, %%mm7\n\t" | |
54 "psubw %%mm5, %%mm4\n\t" /* mm4 = A = 8-x */ | |
55 "psrlw $1, %%mm6\n\t" /* mm6 = 4 */ | |
56 :: "rm"(x+y), "m"(ff_pw_8)); | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
57 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
58 for(i=0; i<h; i++) { |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
59 asm volatile( |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
60 /* mm0 = src[0..7], mm1 = src[1..8] */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
61 "movq %0, %%mm0\n\t" |
3218 | 62 "movq %1, %%mm2\n\t" |
63 :: "m"(src[0]), "m"(src[dxy])); | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
64 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
65 asm volatile( |
3218 | 66 /* [mm0,mm1] = A * src[0..7] */ |
67 /* [mm2,mm3] = B * src[1..8] */ | |
68 "movq %%mm0, %%mm1\n\t" | |
69 "movq %%mm2, %%mm3\n\t" | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
70 "punpcklbw %%mm7, %%mm0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
71 "punpckhbw %%mm7, %%mm1\n\t" |
3218 | 72 "punpcklbw %%mm7, %%mm2\n\t" |
73 "punpckhbw %%mm7, %%mm3\n\t" | |
74 "pmullw %%mm4, %%mm0\n\t" | |
75 "pmullw %%mm4, %%mm1\n\t" | |
76 "pmullw %%mm5, %%mm2\n\t" | |
77 "pmullw %%mm5, %%mm3\n\t" | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
78 |
3218 | 79 /* dst[0..7] = (A * src[0..7] + B * src[1..8] + 4) >> 3 */ |
80 "paddw %%mm6, %%mm0\n\t" | |
81 "paddw %%mm6, %%mm1\n\t" | |
82 "paddw %%mm2, %%mm0\n\t" | |
83 "paddw %%mm3, %%mm1\n\t" | |
84 "psrlw $3, %%mm0\n\t" | |
85 "psrlw $3, %%mm1\n\t" | |
86 "packuswb %%mm1, %%mm0\n\t" | |
87 H264_CHROMA_OP(%0, %%mm0) | |
88 "movq %%mm0, %0\n\t" | |
89 : "=m" (dst[0])); | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
90 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
91 src += stride; |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
92 dst += stride; |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
93 } |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
94 return; |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
95 } |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
96 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
97 /* general case, bilinear */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
98 asm volatile("movd %2, %%mm4\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
99 "movd %3, %%mm6\n\t" |
2732 | 100 "punpcklwd %%mm4, %%mm4\n\t" |
101 "punpcklwd %%mm6, %%mm6\n\t" | |
102 "punpckldq %%mm4, %%mm4\n\t" /* mm4 = x words */ | |
103 "punpckldq %%mm6, %%mm6\n\t" /* mm6 = y words */ | |
104 "movq %%mm4, %%mm5\n\t" | |
105 "pmullw %%mm6, %%mm4\n\t" /* mm4 = x * y */ | |
106 "psllw $3, %%mm5\n\t" | |
107 "psllw $3, %%mm6\n\t" | |
108 "movq %%mm5, %%mm7\n\t" | |
109 "paddw %%mm6, %%mm7\n\t" | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
110 "movq %%mm4, %1\n\t" /* DD = x * y */ |
2732 | 111 "psubw %%mm4, %%mm5\n\t" /* mm5 = B = 8x - xy */ |
112 "psubw %%mm4, %%mm6\n\t" /* mm6 = C = 8y - xy */ | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
113 "paddw %4, %%mm4\n\t" |
2732 | 114 "psubw %%mm7, %%mm4\n\t" /* mm4 = A = xy - (8x+8y) + 64 */ |
115 "pxor %%mm7, %%mm7\n\t" | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
116 "movq %%mm4, %0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
117 : "=m" (AA), "=m" (DD) : "rm" (x), "rm" (y), "m" (ff_pw_64)); |
2732 | 118 |
119 asm volatile( | |
120 /* mm0 = src[0..7], mm1 = src[1..8] */ | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
121 "movq %0, %%mm0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
122 "movq %1, %%mm1\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
123 : : "m" (src[0]), "m" (src[1])); |
2732 | 124 |
125 for(i=0; i<h; i++) { | |
3218 | 126 src += stride; |
2732 | 127 |
3218 | 128 asm volatile( |
129 /* mm2 = A * src[0..3] + B * src[1..4] */ | |
130 /* mm3 = A * src[4..7] + B * src[5..8] */ | |
131 "movq %%mm0, %%mm2\n\t" | |
132 "movq %%mm1, %%mm3\n\t" | |
133 "punpckhbw %%mm7, %%mm0\n\t" | |
134 "punpcklbw %%mm7, %%mm1\n\t" | |
135 "punpcklbw %%mm7, %%mm2\n\t" | |
136 "punpckhbw %%mm7, %%mm3\n\t" | |
137 "pmullw %0, %%mm0\n\t" | |
138 "pmullw %0, %%mm2\n\t" | |
2732 | 139 "pmullw %%mm5, %%mm1\n\t" |
3218 | 140 "pmullw %%mm5, %%mm3\n\t" |
141 "paddw %%mm1, %%mm2\n\t" | |
142 "paddw %%mm0, %%mm3\n\t" | |
2732 | 143 : : "m" (AA)); |
144 | |
145 asm volatile( | |
3218 | 146 /* [mm2,mm3] += C * src[0..7] */ |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
147 "movq %0, %%mm0\n\t" |
3218 | 148 "movq %%mm0, %%mm1\n\t" |
149 "punpcklbw %%mm7, %%mm0\n\t" | |
150 "punpckhbw %%mm7, %%mm1\n\t" | |
151 "pmullw %%mm6, %%mm0\n\t" | |
152 "pmullw %%mm6, %%mm1\n\t" | |
153 "paddw %%mm0, %%mm2\n\t" | |
154 "paddw %%mm1, %%mm3\n\t" | |
155 : : "m" (src[0])); | |
2732 | 156 |
157 asm volatile( | |
3218 | 158 /* [mm2,mm3] += D * src[1..8] */ |
159 "movq %1, %%mm1\n\t" | |
160 "movq %%mm1, %%mm0\n\t" | |
161 "movq %%mm1, %%mm4\n\t" | |
162 "punpcklbw %%mm7, %%mm0\n\t" | |
163 "punpckhbw %%mm7, %%mm4\n\t" | |
164 "pmullw %2, %%mm0\n\t" | |
165 "pmullw %2, %%mm4\n\t" | |
166 "paddw %%mm0, %%mm2\n\t" | |
167 "paddw %%mm4, %%mm3\n\t" | |
168 "movq %0, %%mm0\n\t" | |
169 : : "m" (src[0]), "m" (src[1]), "m" (DD)); | |
2732 | 170 |
171 asm volatile( | |
3218 | 172 /* dst[0..7] = ([mm2,mm3] + 32) >> 6 */ |
2732 | 173 "paddw %1, %%mm2\n\t" |
174 "paddw %1, %%mm3\n\t" | |
175 "psrlw $6, %%mm2\n\t" | |
176 "psrlw $6, %%mm3\n\t" | |
177 "packuswb %%mm3, %%mm2\n\t" | |
178 H264_CHROMA_OP(%0, %%mm2) | |
179 "movq %%mm2, %0\n\t" | |
2754 | 180 : "=m" (dst[0]) : "m" (ff_pw_32)); |
2732 | 181 dst+= stride; |
182 } | |
183 } | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
184 |
3213 | 185 static void H264_CHROMA_MC4_TMPL(uint8_t *dst/*align 4*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
186 { |
3089 | 187 DECLARE_ALIGNED_8(uint64_t, AA); |
188 DECLARE_ALIGNED_8(uint64_t, DD); | |
2922
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
189 int i; |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
190 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
191 /* no special case for mv=(0,0) in 4x*, since it's much less common than in 8x*. |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
192 * could still save a few cycles, but maybe not worth the complexity. */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
193 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
194 assert(x<8 && y<8 && x>=0 && y>=0); |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
195 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
196 asm volatile("movd %2, %%mm4\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
197 "movd %3, %%mm6\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
198 "punpcklwd %%mm4, %%mm4\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
199 "punpcklwd %%mm6, %%mm6\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
200 "punpckldq %%mm4, %%mm4\n\t" /* mm4 = x words */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
201 "punpckldq %%mm6, %%mm6\n\t" /* mm6 = y words */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
202 "movq %%mm4, %%mm5\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
203 "pmullw %%mm6, %%mm4\n\t" /* mm4 = x * y */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
204 "psllw $3, %%mm5\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
205 "psllw $3, %%mm6\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
206 "movq %%mm5, %%mm7\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
207 "paddw %%mm6, %%mm7\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
208 "movq %%mm4, %1\n\t" /* DD = x * y */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
209 "psubw %%mm4, %%mm5\n\t" /* mm5 = B = 8x - xy */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
210 "psubw %%mm4, %%mm6\n\t" /* mm6 = C = 8y - xy */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
211 "paddw %4, %%mm4\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
212 "psubw %%mm7, %%mm4\n\t" /* mm4 = A = xy - (8x+8y) + 64 */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
213 "pxor %%mm7, %%mm7\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
214 "movq %%mm4, %0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
215 : "=m" (AA), "=m" (DD) : "rm" (x), "rm" (y), "m" (ff_pw_64)); |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
216 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
217 asm volatile( |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
218 /* mm0 = src[0..3], mm1 = src[1..4] */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
219 "movd %0, %%mm0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
220 "movd %1, %%mm1\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
221 "punpcklbw %%mm7, %%mm0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
222 "punpcklbw %%mm7, %%mm1\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
223 : : "m" (src[0]), "m" (src[1])); |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
224 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
225 for(i=0; i<h; i++) { |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
226 asm volatile( |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
227 /* mm2 = A * src[0..3] + B * src[1..4] */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
228 "movq %%mm0, %%mm2\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
229 "pmullw %0, %%mm2\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
230 "pmullw %%mm5, %%mm1\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
231 "paddw %%mm1, %%mm2\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
232 : : "m" (AA)); |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
233 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
234 src += stride; |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
235 asm volatile( |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
236 /* mm0 = src[0..3], mm1 = src[1..4] */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
237 "movd %0, %%mm0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
238 "movd %1, %%mm1\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
239 "punpcklbw %%mm7, %%mm0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
240 "punpcklbw %%mm7, %%mm1\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
241 : : "m" (src[0]), "m" (src[1])); |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
242 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
243 asm volatile( |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
244 /* mm2 += C * src[0..3] + D * src[1..4] */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
245 "movq %%mm0, %%mm3\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
246 "movq %%mm1, %%mm4\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
247 "pmullw %%mm6, %%mm3\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
248 "pmullw %0, %%mm4\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
249 "paddw %%mm3, %%mm2\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
250 "paddw %%mm4, %%mm2\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
251 : : "m" (DD)); |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
252 |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
253 asm volatile( |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
254 /* dst[0..3] = pack((mm2 + 32) >> 6) */ |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
255 "paddw %1, %%mm2\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
256 "psrlw $6, %%mm2\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
257 "packuswb %%mm7, %%mm2\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
258 H264_CHROMA_OP4(%0, %%mm2, %%mm3) |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
259 "movd %%mm2, %0\n\t" |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
260 : "=m" (dst[0]) : "m" (ff_pw_32)); |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
261 dst += stride; |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
262 } |
d772011258ec
faster h264_chroma_mc8_mmx, added h264_chroma_mc4_mmx.
lorenm
parents:
2754
diff
changeset
|
263 } |
3213 | 264 |
265 #ifdef H264_CHROMA_MC2_TMPL | |
266 static void H264_CHROMA_MC2_TMPL(uint8_t *dst/*align 2*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y) | |
267 { | |
268 int CD=((1<<16)-1)*x*y + 8*y; | |
269 int AB=((8<<16)-8)*x + 64 - CD; | |
270 int i; | |
271 | |
272 asm volatile( | |
273 /* mm5 = {A,B,A,B} */ | |
274 /* mm6 = {C,D,C,D} */ | |
275 "movd %0, %%mm5\n\t" | |
276 "movd %1, %%mm6\n\t" | |
277 "punpckldq %%mm5, %%mm5\n\t" | |
278 "punpckldq %%mm6, %%mm6\n\t" | |
279 "pxor %%mm7, %%mm7\n\t" | |
280 :: "r"(AB), "r"(CD)); | |
281 | |
282 asm volatile( | |
283 /* mm0 = src[0,1,1,2] */ | |
284 "movd %0, %%mm0\n\t" | |
285 "punpcklbw %%mm7, %%mm0\n\t" | |
286 "pshufw $0x94, %%mm0, %%mm0\n\t" | |
287 :: "m"(src[0])); | |
288 | |
289 for(i=0; i<h; i++) { | |
290 asm volatile( | |
291 /* mm1 = A * src[0,1] + B * src[1,2] */ | |
292 "movq %%mm0, %%mm1\n\t" | |
293 "pmaddwd %%mm5, %%mm1\n\t" | |
294 ::); | |
295 | |
296 src += stride; | |
297 asm volatile( | |
298 /* mm0 = src[0,1,1,2] */ | |
299 "movd %0, %%mm0\n\t" | |
300 "punpcklbw %%mm7, %%mm0\n\t" | |
301 "pshufw $0x94, %%mm0, %%mm0\n\t" | |
302 :: "m"(src[0])); | |
303 | |
304 asm volatile( | |
305 /* mm1 += C * src[0,1] + D * src[1,2] */ | |
306 "movq %%mm0, %%mm2\n\t" | |
307 "pmaddwd %%mm6, %%mm2\n\t" | |
308 "paddw %%mm2, %%mm1\n\t" | |
309 ::); | |
310 | |
311 asm volatile( | |
312 /* dst[0,1] = pack((mm1 + 32) >> 6) */ | |
313 "paddw %1, %%mm1\n\t" | |
314 "psrlw $6, %%mm1\n\t" | |
315 "packssdw %%mm7, %%mm1\n\t" | |
316 "packuswb %%mm7, %%mm1\n\t" | |
317 /* writes garbage to the right of dst. | |
318 * ok because partitions are processed from left to right. */ | |
319 H264_CHROMA_OP4(%0, %%mm1, %%mm3) | |
320 "movd %%mm1, %0\n\t" | |
3214 | 321 : "=m" (dst[0]) : "m" (ff_pw_32)); |
3213 | 322 dst += stride; |
323 } | |
324 } | |
325 #endif | |
326 |