61 #if HAVE_MMX && HAVE_EBX_AVAILABLE
62 static void block_diffs_MMX(
struct metrics *
m,
unsigned char *old,
unsigned char *
new,
int os,
int ns)
69 "pxor %%mm4, %%mm4 \n\t"
70 "pxor %%mm5, %%mm5 \n\t"
71 "pxor %%mm7, %%mm7 \n\t"
77 "movq (%%"REG_S
"), %%mm0 \n\t"
78 "movq (%%"REG_S
"), %%mm2 \n\t"
79 "add %%"REG_a
", %%"REG_S
" \n\t"
80 "movq (%%"REG_D
"), %%mm1 \n\t"
81 "add %%"REG_b
", %%"REG_D
" \n\t"
82 "psubusb %%mm1, %%mm2 \n\t"
83 "psubusb %%mm0, %%mm1 \n\t"
84 "movq %%mm2, %%mm0 \n\t"
85 "movq %%mm1, %%mm3 \n\t"
86 "punpcklbw %%mm7, %%mm0 \n\t"
87 "punpcklbw %%mm7, %%mm1 \n\t"
88 "punpckhbw %%mm7, %%mm2 \n\t"
89 "punpckhbw %%mm7, %%mm3 \n\t"
90 "paddw %%mm0, %%mm4 \n\t"
91 "paddw %%mm1, %%mm4 \n\t"
92 "paddw %%mm2, %%mm4 \n\t"
93 "paddw %%mm3, %%mm4 \n\t"
96 "movq (%%"REG_S
"), %%mm0 \n\t"
97 "movq (%%"REG_S
"), %%mm2 \n\t"
98 "add %%"REG_a
", %%"REG_S
" \n\t"
99 "movq (%%"REG_D
"), %%mm1 \n\t"
100 "add %%"REG_b
", %%"REG_D
" \n\t"
101 "psubusb %%mm1, %%mm2 \n\t"
102 "psubusb %%mm0, %%mm1 \n\t"
103 "movq %%mm2, %%mm0 \n\t"
104 "movq %%mm1, %%mm3 \n\t"
105 "punpcklbw %%mm7, %%mm0 \n\t"
106 "punpcklbw %%mm7, %%mm1 \n\t"
107 "punpckhbw %%mm7, %%mm2 \n\t"
108 "punpckhbw %%mm7, %%mm3 \n\t"
109 "paddw %%mm0, %%mm5 \n\t"
110 "paddw %%mm1, %%mm5 \n\t"
111 "paddw %%mm2, %%mm5 \n\t"
112 "paddw %%mm3, %%mm5 \n\t"
116 "movq %%mm4, (%%"REG_d
") \n\t"
117 "movq %%mm5, 8(%%"REG_d
") \n\t"
119 :
"S" (old),
"D" (
new),
"a" (os),
"b" (ns),
"d" (out)
122 m->
e = out[0]+out[1]+out[2]+out[3];
123 m->
o = out[4]+out[5]+out[6]+out[7];
128 "movl $4, %%ecx \n\t"
129 "pxor %%mm4, %%mm4 \n\t"
130 "pxor %%mm5, %%mm5 \n\t"
131 "pxor %%mm6, %%mm6 \n\t"
136 "movq (%%"REG_S
"), %%mm0 \n\t"
137 "movq (%%"REG_S
",%%"REG_a
"), %%mm1 \n\t"
138 "add %%"REG_a
", %%"REG_S
" \n\t"
139 "add %%"REG_a
", %%"REG_S
" \n\t"
140 "movq (%%"REG_D
"), %%mm2 \n\t"
141 "movq (%%"REG_D
",%%"REG_b
"), %%mm3 \n\t"
142 "add %%"REG_b
", %%"REG_D
" \n\t"
143 "add %%"REG_b
", %%"REG_D
" \n\t"
144 "punpcklbw %%mm7, %%mm0 \n\t"
145 "punpcklbw %%mm7, %%mm1 \n\t"
146 "punpcklbw %%mm7, %%mm2 \n\t"
147 "punpcklbw %%mm7, %%mm3 \n\t"
148 "paddw %%mm1, %%mm4 \n\t"
149 "paddw %%mm1, %%mm5 \n\t"
150 "paddw %%mm3, %%mm6 \n\t"
151 "psubw %%mm0, %%mm4 \n\t"
152 "psubw %%mm2, %%mm5 \n\t"
153 "psubw %%mm2, %%mm6 \n\t"
158 "movq %%mm0, %%mm1 \n\t"
159 "movq %%mm0, %%mm2 \n\t"
160 "movq %%mm0, %%mm3 \n\t"
161 "pcmpgtw %%mm4, %%mm1 \n\t"
162 "pcmpgtw %%mm5, %%mm2 \n\t"
163 "pcmpgtw %%mm6, %%mm3 \n\t"
164 "pxor %%mm1, %%mm4 \n\t"
165 "pxor %%mm2, %%mm5 \n\t"
166 "pxor %%mm3, %%mm6 \n\t"
167 "psubw %%mm1, %%mm4 \n\t"
168 "psubw %%mm2, %%mm5 \n\t"
169 "psubw %%mm3, %%mm6 \n\t"
170 "movq %%mm4, (%%"REG_d
") \n\t"
171 "movq %%mm5, 16(%%"REG_d
") \n\t"
172 "movq %%mm6, 32(%%"REG_d
") \n\t"
174 "mov %%"REG_a
", %%"REG_c
" \n\t"
175 "shl $3, %%"REG_c
" \n\t"
176 "sub %%"REG_c
", %%"REG_S
" \n\t"
177 "mov %%"REG_b
", %%"REG_c
" \n\t"
178 "shl $3, %%"REG_c
" \n\t"
179 "sub %%"REG_c
", %%"REG_D
" \n\t"
182 "movl $4, %%ecx \n\t"
183 "pxor %%mm4, %%mm4 \n\t"
184 "pxor %%mm5, %%mm5 \n\t"
185 "pxor %%mm6, %%mm6 \n\t"
190 "movq (%%"REG_S
"), %%mm0 \n\t"
191 "movq (%%"REG_S
",%%"REG_a
"), %%mm1 \n\t"
192 "add %%"REG_a
", %%"REG_S
" \n\t"
193 "add %%"REG_a
", %%"REG_S
" \n\t"
194 "movq (%%"REG_D
"), %%mm2 \n\t"
195 "movq (%%"REG_D
",%%"REG_b
"), %%mm3 \n\t"
196 "add %%"REG_b
", %%"REG_D
" \n\t"
197 "add %%"REG_b
", %%"REG_D
" \n\t"
198 "punpckhbw %%mm7, %%mm0 \n\t"
199 "punpckhbw %%mm7, %%mm1 \n\t"
200 "punpckhbw %%mm7, %%mm2 \n\t"
201 "punpckhbw %%mm7, %%mm3 \n\t"
202 "paddw %%mm1, %%mm4 \n\t"
203 "paddw %%mm1, %%mm5 \n\t"
204 "paddw %%mm3, %%mm6 \n\t"
205 "psubw %%mm0, %%mm4 \n\t"
206 "psubw %%mm2, %%mm5 \n\t"
207 "psubw %%mm2, %%mm6 \n\t"
212 "movq %%mm0, %%mm1 \n\t"
213 "movq %%mm0, %%mm2 \n\t"
214 "movq %%mm0, %%mm3 \n\t"
215 "pcmpgtw %%mm4, %%mm1 \n\t"
216 "pcmpgtw %%mm5, %%mm2 \n\t"
217 "pcmpgtw %%mm6, %%mm3 \n\t"
218 "pxor %%mm1, %%mm4 \n\t"
219 "pxor %%mm2, %%mm5 \n\t"
220 "pxor %%mm3, %%mm6 \n\t"
221 "psubw %%mm1, %%mm4 \n\t"
222 "psubw %%mm2, %%mm5 \n\t"
223 "psubw %%mm3, %%mm6 \n\t"
224 "movq %%mm4, 8(%%"REG_d
") \n\t"
225 "movq %%mm5, 24(%%"REG_d
") \n\t"
226 "movq %%mm6, 40(%%"REG_d
") \n\t"
230 :
"S" (old),
"D" (
new),
"a" ((
long)os),
"b" ((
long)ns),
"d" (out)
233 m->
p = m->
t = m->
s = 0;
234 for (i=0; i<8; i++) {
245 #define MAG(a) (((a)^((a)>>31))-((a)>>31))
249 #define LOWPASS(s) ((s)[0])
254 int x,
y, e=0, o=0, s=0, p=0,
t=0;
255 unsigned char *oldp, *newp;
256 m->
s = m->
p = m->
t = 0;
257 for (x = 8; x; x--) {
261 for (y = 4;
y; y--) {
262 e +=
MAG(newp[0]-oldp[0]);
263 o +=
MAG(newp[ns]-oldp[os]);
264 s += newp[ns]-newp[0];
265 p += oldp[os]-oldp[0];
266 t += oldp[os]-newp[0];
281 #define MAXUP(a,b) ((a) = ((a)>(b)) ? (a) : (b))
284 unsigned char *old,
unsigned char *
new,
int w,
int h,
int os,
int ns)
288 struct metrics *peak=&fi->p, *rel=&fi->r, *mean=&fi->
m;
289 memset(peak, 0,
sizeof(
struct metrics));
290 memset(rel, 0,
sizeof(
struct metrics));
291 memset(mean, 0,
sizeof(
struct metrics));
292 for (y = 0; y < h-7; y += 8) {
293 for (x = 8; x < w-8-7; x += 8) {
327 new->w, new->h, old->
stride[0], new->stride[0]);
333 f->p.d, f->r.e, f->r.o, f->r.p, f->r.t, f->r.s, f->r.d, f->p.p, f->p.t, f->p.s);
355 if ((3*f[1].
r.o < f[1].r.e) && (f[1].r.s < f[1].r.d)) {
362 if (!( (3*f[0].
r.e < f[0].r.o) ||
363 ((2*f[0].r.d < f[0].r.s) && (f[0].r.s > 1200)) ||
364 ((2*f[1].r.t < f[1].r.p) && (f[1].r.p > 1200)) ))
370 if (((2*f[1].
r.t < 3*f[1].r.p) && (f[1].r.t < 3600)) ||
371 (f[1].r.t < 900) || (f[1].r.d < 900)) {
374 if ((3*f[0].
r.e < f[0].r.o) || (2*f[1].r.t < f[1].r.p)) {
479 switch (
foo(p, mpi, p->
dmpi)) {
520 static void uninit(
struct vf_instance *vf)
535 if (args) sscanf(args,
"%d", &p->
drop);
537 #if HAVE_MMX && HAVE_EBX_AVAILABLE
544 "inverse telecine, take 2",