Mercurial > mplayer.hg
annotate libmpcodecs/vf_decimate.c @ 26425:3357581cefa5
10l: Rename remaining instances of $i to $lang.
patch by Andrew Savchenko, Bircoph list ru
author | diego |
---|---|
date | Fri, 18 Apr 2008 07:16:22 +0000 |
parents | 00fff9a3b735 |
children | 08d18fe9da52 |
rev | line source |
---|---|
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
1 #include <stdio.h> |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
2 #include <stdlib.h> |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
3 #include <string.h> |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
4 |
17012 | 5 #include "config.h" |
6 #include "mp_msg.h" | |
7 #include "cpudetect.h" | |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
8 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
9 #include "img_format.h" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
10 #include "mp_image.h" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
11 #include "vf.h" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
12 |
17012 | 13 #include "libvo/fastmemcpy.h" |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
14 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
15 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
16 struct vf_priv_s { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
17 int hi, lo; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
18 float frac; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
19 int max, last, cnt; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
20 }; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
21 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
22 #ifdef HAVE_MMX |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
23 static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
24 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
25 volatile short out[4]; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
26 asm ( |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
27 "movl $8, %%ecx \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
28 "pxor %%mm4, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
29 "pxor %%mm7, %%mm7 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
30 |
19372
6334c14b38eb
Replace asmalign.h hack by ASMALIGN cpp macros from config.h.
diego
parents:
18104
diff
changeset
|
31 ASMALIGN(4) |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
32 "1: \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
33 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
34 "movq (%%"REG_S"), %%mm0 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
35 "movq (%%"REG_S"), %%mm2 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
36 "add %%"REG_a", %%"REG_S" \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
37 "movq (%%"REG_D"), %%mm1 \n\t" |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
38 "add %%"REG_b", %%"REG_D" \n\t" |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
39 "psubusb %%mm1, %%mm2 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
40 "psubusb %%mm0, %%mm1 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
41 "movq %%mm2, %%mm0 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
42 "movq %%mm1, %%mm3 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
43 "punpcklbw %%mm7, %%mm0 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
44 "punpcklbw %%mm7, %%mm1 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
45 "punpckhbw %%mm7, %%mm2 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
46 "punpckhbw %%mm7, %%mm3 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
47 "paddw %%mm0, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
48 "paddw %%mm1, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
49 "paddw %%mm2, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
50 "paddw %%mm3, %%mm4 \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
51 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
52 "decl %%ecx \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
53 "jnz 1b \n\t" |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
54 "movq %%mm4, (%%"REG_d") \n\t" |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
55 "emms \n\t" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
56 : |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
10150
diff
changeset
|
57 : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out) |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
58 : "memory" |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
59 ); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
60 return out[0]+out[1]+out[2]+out[3]; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
61 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
62 #endif |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
63 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
64 static int diff_C(unsigned char *old, unsigned char *new, int os, int ns) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
65 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
66 int x, y, d=0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
67 for (y = 8; y; y--) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
68 for (x = 8; x; x--) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
69 d += abs(new[x] - old[x]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
70 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
71 new += ns; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
72 old += os; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
73 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
74 return d; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
75 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
76 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
77 static int (*diff)(unsigned char *, unsigned char *, int, int); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
78 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
79 static int diff_to_drop_plane(int hi, int lo, float frac, unsigned char *old, unsigned char *new, int w, int h, int os, int ns) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
80 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
81 int x, y; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
82 int d, c=0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
83 int t = (w/16)*(h/16)*frac; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
84 for (y = 0; y < h-7; y += 4) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
85 for (x = 8; x < w-7; x += 4) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
86 d = diff(old+x+y*os, new+x+y*ns, os, ns); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
87 if (d > hi) return 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
88 if (d > lo) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
89 c++; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
90 if (c > t) return 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
91 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
92 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
93 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
94 return 1; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
95 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
96 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
97 static int diff_to_drop(int hi, int lo, float frac, mp_image_t *old, mp_image_t *new) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
98 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
99 if (new->flags & MP_IMGFLAG_PLANAR) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
100 return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
101 new->w, new->h, old->stride[0], new->stride[0]) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
102 && diff_to_drop_plane(hi,lo,frac, old->planes[1], new->planes[1], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
103 new->chroma_width, new->chroma_height, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
104 old->stride[1], new->stride[1]) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
105 && diff_to_drop_plane(hi,lo,frac, old->planes[2], new->planes[2], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
106 new->chroma_width, new->chroma_height, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
107 old->stride[2], new->stride[2]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
108 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
109 return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
110 new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
111 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
112 |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
113 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts) |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
114 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
115 mp_image_t *dmpi; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
116 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
117 dmpi = vf_get_image(vf->next, mpi->imgfmt, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
118 MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE | |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
119 MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
120 mpi->width, mpi->height); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
121 dmpi->qscale = mpi->qscale; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
122 dmpi->qstride = mpi->qstride; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
123 dmpi->qscale_type = mpi->qscale_type; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
124 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
125 if (diff_to_drop(vf->priv->hi, vf->priv->lo, vf->priv->frac, dmpi, mpi)) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
126 if (vf->priv->max == 0) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
127 return 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
128 else if ((vf->priv->max > 0) && (vf->priv->cnt++ < vf->priv->max)) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
129 return 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
130 else if ((vf->priv->max < 0) && (vf->priv->last+1 >= -vf->priv->max)) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
131 return vf->priv->last=0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
132 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
133 vf->priv->last++; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
134 vf->priv->cnt=0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
135 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
136 memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
137 dmpi->stride[0], mpi->stride[0]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
138 if (mpi->flags & MP_IMGFLAG_PLANAR) { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
139 memcpy_pic(dmpi->planes[1], mpi->planes[1], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
140 mpi->chroma_width, mpi->chroma_height, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
141 dmpi->stride[1], mpi->stride[1]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
142 memcpy_pic(dmpi->planes[2], mpi->planes[2], |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
143 mpi->chroma_width, mpi->chroma_height, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
144 dmpi->stride[2], mpi->stride[2]); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
145 } |
17906
20aca9baf5d8
passing pts through the filter layer (lets see if pts or cola comes out at the end)
michael
parents:
17012
diff
changeset
|
146 return vf_next_put_image(vf, dmpi, pts); |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
147 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
148 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
149 static void uninit(struct vf_instance_s* vf) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
150 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
151 free(vf->priv); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
152 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
153 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
154 static int open(vf_instance_t *vf, char* args) |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
155 { |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
156 struct vf_priv_s *p; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
157 vf->put_image = put_image; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
158 vf->uninit = uninit; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
159 vf->default_reqs = VFCAP_ACCEPT_STRIDE; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
160 vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
161 p->max = 0; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
162 p->hi = 64*12; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
163 p->lo = 64*5; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
164 p->frac = 0.33; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
165 if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac); |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
166 diff = diff_C; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
167 #ifdef HAVE_MMX |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
168 if(gCpuCaps.hasMMX) diff = diff_MMX; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
169 #endif |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
170 return 1; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
171 } |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
172 |
25221 | 173 const vf_info_t vf_info_decimate = { |
10150
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
174 "near-duplicate frame remover", |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
175 "decimate", |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
176 "Rich Felker", |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
177 "", |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
178 open, |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
179 NULL |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
180 }; |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
181 |
b34ede44dada
new filter for dropping (near-)duplicate frames. can be used to fix
rfelker
parents:
diff
changeset
|
182 |