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