Mercurial > mplayer.hg
annotate libmpcodecs/vf_ivtc.c @ 15593:a7abe85e8b41
avoid lrintf redeclaration
author | henry |
---|---|
date | Mon, 30 May 2005 08:18:03 +0000 |
parents | 821f464b4d90 |
children | 6ff3379a0862 |
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 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
5 #include "../config.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
6 #include "../mp_msg.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
7 #include "../cpudetect.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
8 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
9 #include "img_format.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
10 #include "mp_image.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
11 #include "vf.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
12 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
13 #include "../libvo/fastmemcpy.h" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
14 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
15 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
16 struct metrics { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
17 /* difference: total, even lines, odd lines */ |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
18 int d, e, o; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
19 /* noise: temporal, spacial (current), spacial (past) */ |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
20 int t, s, p; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
21 }; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
22 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
23 struct frameinfo { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
24 /* peak, relative, mean */ |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
25 struct metrics p, r, m; |
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 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
28 struct vf_priv_s { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
29 struct frameinfo fi[2]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
30 mp_image_t *dmpi; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
31 int first; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
32 int drop, lastdrop, dropnext; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
33 int inframes, outframes; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
34 }; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
35 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
36 enum { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
37 F_DROP, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
38 F_MERGE, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
39 F_NEXT, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
40 F_SHOW |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
41 }; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
42 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
43 static inline void *my_memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
44 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
45 int i; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
46 void *retval=dst; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
47 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
48 for(i=0; i<height; i++) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
49 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
50 memcpy(dst, src, bytesPerLine); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
51 src+= srcStride; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
52 dst+= dstStride; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
53 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
54 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
55 return retval; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
56 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
57 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
58 #ifdef HAVE_MMX |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
59 static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
60 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
61 int i; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
62 short out[24]; // output buffer for the partial metrics from the mmx code |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
63 |
9990 | 64 asm ( |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
65 "movl $4, %%ecx \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
66 "pxor %%mm4, %%mm4 \n\t" // 4 even difference sums |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
67 "pxor %%mm5, %%mm5 \n\t" // 4 odd difference sums |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
68 "pxor %%mm7, %%mm7 \n\t" // all zeros |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
69 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
70 ".balign 16 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
71 "1: \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
72 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
73 // Even difference |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
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:
9995
diff
changeset
|
75 "movq (%%"REG_S"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
76 "add %%"REG_a", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
77 "movq (%%"REG_D"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
78 "add %%"REG_b", %%"REG_D" \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
79 "psubusb %%mm1, %%mm2 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
80 "psubusb %%mm0, %%mm1 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
81 "movq %%mm2, %%mm0 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
82 "movq %%mm1, %%mm3 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
83 "punpcklbw %%mm7, %%mm0 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
84 "punpcklbw %%mm7, %%mm1 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
85 "punpckhbw %%mm7, %%mm2 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
86 "punpckhbw %%mm7, %%mm3 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
87 "paddw %%mm0, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
88 "paddw %%mm1, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
89 "paddw %%mm2, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
90 "paddw %%mm3, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
91 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
92 // Odd difference |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
93 "movq (%%"REG_S"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
94 "movq (%%"REG_S"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
95 "add %%"REG_a", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
96 "movq (%%"REG_D"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
97 "add %%"REG_b", %%"REG_D" \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
98 "psubusb %%mm1, %%mm2 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
99 "psubusb %%mm0, %%mm1 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
100 "movq %%mm2, %%mm0 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
101 "movq %%mm1, %%mm3 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
102 "punpcklbw %%mm7, %%mm0 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
103 "punpcklbw %%mm7, %%mm1 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
104 "punpckhbw %%mm7, %%mm2 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
105 "punpckhbw %%mm7, %%mm3 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
106 "paddw %%mm0, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
107 "paddw %%mm1, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
108 "paddw %%mm2, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
109 "paddw %%mm3, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
110 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
111 "decl %%ecx \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
112 "jnz 1b \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
113 "movq %%mm4, (%%"REG_d") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
114 "movq %%mm5, 8(%%"REG_d") \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
115 : |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
116 : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
117 : "memory" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
118 ); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
119 m->e = out[0]+out[1]+out[2]+out[3]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
120 m->o = out[4]+out[5]+out[6]+out[7]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
121 m->d = m->e + m->o; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
122 |
9990 | 123 asm ( |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
124 // First loop to measure first four columns |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
125 "movl $4, %%ecx \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
126 "pxor %%mm4, %%mm4 \n\t" // Past spacial noise |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
127 "pxor %%mm5, %%mm5 \n\t" // Temporal noise |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
128 "pxor %%mm6, %%mm6 \n\t" // Current spacial noise |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
129 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
130 ".balign 16 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
131 "2: \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
132 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
133 "movq (%%"REG_S"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
134 "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
135 "add %%"REG_a", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
136 "add %%"REG_a", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
137 "movq (%%"REG_D"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
138 "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
139 "add %%"REG_b", %%"REG_D" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
140 "add %%"REG_b", %%"REG_D" \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
141 "punpcklbw %%mm7, %%mm0 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
142 "punpcklbw %%mm7, %%mm1 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
143 "punpcklbw %%mm7, %%mm2 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
144 "punpcklbw %%mm7, %%mm3 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
145 "paddw %%mm1, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
146 "paddw %%mm1, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
147 "paddw %%mm3, %%mm6 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
148 "psubw %%mm0, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
149 "psubw %%mm2, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
150 "psubw %%mm2, %%mm6 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
151 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
152 "decl %%ecx \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
153 "jnz 2b \n\t" |
9990 | 154 |
155 "movq %%mm0, %%mm1 \n\t" | |
156 "movq %%mm0, %%mm2 \n\t" | |
157 "movq %%mm0, %%mm3 \n\t" | |
158 "pcmpgtw %%mm4, %%mm1 \n\t" | |
159 "pcmpgtw %%mm5, %%mm2 \n\t" | |
160 "pcmpgtw %%mm6, %%mm3 \n\t" | |
161 "pxor %%mm1, %%mm4 \n\t" | |
162 "pxor %%mm2, %%mm5 \n\t" | |
163 "pxor %%mm3, %%mm6 \n\t" | |
164 "psubw %%mm1, %%mm4 \n\t" | |
165 "psubw %%mm2, %%mm5 \n\t" | |
166 "psubw %%mm3, %%mm6 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
167 "movq %%mm4, (%%"REG_d") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
168 "movq %%mm5, 16(%%"REG_d") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
169 "movq %%mm6, 32(%%"REG_d") \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
170 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
171 "mov %%"REG_a", %%"REG_c" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
172 "shl $3, %%"REG_c" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
173 "sub %%"REG_c", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
174 "mov %%"REG_b", %%"REG_c" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
175 "shl $3, %%"REG_c" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
176 "sub %%"REG_c", %%"REG_D" \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
177 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
178 // Second loop for the last four columns |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
179 "movl $4, %%ecx \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
180 "pxor %%mm4, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
181 "pxor %%mm5, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
182 "pxor %%mm6, %%mm6 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
183 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
184 ".balign 16 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
185 "3: \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
186 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
187 "movq (%%"REG_S"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
188 "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
189 "add %%"REG_a", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
190 "add %%"REG_a", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
191 "movq (%%"REG_D"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
192 "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
193 "add %%"REG_b", %%"REG_D" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
194 "add %%"REG_b", %%"REG_D" \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
195 "punpckhbw %%mm7, %%mm0 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
196 "punpckhbw %%mm7, %%mm1 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
197 "punpckhbw %%mm7, %%mm2 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
198 "punpckhbw %%mm7, %%mm3 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
199 "paddw %%mm1, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
200 "paddw %%mm1, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
201 "paddw %%mm3, %%mm6 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
202 "psubw %%mm0, %%mm4 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
203 "psubw %%mm2, %%mm5 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
204 "psubw %%mm2, %%mm6 \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
205 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
206 "decl %%ecx \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
207 "jnz 3b \n\t" |
9990 | 208 |
209 "movq %%mm0, %%mm1 \n\t" | |
210 "movq %%mm0, %%mm2 \n\t" | |
211 "movq %%mm0, %%mm3 \n\t" | |
212 "pcmpgtw %%mm4, %%mm1 \n\t" | |
213 "pcmpgtw %%mm5, %%mm2 \n\t" | |
214 "pcmpgtw %%mm6, %%mm3 \n\t" | |
215 "pxor %%mm1, %%mm4 \n\t" | |
216 "pxor %%mm2, %%mm5 \n\t" | |
217 "pxor %%mm3, %%mm6 \n\t" | |
218 "psubw %%mm1, %%mm4 \n\t" | |
219 "psubw %%mm2, %%mm5 \n\t" | |
220 "psubw %%mm3, %%mm6 \n\t" | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
221 "movq %%mm4, 8(%%"REG_d") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
222 "movq %%mm5, 24(%%"REG_d") \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
223 "movq %%mm6, 40(%%"REG_d") \n\t" |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
224 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
225 "emms \n\t" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
226 : |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
9995
diff
changeset
|
227 : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
228 : "memory" |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
229 ); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
230 m->p = m->t = m->s = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
231 for (i=0; i<8; i++) { |
9990 | 232 m->p += out[i]; |
233 m->t += out[8+i]; | |
234 m->s += out[16+i]; | |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
235 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
236 //printf("e=%d o=%d d=%d p=%d t=%d s=%d\n", m->e, m->o, m->d, m->p, m->t, m->s); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
237 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
238 #endif |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
239 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
240 //#define MAG(a) ((a)*(a)) |
9995
62d643bc53e2
optimization -- lots of conditional jumps in inner loops are bad
rfelker
parents:
9990
diff
changeset
|
241 //#define MAG(a) (abs(a)) |
62d643bc53e2
optimization -- lots of conditional jumps in inner loops are bad
rfelker
parents:
9990
diff
changeset
|
242 #define MAG(a) (((a)^((a)>>31))-((a)>>31)) |
9933
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
243 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
244 //#define LOWPASS(s) (((s)[-2] + 4*(s)[-1] + 6*(s)[0] + 4*(s)[1] + (s)[2])>>4) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
245 //#define LOWPASS(s) (((s)[-1] + 2*(s)[0] + (s)[1])>>2) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
246 #define LOWPASS(s) ((s)[0]) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
247 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
248 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
249 static void block_diffs_C(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
250 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
251 int x, y, e=0, o=0, s=0, p=0, t=0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
252 unsigned char *oldp, *newp; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
253 m->s = m->p = m->t = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
254 for (x = 8; x; x--) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
255 oldp = old++; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
256 newp = new++; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
257 s = p = t = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
258 for (y = 4; y; y--) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
259 e += MAG(newp[0]-oldp[0]); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
260 o += MAG(newp[ns]-oldp[os]); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
261 s += newp[ns]-newp[0]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
262 p += oldp[os]-oldp[0]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
263 t += oldp[os]-newp[0]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
264 oldp += os<<1; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
265 newp += ns<<1; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
266 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
267 m->s += MAG(s); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
268 m->p += MAG(p); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
269 m->t += MAG(t); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
270 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
271 m->e = e; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
272 m->o = o; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
273 m->d = e+o; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
274 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
275 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
276 static void (*block_diffs)(struct metrics *, unsigned char *, unsigned char *, int, int); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
277 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
278 #define MAXUP(a,b) ((a) = ((a)>(b)) ? (a) : (b)) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
279 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
280 static void diff_planes(struct frameinfo *fi, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
281 unsigned char *old, unsigned char *new, int w, int h, int os, int ns) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
282 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
283 int x, y; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
284 struct metrics l; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
285 struct metrics *peak=&fi->p, *rel=&fi->r, *mean=&fi->m; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
286 memset(peak, 0, sizeof(struct metrics)); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
287 memset(rel, 0, sizeof(struct metrics)); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
288 memset(mean, 0, sizeof(struct metrics)); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
289 for (y = 0; y < h-7; y += 8) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
290 for (x = 8; x < w-8-7; x += 8) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
291 block_diffs(&l, old+x+y*os, new+x+y*ns, os, ns); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
292 mean->d += l.d; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
293 mean->e += l.e; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
294 mean->o += l.o; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
295 mean->s += l.s; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
296 mean->p += l.p; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
297 mean->t += l.t; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
298 MAXUP(peak->d, l.d); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
299 MAXUP(peak->e, l.e); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
300 MAXUP(peak->o, l.o); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
301 MAXUP(peak->s, l.s); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
302 MAXUP(peak->p, l.p); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
303 MAXUP(peak->t, l.t); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
304 MAXUP(rel->e, l.e-l.o); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
305 MAXUP(rel->o, l.o-l.e); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
306 MAXUP(rel->s, l.s-l.t); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
307 MAXUP(rel->p, l.p-l.t); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
308 MAXUP(rel->t, l.t-l.p); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
309 MAXUP(rel->d, l.t-l.s); /* hack */ |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
310 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
311 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
312 x = (w/8-2)*(h/8); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
313 mean->d /= x; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
314 mean->e /= x; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
315 mean->o /= x; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
316 mean->s /= x; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
317 mean->p /= x; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
318 mean->t /= x; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
319 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
320 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
321 static void diff_fields(struct frameinfo *fi, mp_image_t *old, mp_image_t *new) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
322 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
323 diff_planes(fi, old->planes[0], new->planes[0], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
324 new->w, new->h, old->stride[0], new->stride[0]); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
325 } |
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 static void stats(struct frameinfo *f) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
328 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
329 mp_msg(MSGT_VFILTER, MSGL_V, " pd=%d re=%d ro=%d rp=%d rt=%d rs=%d rd=%d pp=%d pt=%d ps=%d\r", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
330 f->p.d, f->r.e, f->r.o, f->r.p, f->r.t, f->r.s, f->r.d, f->p.p, f->p.t, f->p.s); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
331 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
332 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
333 static int foo(struct vf_priv_s *p, mp_image_t *new, mp_image_t *cur) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
334 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
335 struct frameinfo *f = p->fi; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
336 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
337 f[0] = f[1]; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
338 diff_fields(&f[1], cur, new); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
339 stats(&f[1]); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
340 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
341 // Immediately drop this frame if it's already been used. |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
342 if (p->dropnext) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
343 p->dropnext = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
344 return F_DROP; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
345 } |
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 // Sometimes a pulldown frame comes all by itself, so both |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
348 // its top and bottom field are duplicates from the adjacent |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
349 // two frames. We can just drop such a frame, but we |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
350 // immediately show the next frame instead to keep the frame |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
351 // drops evenly spaced during normal 3:2 pulldown sequences. |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
352 if ((3*f[1].r.o < f[1].r.e) && (f[1].r.s < f[1].r.d)) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
353 p->dropnext = 1; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
354 return F_NEXT; |
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 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
357 // If none of these conditions hold, we will consider the frame |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
358 // progressive and just show it as-is. |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
359 if (!( (3*f[0].r.e < f[0].r.o) || |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
360 ((2*f[0].r.d < f[0].r.s) && (f[0].r.s > 1200)) || |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
361 ((2*f[1].r.t < f[1].r.p) && (f[1].r.p > 1200)) )) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
362 return F_SHOW; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
363 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
364 // Otherwise, we have to decide whether to merge or drop. |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
365 // If the noise metric only increases minimally, we're off |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
366 // to a good start... |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
367 if (((2*f[1].r.t < 3*f[1].r.p) && (f[1].r.t < 3600)) || |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
368 (f[1].r.t < 900) || (f[1].r.d < 900)) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
369 // ...and if noise decreases or the duplicate even field |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
370 // is detected, we go ahead with the merge. |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
371 if ((3*f[0].r.e < f[0].r.o) || (2*f[1].r.t < f[1].r.p)) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
372 p->dropnext = 1; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
373 return F_MERGE; |
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 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
376 return F_DROP; |
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 |
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 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
381 static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
382 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
383 switch (field) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
384 case 0: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
385 my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
386 dmpi->stride[0]*2, mpi->stride[0]*2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
387 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
388 my_memcpy_pic(dmpi->planes[1], mpi->planes[1], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
389 mpi->chroma_width, mpi->chroma_height/2, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
390 dmpi->stride[1]*2, mpi->stride[1]*2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
391 my_memcpy_pic(dmpi->planes[2], mpi->planes[2], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
392 mpi->chroma_width, mpi->chroma_height/2, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
393 dmpi->stride[2]*2, mpi->stride[2]*2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
394 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
395 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
396 case 1: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
397 my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
398 mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
399 dmpi->stride[0]*2, mpi->stride[0]*2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
400 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
401 my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
402 mpi->planes[1]+mpi->stride[1], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
403 mpi->chroma_width, mpi->chroma_height/2, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
404 dmpi->stride[1]*2, mpi->stride[1]*2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
405 my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
406 mpi->planes[2]+mpi->stride[2], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
407 mpi->chroma_width, mpi->chroma_height/2, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
408 dmpi->stride[2]*2, mpi->stride[2]*2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
409 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
410 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
411 case 2: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
412 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
413 dmpi->stride[0], mpi->stride[0]); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
414 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
415 memcpy_pic(dmpi->planes[1], mpi->planes[1], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
416 mpi->chroma_width, mpi->chroma_height, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
417 dmpi->stride[1], mpi->stride[1]); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
418 memcpy_pic(dmpi->planes[2], mpi->planes[2], |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
419 mpi->chroma_width, mpi->chroma_height, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
420 dmpi->stride[2], mpi->stride[2]); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
421 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
422 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
423 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
424 } |
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 static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
427 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
428 struct vf_priv_s *p = vf->priv; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
429 int dropflag; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
430 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
431 switch (p->drop && !p->dropnext) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
432 case 0: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
433 dropflag = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
434 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
435 case 1: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
436 dropflag = (++p->lastdrop >= 5); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
437 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
438 case 2: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
439 dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
440 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
441 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
442 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
443 if (dropflag) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
444 //mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
445 // p->outframes, p->inframes, (float)p->outframes/p->inframes); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
446 mp_msg(MSGT_VFILTER, MSGL_V, "!"); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
447 p->lastdrop = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
448 return 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
449 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
450 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
451 p->outframes++; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
452 return vf_next_put_image(vf, dmpi); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
453 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
454 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
455 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
456 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
457 int ret=0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
458 struct vf_priv_s *p = vf->priv; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
459 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
460 p->inframes++; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
461 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
462 if (p->first) { /* hack */ |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
463 p->first = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
464 return 1; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
465 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
466 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
467 if (!p->dmpi) p->dmpi = vf_get_image(vf->next, mpi->imgfmt, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
468 MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
469 MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
470 mpi->width, mpi->height); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
471 /* FIXME -- not correct, off by one frame! */ |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
472 p->dmpi->qscale = mpi->qscale; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
473 p->dmpi->qstride = mpi->qstride; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
474 p->dmpi->qscale_type = mpi->qscale_type; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
475 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
476 switch (foo(p, mpi, p->dmpi)) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
477 case F_DROP: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
478 copy_image(p->dmpi, mpi, 2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
479 ret = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
480 p->lastdrop = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
481 mp_msg(MSGT_VFILTER, MSGL_V, "DROP\n"); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
482 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
483 case F_MERGE: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
484 copy_image(p->dmpi, mpi, 0); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
485 ret = do_put_image(vf, p->dmpi); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
486 copy_image(p->dmpi, mpi, 1); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
487 mp_msg(MSGT_VFILTER, MSGL_V, "MERGE\n"); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
488 p->dmpi = NULL; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
489 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
490 case F_NEXT: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
491 copy_image(p->dmpi, mpi, 2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
492 ret = do_put_image(vf, p->dmpi); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
493 mp_msg(MSGT_VFILTER, MSGL_V, "NEXT\n"); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
494 p->dmpi = NULL; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
495 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
496 case F_SHOW: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
497 ret = do_put_image(vf, p->dmpi); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
498 copy_image(p->dmpi, mpi, 2); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
499 mp_msg(MSGT_VFILTER, MSGL_V, "OK\n"); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
500 p->dmpi = NULL; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
501 break; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
502 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
503 return ret; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
504 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
505 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
506 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
|
507 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
508 switch (fmt) { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
509 case IMGFMT_YV12: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
510 case IMGFMT_IYUV: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
511 case IMGFMT_I420: |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
512 return vf_next_query_format(vf, fmt); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
513 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
514 return 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
515 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
516 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
517 static void uninit(struct vf_instance_s* vf) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
518 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
519 free(vf->priv); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
520 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
521 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
522 static int open(vf_instance_t *vf, char* args) |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
523 { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
524 struct vf_priv_s *p; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
525 vf->put_image = put_image; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
526 vf->query_format = query_format; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
527 vf->uninit = uninit; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
528 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
529 vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
530 p->drop = 0; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
531 p->first = 1; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
532 if (args) sscanf(args, "%d", &p->drop); |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
533 block_diffs = block_diffs_C; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
534 #ifdef HAVE_MMX |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
535 if(gCpuCaps.hasMMX) block_diffs = block_diffs_MMX; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
536 #endif |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
537 return 1; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
538 } |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
539 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
540 vf_info_t vf_info_ivtc = { |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
541 "inverse telecine, take 2", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
542 "ivtc", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
543 "Rich Felker", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
544 "", |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
545 open, |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
546 NULL |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
547 }; |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
548 |
3548701a13fe
1. new alternate approach to inverse telecine! much better!
rfelker
parents:
diff
changeset
|
549 |