Mercurial > mplayer.hg
annotate libmpcodecs/vf_tfields.c @ 14344:e424e76d68ea
small fixes/improvements
author | kraymer |
---|---|
date | Mon, 03 Jan 2005 23:13:22 +0000 |
parents | 821f464b4d90 |
children | 32dcf8672086 |
rev | line source |
---|---|
9514 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 | |
5 #include "../config.h" | |
6 #include "../mp_msg.h" | |
10020 | 7 #include "../cpudetect.h" |
9514 | 8 |
9 #include "img_format.h" | |
10 #include "mp_image.h" | |
11 #include "vf.h" | |
12 | |
13 #include "../libvo/fastmemcpy.h" | |
14 | |
15 struct vf_priv_s { | |
16 int mode; | |
17 }; | |
18 | |
19 static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride) | |
20 { | |
21 int i; | |
22 void *retval=dst; | |
23 | |
24 for(i=0; i<height; i++) | |
25 { | |
26 memcpy(dst, src, bytesPerLine); | |
27 src+= srcStride; | |
28 dst+= dstStride; | |
29 } | |
30 | |
31 return retval; | |
32 } | |
33 | |
34 static void deint(unsigned char *dest, int ds, unsigned char *src, int ss, int w, int h, int field) | |
35 { | |
36 int x, y; | |
37 src += ss; | |
38 dest += ds; | |
39 if (field) { | |
40 src += ss; | |
41 dest += ds; | |
42 h -= 2; | |
43 } | |
44 for (y=h/2; y; y--) { | |
45 for (x=0; x<w; x++) { | |
46 if (((src[x-ss] < src[x]) && (src[x+ss] < src[x])) || | |
47 ((src[x-ss] > src[x]) && (src[x+ss] > src[x]))) { | |
48 //dest[x] = (src[x+ss] + src[x-ss])>>1; | |
49 dest[x] = ((src[x+ss]<<1) + (src[x-ss]<<1) | |
50 + src[x+ss+1] + src[x-ss+1] | |
51 + src[x+ss-1] + src[x-ss-1])>>3; | |
52 } | |
53 else dest[x] = src[x]; | |
54 } | |
55 dest += ds<<1; | |
56 src += ss<<1; | |
57 } | |
58 } | |
59 | |
10020 | 60 #ifdef HAVE_3DNOW |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
61 static void qpel_li_3DNOW(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up) |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
62 { |
10020 | 63 int i, j, ssd=ss; |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
64 long crap1, crap2; |
10020 | 65 if (up) { |
66 ssd = -ss; | |
67 memcpy(d, s, w); | |
68 d += ds; | |
69 s += ss; | |
70 } | |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
71 for (i=h-1; i; i--) { |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
72 asm volatile( |
10020 | 73 "1: \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
74 "movq (%%"REG_S"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
75 "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" |
10020 | 76 "pavgusb %%mm0, %%mm1 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
77 "add $8, %%"REG_S" \n\t" |
10020 | 78 "pavgusb %%mm0, %%mm1 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
79 "movq %%mm1, (%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
80 "add $8, %%"REG_D" \n\t" |
10020 | 81 "decl %%ecx \n\t" |
82 "jnz 1b \n\t" | |
83 : "=S"(crap1), "=D"(crap2) | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
84 : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd) |
10020 | 85 ); |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
86 for (j=w-(w&7); j<w; j++) |
10020 | 87 d[j] = (s[j+ssd] + 3*s[j])>>2; |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
88 d += ds; |
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
89 s += ss; |
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
90 } |
10020 | 91 if (!up) memcpy(d, s, w); |
92 asm volatile("emms \n\t" : : : "memory"); | |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
93 } |
10020 | 94 #endif |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
95 |
10020 | 96 #ifdef HAVE_MMX2 |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
97 static void qpel_li_MMX2(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up) |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
98 { |
10020 | 99 int i, j, ssd=ss; |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
100 long crap1, crap2; |
10020 | 101 if (up) { |
102 ssd = -ss; | |
103 memcpy(d, s, w); | |
104 d += ds; | |
105 s += ss; | |
106 } | |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
107 for (i=h-1; i; i--) { |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
108 asm volatile( |
10020 | 109 "pxor %%mm7, %%mm7 \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
110 "2: \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
111 "movq (%%"REG_S"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
112 "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" |
10020 | 113 "pavgb %%mm0, %%mm1 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
114 "add $8, %%"REG_S" \n\t" |
10020 | 115 "pavgb %%mm0, %%mm1 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
116 "movq %%mm1, (%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
117 "add $8, %%"REG_D" \n\t" |
10020 | 118 "decl %%ecx \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
119 "jnz 2b \n\t" |
10020 | 120 : "=S"(crap1), "=D"(crap2) |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
121 : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd) |
10020 | 122 ); |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
123 for (j=w-(w&7); j<w; j++) |
10020 | 124 d[j] = (s[j+ssd] + 3*s[j])>>2; |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
125 d += ds; |
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
126 s += ss; |
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
127 } |
10020 | 128 if (!up) memcpy(d, s, w); |
129 asm volatile("emms \n\t" : : : "memory"); | |
130 } | |
131 #endif | |
132 | |
133 #ifdef HAVE_MMX | |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
134 static void qpel_li_MMX(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up) |
10020 | 135 { |
136 int i, j, ssd=ss; | |
137 int crap1, crap2; | |
138 if (up) { | |
139 ssd = -ss; | |
140 memcpy(d, s, w); | |
141 d += ds; | |
142 s += ss; | |
143 } | |
144 for (i=h-1; i; i--) { | |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
145 asm volatile( |
10020 | 146 "pxor %%mm7, %%mm7 \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
147 "3: \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
148 "movq (%%"REG_S"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
149 "movq (%%"REG_S"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
150 "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
151 "movq (%%"REG_S",%%"REG_a"), %%mm3 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
152 "add $8, %%"REG_S" \n\t" |
10020 | 153 "punpcklbw %%mm7, %%mm0 \n\t" |
154 "punpckhbw %%mm7, %%mm1 \n\t" | |
155 "punpcklbw %%mm7, %%mm2 \n\t" | |
156 "punpckhbw %%mm7, %%mm3 \n\t" | |
157 "paddw %%mm0, %%mm2 \n\t" | |
158 "paddw %%mm1, %%mm3 \n\t" | |
159 "paddw %%mm0, %%mm2 \n\t" | |
160 "paddw %%mm1, %%mm3 \n\t" | |
161 "paddw %%mm0, %%mm2 \n\t" | |
162 "paddw %%mm1, %%mm3 \n\t" | |
163 "psrlw $2, %%mm2 \n\t" | |
164 "psrlw $2, %%mm3 \n\t" | |
165 "packsswb %%mm3, %%mm2 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
166 "movq %%mm2, (%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
167 "add $8, %%"REG_D" \n\t" |
10020 | 168 "decl %%ecx \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
169 "jnz 3b \n\t" |
10020 | 170 : "=S"(crap1), "=D"(crap2) |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
171 : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd) |
10020 | 172 ); |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
173 for (j=w-(w&7); j<w; j++) |
10020 | 174 d[j] = (s[j+ssd] + 3*s[j])>>2; |
175 d += ds; | |
176 s += ss; | |
177 } | |
178 if (!up) memcpy(d, s, w); | |
179 asm volatile("emms \n\t" : : : "memory"); | |
180 } | |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
181 |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
182 static void qpel_4tap_MMX(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
183 { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
184 int i, j, ssd=ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
185 static const short filter[] = { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
186 29, 29, 29, 29, 110, 110, 110, 110, |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
187 9, 9, 9, 9, 3, 3, 3, 3, |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
188 64, 64, 64, 64 }; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
189 int crap1, crap2; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
190 if (up) { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
191 ssd = -ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
192 memcpy(d, s, w); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
193 d += ds; s += ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
194 } |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
195 for (j=0; j<w; j++) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
196 d[j] = (s[j+ssd] + 3*s[j])>>2; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
197 d += ds; s += ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
198 for (i=h-3; i; i--) { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
199 asm volatile( |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
200 "pxor %%mm0, %%mm0 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
201 "movq (%%"REG_d"), %%mm4 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
202 "movq 8(%%"REG_d"), %%mm5 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
203 "movq 16(%%"REG_d"), %%mm6 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
204 "movq 24(%%"REG_d"), %%mm7 \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
205 "4: \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
206 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
207 "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
208 "movq (%%"REG_S"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
209 "movq (%%"REG_S",%%"REG_b"), %%mm3 \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
210 "punpcklbw %%mm0, %%mm1 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
211 "punpcklbw %%mm0, %%mm2 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
212 "pmullw %%mm4, %%mm1 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
213 "punpcklbw %%mm0, %%mm3 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
214 "pmullw %%mm5, %%mm2 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
215 "paddusw %%mm2, %%mm1 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
216 "pmullw %%mm6, %%mm3 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
217 "movq (%%"REG_S",%%"REG_a",2), %%mm2 \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
218 "psubusw %%mm3, %%mm1 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
219 "punpcklbw %%mm0, %%mm2 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
220 "pmullw %%mm7, %%mm2 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
221 "psubusw %%mm2, %%mm1 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
222 "psrlw $7, %%mm1 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
223 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
224 "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
225 "movq (%%"REG_S"), %%mm3 \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
226 "punpckhbw %%mm0, %%mm2 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
227 "punpckhbw %%mm0, %%mm3 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
228 "pmullw %%mm4, %%mm2 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
229 "pmullw %%mm5, %%mm3 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
230 "paddusw %%mm3, %%mm2 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
231 "movq (%%"REG_S",%%"REG_b"), %%mm3 \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
232 "punpckhbw %%mm0, %%mm3 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
233 "pmullw %%mm6, %%mm3 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
234 "psubusw %%mm3, %%mm2 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
235 "movq (%%"REG_S",%%"REG_a",2), %%mm3 \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
236 "punpckhbw %%mm0, %%mm3 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
237 "add $8, %%"REG_S" \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
238 "pmullw %%mm7, %%mm3 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
239 "psubusw %%mm3, %%mm2 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
240 "psrlw $7, %%mm2 \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
241 |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
242 "packuswb %%mm2, %%mm1 \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
243 "movq %%mm1, (%%"REG_D") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
244 "add $8, %%"REG_D" \n\t" |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
245 "decl %%ecx \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
246 "jnz 4b \n\t" |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
247 : "=S"(crap1), "=D"(crap2) |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10078
diff
changeset
|
248 : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd), "b"((long)-ssd), "d"(filter) |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
249 ); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
250 for (j=w-(w&7); j<w; j++) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
251 d[j] = (-9*s[j-ssd] + 111*s[j] + 29*s[j+ssd] - 3*s[j+ssd+ssd])>>7; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
252 d += ds; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
253 s += ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
254 } |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
255 for (j=0; j<w; j++) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
256 d[j] = (s[j+ssd] + 3*s[j])>>2; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
257 d += ds; s += ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
258 if (!up) memcpy(d, s, w); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
259 asm volatile("emms \n\t" : : : "memory"); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
260 } |
10020 | 261 #endif |
262 | |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
263 static inline int clamp(int a) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
264 { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
265 // If a<512, this is equivalent to: |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
266 // return (a<0) ? 0 : ( (a>255) ? 255 : a); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
267 return (~(a>>31)) & (a | ((a<<23)>>31)); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
268 } |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
269 |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
270 static void qpel_li_C(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up) |
10020 | 271 { |
272 int i, j, ssd=ss; | |
273 if (up) { | |
274 ssd = -ss; | |
275 memcpy(d, s, w); | |
276 d += ds; | |
277 s += ss; | |
278 } | |
279 for (i=h-1; i; i--) { | |
280 for (j=0; j<w; j++) | |
281 d[j] = (s[j+ssd] + 3*s[j])>>2; | |
282 d += ds; | |
283 s += ss; | |
284 } | |
285 if (!up) memcpy(d, s, w); | |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
286 } |
9514 | 287 |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
288 static void qpel_4tap_C(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
289 { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
290 int i, j, ssd=ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
291 if (up) { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
292 ssd = -ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
293 memcpy(d, s, w); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
294 d += ds; s += ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
295 } |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
296 for (j=0; j<w; j++) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
297 d[j] = (s[j+ssd] + 3*s[j] + 2)>>2; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
298 d += ds; s += ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
299 for (i=h-3; i; i--) { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
300 for (j=0; j<w; j++) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
301 d[j] = clamp((-9*s[j-ssd] + 111*s[j] + 29*s[j+ssd] - 3*s[j+ssd+ssd] + 64)>>7); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
302 d += ds; s += ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
303 } |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
304 for (j=0; j<w; j++) |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
305 d[j] = (s[j+ssd] + 3*s[j] + 2)>>2; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
306 d += ds; s += ss; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
307 if (!up) memcpy(d, s, w); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
308 } |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
309 |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
310 static void (*qpel_li)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up); |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
311 static void (*qpel_4tap)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up); |
9514 | 312 |
313 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) | |
314 { | |
315 int ret; | |
316 mp_image_t *dmpi; | |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
317 void (*qpel)(unsigned char *, unsigned char *, int, int, int, int, int); |
10078
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
318 int bpp=1; |
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
319 |
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
320 if (!(mpi->flags & MP_IMGFLAG_PLANAR)) bpp = mpi->bpp/8; |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
321 |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
322 switch (vf->priv->mode) { |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
323 case 2: |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
324 qpel = qpel_li; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
325 break; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
326 case 3: |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
327 // TODO: add 3tap filter |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
328 qpel = qpel_4tap; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
329 break; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
330 case 4: |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
331 qpel = qpel_4tap; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
332 break; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
333 } |
9514 | 334 |
335 switch (vf->priv->mode) { | |
336 case 0: | |
337 dmpi = vf_get_image(vf->next, mpi->imgfmt, | |
338 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, | |
339 mpi->width, mpi->height/2); | |
10078
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
340 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w*bpp, mpi->h/2, |
9514 | 341 dmpi->stride[0], mpi->stride[0]*2); |
342 if (mpi->flags & MP_IMGFLAG_PLANAR) { | |
343 memcpy_pic(dmpi->planes[1], mpi->planes[1], | |
344 mpi->chroma_width, mpi->chroma_height/2, | |
345 dmpi->stride[1], mpi->stride[1]*2); | |
346 memcpy_pic(dmpi->planes[2], mpi->planes[2], | |
347 mpi->chroma_width, mpi->chroma_height/2, | |
348 dmpi->stride[2], mpi->stride[2]*2); | |
349 } | |
350 ret = vf_next_put_image(vf, dmpi); | |
10052
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
10049
diff
changeset
|
351 vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL); |
9514 | 352 |
353 memcpy_pic(dmpi->planes[0], mpi->planes[0] + mpi->stride[0], | |
10078
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
354 mpi->w*bpp, mpi->h/2, dmpi->stride[0], mpi->stride[0]*2); |
9514 | 355 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
356 memcpy_pic(dmpi->planes[1], mpi->planes[1] + mpi->stride[1], | |
357 mpi->chroma_width, mpi->chroma_height/2, | |
358 dmpi->stride[1], mpi->stride[1]*2); | |
359 memcpy_pic(dmpi->planes[2], mpi->planes[2] + mpi->stride[2], | |
360 mpi->chroma_width, mpi->chroma_height/2, | |
361 dmpi->stride[2], mpi->stride[2]*2); | |
362 } | |
363 return vf_next_put_image(vf, dmpi) || ret; | |
364 case 1: | |
365 dmpi = vf_get_image(vf->next, mpi->imgfmt, | |
366 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, | |
367 mpi->width, mpi->height); | |
10078
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
368 my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w*bpp, mpi->h/2, |
9514 | 369 dmpi->stride[0]*2, mpi->stride[0]*2); |
370 deint(dmpi->planes[0], dmpi->stride[0], mpi->planes[0], mpi->stride[0], mpi->w, mpi->h, 0); | |
371 if (mpi->flags & MP_IMGFLAG_PLANAR) { | |
372 my_memcpy_pic(dmpi->planes[1], mpi->planes[1], | |
373 mpi->chroma_width, mpi->chroma_height/2, | |
374 dmpi->stride[1]*2, mpi->stride[1]*2); | |
375 my_memcpy_pic(dmpi->planes[2], mpi->planes[2], | |
376 mpi->chroma_width, mpi->chroma_height/2, | |
377 dmpi->stride[2]*2, mpi->stride[2]*2); | |
378 deint(dmpi->planes[1], dmpi->stride[1], mpi->planes[1], mpi->stride[1], | |
379 mpi->chroma_width, mpi->chroma_height, 0); | |
380 deint(dmpi->planes[2], dmpi->stride[2], mpi->planes[2], mpi->stride[2], | |
381 mpi->chroma_width, mpi->chroma_height, 0); | |
382 } | |
383 ret = vf_next_put_image(vf, dmpi); | |
10052
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
10049
diff
changeset
|
384 vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL); |
9514 | 385 |
386 my_memcpy_pic(dmpi->planes[0] + dmpi->stride[0], mpi->planes[0] + mpi->stride[0], | |
10078
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
387 mpi->w*bpp, mpi->h/2, dmpi->stride[0]*2, mpi->stride[0]*2); |
9514 | 388 deint(dmpi->planes[0], dmpi->stride[0], mpi->planes[0], mpi->stride[0], mpi->w, mpi->h, 1); |
389 if (mpi->flags & MP_IMGFLAG_PLANAR) { | |
390 my_memcpy_pic(dmpi->planes[1] + dmpi->stride[1], mpi->planes[1] + mpi->stride[1], | |
391 mpi->chroma_width, mpi->chroma_height/2, | |
392 dmpi->stride[1]*2, mpi->stride[1]*2); | |
393 my_memcpy_pic(dmpi->planes[2] + dmpi->stride[2], mpi->planes[2] + mpi->stride[2], | |
394 mpi->chroma_width, mpi->chroma_height/2, | |
395 dmpi->stride[2]*2, mpi->stride[2]*2); | |
396 deint(dmpi->planes[1], dmpi->stride[1], mpi->planes[1], mpi->stride[1], | |
397 mpi->chroma_width, mpi->chroma_height, 1); | |
398 deint(dmpi->planes[2], dmpi->stride[2], mpi->planes[2], mpi->stride[2], | |
399 mpi->chroma_width, mpi->chroma_height, 1); | |
400 } | |
401 return vf_next_put_image(vf, dmpi) || ret; | |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
402 case 2: |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
403 case 3: |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
404 case 4: |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
405 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
406 MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
407 mpi->width, mpi->height/2); |
10078
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
408 qpel(dmpi->planes[0], mpi->planes[0], mpi->w*bpp, mpi->h/2, |
10020 | 409 dmpi->stride[0], mpi->stride[0]*2, 0); |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
410 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
10020 | 411 qpel(dmpi->planes[1], mpi->planes[1], |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
412 mpi->chroma_width, mpi->chroma_height/2, |
10020 | 413 dmpi->stride[1], mpi->stride[1]*2, 0); |
414 qpel(dmpi->planes[2], mpi->planes[2], | |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
415 mpi->chroma_width, mpi->chroma_height/2, |
10020 | 416 dmpi->stride[2], mpi->stride[2]*2, 0); |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
417 } |
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
418 ret = vf_next_put_image(vf, dmpi); |
10052
b358b7509e1a
sort of a hack, but at least this lets the framerate-increasing
rfelker
parents:
10049
diff
changeset
|
419 vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL); |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
420 |
10020 | 421 qpel(dmpi->planes[0], mpi->planes[0] + mpi->stride[0], |
10078
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
422 mpi->w*bpp, mpi->h/2, dmpi->stride[0], mpi->stride[0]*2, 1); |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
423 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
10020 | 424 qpel(dmpi->planes[1], mpi->planes[1] + mpi->stride[1], |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
425 mpi->chroma_width, mpi->chroma_height/2, |
10020 | 426 dmpi->stride[1], mpi->stride[1]*2, 1); |
427 qpel(dmpi->planes[2], mpi->planes[2] + mpi->stride[2], | |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
428 mpi->chroma_width, mpi->chroma_height/2, |
10020 | 429 dmpi->stride[2], mpi->stride[2]*2, 1); |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
430 } |
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
431 return vf_next_put_image(vf, dmpi) || ret; |
9514 | 432 } |
433 return 0; | |
434 } | |
435 | |
436 static int query_format(struct vf_instance_s* vf, unsigned int fmt) | |
437 { | |
438 /* FIXME - figure out which other formats work */ | |
439 switch (fmt) { | |
440 case IMGFMT_YV12: | |
441 case IMGFMT_IYUV: | |
442 case IMGFMT_I420: | |
443 return vf_next_query_format(vf, fmt); | |
444 } | |
445 return 0; | |
446 } | |
447 | |
448 static int config(struct vf_instance_s* vf, | |
449 int width, int height, int d_width, int d_height, | |
450 unsigned int flags, unsigned int outfmt) | |
451 { | |
452 switch (vf->priv->mode) { | |
453 case 0: | |
10009
69f10d08c3be
new mode for tfields filter -- shifts fields by a quarter-pixel so the
rfelker
parents:
9593
diff
changeset
|
454 case 2: |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
455 case 3: |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
456 case 4: |
9514 | 457 return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt); |
458 case 1: | |
459 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); | |
460 } | |
461 return 0; | |
462 } | |
463 | |
464 static void uninit(struct vf_instance_s* vf) | |
465 { | |
466 free(vf->priv); | |
467 } | |
468 | |
469 static int open(vf_instance_t *vf, char* args) | |
470 { | |
471 struct vf_priv_s *p; | |
472 vf->config = config; | |
473 vf->put_image = put_image; | |
10078
379f48cace77
support more image formats. hopefully this bpp handling is correct...
rfelker
parents:
10052
diff
changeset
|
474 //vf->query_format = query_format; |
9514 | 475 vf->uninit = uninit; |
476 vf->default_reqs = VFCAP_ACCEPT_STRIDE; | |
477 vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); | |
478 vf->priv->mode = 0; | |
479 if (args) sscanf(args, "%d", &vf->priv->mode); | |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
480 qpel_li = qpel_li_C; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
481 qpel_4tap = qpel_4tap_C; |
10020 | 482 #ifdef HAVE_MMX |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
483 if(gCpuCaps.hasMMX) qpel_li = qpel_li_MMX; |
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
484 if(gCpuCaps.hasMMX) qpel_4tap = qpel_4tap_MMX; |
10020 | 485 #endif |
486 #ifdef HAVE_MMX2 | |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
487 if(gCpuCaps.hasMMX2) qpel_li = qpel_li_MMX2; |
10020 | 488 #endif |
489 #ifdef HAVE_3DNOW | |
10049
765c2276aa0c
more 10l's -- fortunately part of the bug was that the buggy code didn't get called...
rfelker
parents:
10020
diff
changeset
|
490 if(gCpuCaps.has3DNow) qpel_li = qpel_li_3DNOW; |
10020 | 491 #endif |
9514 | 492 return 1; |
493 } | |
494 | |
495 vf_info_t vf_info_tfields = { | |
496 "temporal field separation", | |
497 "tfields", | |
498 "Rich Felker", | |
499 "", | |
9593
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9514
diff
changeset
|
500 open, |
e9a2af584986
Add the new -vf option wich is the same as vop in reverse order.
albeu
parents:
9514
diff
changeset
|
501 NULL |
9514 | 502 }; |
503 | |
504 |