Mercurial > mplayer.hg
annotate libmpcodecs/vf_ilpack.c @ 21049:0db8fb3cc48d
Remove (now hopefully unnecessary) workarounds added in r21056
author | reimar |
---|---|
date | Sun, 19 Nov 2006 16:54:06 +0000 |
parents | 6334c14b38eb |
children | d2fa2322ce83 |
rev | line source |
---|---|
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
1 #include <stdio.h> |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
2 #include <stdlib.h> |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
3 #include <string.h> |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
4 #include <inttypes.h> |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
5 |
17012 | 6 #include "config.h" |
7 #include "mp_msg.h" | |
8 #include "cpudetect.h" | |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
9 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
10 #include "img_format.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
11 #include "mp_image.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
12 #include "vf.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
13 |
17012 | 14 #include "libvo/fastmemcpy.h" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
15 |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
16 typedef void (pack_func_t)(unsigned char *dst, unsigned char *y, |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
17 unsigned char *u, unsigned char *v, int w, int us, int vs); |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
18 |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
19 struct vf_priv_s { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
20 int mode; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
21 pack_func_t *pack[2]; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
22 }; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
23 |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
24 static void pack_nn_C(unsigned char *dst, unsigned char *y, |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
25 unsigned char *u, unsigned char *v, int w) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
26 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
27 int j; |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
28 for (j = w/2; j; j--) { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
29 *dst++ = *y++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
30 *dst++ = *u++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
31 *dst++ = *y++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
32 *dst++ = *v++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
33 } |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
34 } |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
35 |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
36 static void pack_li_0_C(unsigned char *dst, unsigned char *y, |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
37 unsigned char *u, unsigned char *v, int w, int us, int vs) |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
38 { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
39 int j; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
40 for (j = w/2; j; j--) { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
41 *dst++ = *y++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
42 *dst++ = (u[us+us] + 7*u[0])>>3; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
43 *dst++ = *y++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
44 *dst++ = (v[vs+vs] + 7*v[0])>>3; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
45 u++; v++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
46 } |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
47 } |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
48 |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
49 static void pack_li_1_C(unsigned char *dst, unsigned char *y, |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
50 unsigned char *u, unsigned char *v, int w, int us, int vs) |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
51 { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
52 int j; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
53 for (j = w/2; j; j--) { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
54 *dst++ = *y++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
55 *dst++ = (3*u[us+us] + 5*u[0])>>3; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
56 *dst++ = *y++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
57 *dst++ = (3*v[vs+vs] + 5*v[0])>>3; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
58 u++; v++; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
59 } |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
60 } |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
61 |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
62 #ifdef HAVE_MMX |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
63 static void pack_nn_MMX(unsigned char *dst, unsigned char *y, |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
64 unsigned char *u, unsigned char *v, int w) |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
65 { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
66 int j; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
67 asm volatile ("" |
19372
6334c14b38eb
Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents:
18746
diff
changeset
|
68 ASMALIGN(4) |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
69 "1: \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
70 "movq (%0), %%mm1 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
71 "movq (%0), %%mm2 \n\t" |
11648 | 72 "movq (%1), %%mm4 \n\t" |
73 "movq (%2), %%mm6 \n\t" | |
74 "punpcklbw %%mm6, %%mm4 \n\t" | |
75 "punpcklbw %%mm4, %%mm1 \n\t" | |
76 "punpckhbw %%mm4, %%mm2 \n\t" | |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
77 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
78 "add $8, %0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
79 "add $4, %1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
80 "add $4, %2 \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
81 "movq %%mm1, (%3) \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
82 "movq %%mm2, 8(%3) \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
83 "add $16, %3 \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
84 "decl %4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
85 "jnz 1b \n\t" |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
86 "emms \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
87 : |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
88 : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
89 : "memory" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
90 ); |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
91 pack_nn_C(dst, y, u, v, (w&7)); |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
92 } |
11645 | 93 |
94 static void pack_li_0_MMX(unsigned char *dst, unsigned char *y, | |
95 unsigned char *u, unsigned char *v, int w, int us, int vs) | |
96 { | |
97 asm volatile ("" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
98 "push %%"REG_BP" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
99 #ifdef ARCH_X86_64 |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
100 "mov %6, %%"REG_BP" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
101 #else |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
102 "movl 4(%%"REG_d"), %%"REG_BP" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
103 "movl (%%"REG_d"), %%"REG_d" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
104 #endif |
11645 | 105 "pxor %%mm0, %%mm0 \n\t" |
106 | |
19372
6334c14b38eb
Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents:
18746
diff
changeset
|
107 ASMALIGN(4) |
11645 | 108 ".Lli0: \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
109 "movq (%%"REG_S"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
110 "movq (%%"REG_S"), %%mm2 \n\t" |
11645 | 111 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
112 "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
113 "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" |
11645 | 114 "punpcklbw %%mm0, %%mm4 \n\t" |
115 "punpcklbw %%mm0, %%mm6 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
116 "movq (%%"REG_a"), %%mm3 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
117 "movq (%%"REG_b"), %%mm5 \n\t" |
11645 | 118 "punpcklbw %%mm0, %%mm3 \n\t" |
119 "punpcklbw %%mm0, %%mm5 \n\t" | |
120 "paddw %%mm3, %%mm4 \n\t" | |
121 "paddw %%mm5, %%mm6 \n\t" | |
122 "paddw %%mm3, %%mm4 \n\t" | |
123 "paddw %%mm5, %%mm6 \n\t" | |
124 "paddw %%mm3, %%mm4 \n\t" | |
125 "paddw %%mm5, %%mm6 \n\t" | |
126 "paddw %%mm3, %%mm4 \n\t" | |
127 "paddw %%mm5, %%mm6 \n\t" | |
128 "paddw %%mm3, %%mm4 \n\t" | |
129 "paddw %%mm5, %%mm6 \n\t" | |
130 "paddw %%mm3, %%mm4 \n\t" | |
131 "paddw %%mm5, %%mm6 \n\t" | |
132 "paddw %%mm3, %%mm4 \n\t" | |
133 "paddw %%mm5, %%mm6 \n\t" | |
134 "psrlw $3, %%mm4 \n\t" | |
135 "psrlw $3, %%mm6 \n\t" | |
11648 | 136 "packuswb %%mm4, %%mm4 \n\t" |
137 "packuswb %%mm6, %%mm6 \n\t" | |
138 "punpcklbw %%mm6, %%mm4 \n\t" | |
139 "punpcklbw %%mm4, %%mm1 \n\t" | |
140 "punpckhbw %%mm4, %%mm2 \n\t" | |
11645 | 141 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
142 "movq %%mm1, (%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
143 "movq %%mm2, 8(%%"REG_D") \n\t" |
11645 | 144 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
145 "movq 8(%%"REG_S"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
146 "movq 8(%%"REG_S"), %%mm2 \n\t" |
11645 | 147 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
148 "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
149 "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" |
11645 | 150 "punpckhbw %%mm0, %%mm4 \n\t" |
151 "punpckhbw %%mm0, %%mm6 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
152 "movq (%%"REG_a"), %%mm3 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
153 "movq (%%"REG_b"), %%mm5 \n\t" |
11645 | 154 "punpckhbw %%mm0, %%mm3 \n\t" |
155 "punpckhbw %%mm0, %%mm5 \n\t" | |
156 "paddw %%mm3, %%mm4 \n\t" | |
157 "paddw %%mm5, %%mm6 \n\t" | |
158 "paddw %%mm3, %%mm4 \n\t" | |
159 "paddw %%mm5, %%mm6 \n\t" | |
160 "paddw %%mm3, %%mm4 \n\t" | |
161 "paddw %%mm5, %%mm6 \n\t" | |
162 "paddw %%mm3, %%mm4 \n\t" | |
163 "paddw %%mm5, %%mm6 \n\t" | |
164 "paddw %%mm3, %%mm4 \n\t" | |
165 "paddw %%mm5, %%mm6 \n\t" | |
166 "paddw %%mm3, %%mm4 \n\t" | |
167 "paddw %%mm5, %%mm6 \n\t" | |
168 "paddw %%mm3, %%mm4 \n\t" | |
169 "paddw %%mm5, %%mm6 \n\t" | |
170 "psrlw $3, %%mm4 \n\t" | |
171 "psrlw $3, %%mm6 \n\t" | |
11648 | 172 "packuswb %%mm4, %%mm4 \n\t" |
173 "packuswb %%mm6, %%mm6 \n\t" | |
174 "punpcklbw %%mm6, %%mm4 \n\t" | |
175 "punpcklbw %%mm4, %%mm1 \n\t" | |
176 "punpckhbw %%mm4, %%mm2 \n\t" | |
11645 | 177 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
178 "add $16, %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
179 "add $8, %%"REG_a" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
180 "add $8, %%"REG_b" \n\t" |
11645 | 181 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
182 "movq %%mm1, 16(%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
183 "movq %%mm2, 24(%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
184 "add $32, %%"REG_D" \n\t" |
11645 | 185 |
186 "decl %%ecx \n\t" | |
187 "jnz .Lli0 \n\t" | |
188 "emms \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
189 "pop %%"REG_BP" \n\t" |
11645 | 190 : |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
191 : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
192 #ifdef ARCH_X86_64 |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
193 "d" ((long)us), "r" ((long)vs) |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
194 #else |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
195 "d" (&us) |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
196 #endif |
11645 | 197 : "memory" |
198 ); | |
199 pack_li_0_C(dst, y, u, v, (w&15), us, vs); | |
200 } | |
201 | |
202 static void pack_li_1_MMX(unsigned char *dst, unsigned char *y, | |
203 unsigned char *u, unsigned char *v, int w, int us, int vs) | |
204 { | |
205 asm volatile ("" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
206 "push %%"REG_BP" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
207 #ifdef ARCH_X86_64 |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
208 "mov %6, %%"REG_BP" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
209 #else |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
210 "movl 4(%%"REG_d"), %%"REG_BP" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
211 "movl (%%"REG_d"), %%"REG_d" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
212 #endif |
11645 | 213 "pxor %%mm0, %%mm0 \n\t" |
214 | |
19372
6334c14b38eb
Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents:
18746
diff
changeset
|
215 ASMALIGN(4) |
11645 | 216 ".Lli1: \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
217 "movq (%%"REG_S"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
218 "movq (%%"REG_S"), %%mm2 \n\t" |
11645 | 219 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
220 "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
221 "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" |
11645 | 222 "punpcklbw %%mm0, %%mm4 \n\t" |
223 "punpcklbw %%mm0, %%mm6 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
224 "movq (%%"REG_a"), %%mm3 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
225 "movq (%%"REG_b"), %%mm5 \n\t" |
11645 | 226 "punpcklbw %%mm0, %%mm3 \n\t" |
227 "punpcklbw %%mm0, %%mm5 \n\t" | |
228 "movq %%mm4, %%mm7 \n\t" | |
229 "paddw %%mm4, %%mm4 \n\t" | |
230 "paddw %%mm7, %%mm4 \n\t" | |
231 "movq %%mm6, %%mm7 \n\t" | |
232 "paddw %%mm6, %%mm6 \n\t" | |
233 "paddw %%mm7, %%mm6 \n\t" | |
234 "paddw %%mm3, %%mm4 \n\t" | |
235 "paddw %%mm5, %%mm6 \n\t" | |
236 "paddw %%mm3, %%mm4 \n\t" | |
237 "paddw %%mm5, %%mm6 \n\t" | |
238 "paddw %%mm3, %%mm4 \n\t" | |
239 "paddw %%mm5, %%mm6 \n\t" | |
240 "paddw %%mm3, %%mm4 \n\t" | |
241 "paddw %%mm5, %%mm6 \n\t" | |
242 "paddw %%mm3, %%mm4 \n\t" | |
243 "paddw %%mm5, %%mm6 \n\t" | |
244 "psrlw $3, %%mm4 \n\t" | |
245 "psrlw $3, %%mm6 \n\t" | |
11648 | 246 "packuswb %%mm4, %%mm4 \n\t" |
247 "packuswb %%mm6, %%mm6 \n\t" | |
248 "punpcklbw %%mm6, %%mm4 \n\t" | |
249 "punpcklbw %%mm4, %%mm1 \n\t" | |
250 "punpckhbw %%mm4, %%mm2 \n\t" | |
11645 | 251 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
252 "movq %%mm1, (%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
253 "movq %%mm2, 8(%%"REG_D") \n\t" |
11645 | 254 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
255 "movq 8(%%"REG_S"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
256 "movq 8(%%"REG_S"), %%mm2 \n\t" |
11645 | 257 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
258 "movq (%%"REG_a",%%"REG_d",2), %%mm4 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
259 "movq (%%"REG_b",%%"REG_BP",2), %%mm6 \n\t" |
11645 | 260 "punpckhbw %%mm0, %%mm4 \n\t" |
261 "punpckhbw %%mm0, %%mm6 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
262 "movq (%%"REG_a"), %%mm3 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
263 "movq (%%"REG_b"), %%mm5 \n\t" |
11645 | 264 "punpckhbw %%mm0, %%mm3 \n\t" |
265 "punpckhbw %%mm0, %%mm5 \n\t" | |
266 "movq %%mm4, %%mm7 \n\t" | |
267 "paddw %%mm4, %%mm4 \n\t" | |
268 "paddw %%mm7, %%mm4 \n\t" | |
269 "movq %%mm6, %%mm7 \n\t" | |
270 "paddw %%mm6, %%mm6 \n\t" | |
271 "paddw %%mm7, %%mm6 \n\t" | |
272 "paddw %%mm3, %%mm4 \n\t" | |
273 "paddw %%mm5, %%mm6 \n\t" | |
274 "paddw %%mm3, %%mm4 \n\t" | |
275 "paddw %%mm5, %%mm6 \n\t" | |
276 "paddw %%mm3, %%mm4 \n\t" | |
277 "paddw %%mm5, %%mm6 \n\t" | |
278 "paddw %%mm3, %%mm4 \n\t" | |
279 "paddw %%mm5, %%mm6 \n\t" | |
280 "paddw %%mm3, %%mm4 \n\t" | |
281 "paddw %%mm5, %%mm6 \n\t" | |
282 "psrlw $3, %%mm4 \n\t" | |
283 "psrlw $3, %%mm6 \n\t" | |
11648 | 284 "packuswb %%mm4, %%mm4 \n\t" |
285 "packuswb %%mm6, %%mm6 \n\t" | |
286 "punpcklbw %%mm6, %%mm4 \n\t" | |
287 "punpcklbw %%mm4, %%mm1 \n\t" | |
288 "punpckhbw %%mm4, %%mm2 \n\t" | |
11645 | 289 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
290 "add $16, %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
291 "add $8, %%"REG_a" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
292 "add $8, %%"REG_b" \n\t" |
11645 | 293 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
294 "movq %%mm1, 16(%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
295 "movq %%mm2, 24(%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
296 "add $32, %%"REG_D" \n\t" |
11645 | 297 |
298 "decl %%ecx \n\t" | |
299 "jnz .Lli1 \n\t" | |
300 "emms \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
301 "pop %%"REG_BP" \n\t" |
11645 | 302 : |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
303 : "S" (y), "D" (dst), "a" (u), "b" (v), "c" (w/16), |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
304 #ifdef ARCH_X86_64 |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
305 "d" ((long)us), "r" ((long)vs) |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
306 #else |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
307 "d" (&us) |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
11648
diff
changeset
|
308 #endif |
11645 | 309 : "memory" |
310 ); | |
311 pack_li_1_C(dst, y, u, v, (w&15), us, vs); | |
312 } | |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
313 #endif |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
314 |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
315 static pack_func_t *pack_nn; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
316 static pack_func_t *pack_li_0; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
317 static pack_func_t *pack_li_1; |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
318 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
319 static void ilpack(unsigned char *dst, unsigned char *src[3], |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
320 int dststride, int srcstride[3], int w, int h, pack_func_t *pack[2]) |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
321 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
322 int i; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
323 unsigned char *y, *u, *v; |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
324 int ys = srcstride[0], us = srcstride[1], vs = srcstride[2]; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
325 int a, b; |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
326 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
327 y = src[0]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
328 u = src[1]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
329 v = src[2]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
330 |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
331 pack_nn(dst, y, u, v, w, 0, 0); |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
332 y += ys; dst += dststride; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
333 pack_nn(dst, y, u+us, v+vs, w, 0, 0); |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
334 y += ys; dst += dststride; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
335 for (i=2; i<h-2; i++) { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
336 a = (i&2) ? 1 : -1; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
337 b = (i&1) ^ ((i&2)>>1); |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
338 pack[b](dst, y, u, v, w, us*a, vs*a); |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
339 y += ys; |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
340 if ((i&3) == 1) { |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
341 u -= us; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
342 v -= vs; |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
343 } else { |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
344 u += us; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
345 v += vs; |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
346 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
347 dst += dststride; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
348 } |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
349 pack_nn(dst, y, u, v, w, 0, 0); |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
350 y += ys; dst += dststride; u += us; v += vs; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
351 pack_nn(dst, y, u, v, w, 0, 0); |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
352 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
353 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
354 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
355 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
356 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
357 mp_image_t *dmpi; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
358 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
359 // hope we'll get DR buffer: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
360 dmpi=vf_get_image(vf->next, IMGFMT_YUY2, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
361 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
362 mpi->w, mpi->h); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
363 |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
364 ilpack(dmpi->planes[0], mpi->planes, dmpi->stride[0], mpi->stride, mpi->w, mpi->h, vf->priv->pack); |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
365 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
366 return vf_next_put_image(vf,dmpi, pts); |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
367 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
368 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
369 static int config(struct vf_instance_s* vf, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
370 int width, int height, int d_width, int d_height, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
371 unsigned int flags, unsigned int outfmt) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
372 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
373 /* FIXME - also support UYVY output? */ |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
374 return vf_next_config(vf, width, height, d_width, d_height, flags, IMGFMT_YUY2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
375 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
376 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
377 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
378 static int query_format(struct vf_instance_s* vf, unsigned int fmt) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
379 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
380 /* FIXME - really any YUV 4:2:0 input format should work */ |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
381 switch (fmt) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
382 case IMGFMT_YV12: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
383 case IMGFMT_IYUV: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
384 case IMGFMT_I420: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
385 return vf_next_query_format(vf,IMGFMT_YUY2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
386 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
387 return 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
388 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
389 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
390 static int open(vf_instance_t *vf, char* args) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
391 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
392 vf->config=config; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
393 vf->query_format=query_format; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
394 vf->put_image=put_image; |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
395 vf->priv = calloc(1, sizeof(struct vf_priv_s)); |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
396 vf->priv->mode = 1; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
397 if (args) sscanf(args, "%d", &vf->priv->mode); |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
398 |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
399 pack_nn = (pack_func_t *)pack_nn_C; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
400 pack_li_0 = pack_li_0_C; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
401 pack_li_1 = pack_li_1_C; |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
402 #ifdef HAVE_MMX |
11645 | 403 if(gCpuCaps.hasMMX) { |
404 pack_nn = (pack_func_t *)pack_nn_MMX; | |
405 pack_li_0 = pack_li_0_MMX; | |
406 pack_li_1 = pack_li_1_MMX; | |
407 } | |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
408 #endif |
11643
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
409 |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
410 switch(vf->priv->mode) { |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
411 case 0: |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
412 vf->priv->pack[0] = vf->priv->pack[1] = pack_nn; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
413 break; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
414 default: |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
415 mp_msg(MSGT_VFILTER, MSGL_WARN, |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
416 "ilpack: unknown mode %d (fallback to linear)\n", |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
417 vf->priv->mode); |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
418 case 1: |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
419 vf->priv->pack[0] = pack_li_0; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
420 vf->priv->pack[1] = pack_li_1; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
421 break; |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
422 } |
3ddfe9316ca9
big updates to ilpack: do proper interpolation rather than just
rfelker
parents:
9933
diff
changeset
|
423 |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
424 return 1; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
425 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
426 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
427 vf_info_t vf_info_ilpack = { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
428 "4:2:0 planar -> 4:2:2 packed reinterlacer", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
429 "ilpack", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
430 "Richard Felker", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
431 "", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
432 open, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
433 NULL |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
434 }; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
435 |